SlideShare uma empresa Scribd logo
1 de 19
mod_auth
              2011/04/08
           @suzumura_ss
• tottoruby
Apache Hooks
•

    • Input filter
    • Content generator
    • Output filter


•
Input filter (1)
• post_read_request
• translate_name
   • ex) mod_alias
• map_to_storage
   • ex) <Directory />, <Files />, mod_proxy
• header_parser
   • ex) mod_setenvif
Input filter (2)
• access_checker
   • ex) mod_access, mod_authz_host
• check_user_id
• auth_checker
• type_checker
• fixups
Content generator
            and Output filter
•

• Content generator
    • mod_passenger, mod_cgi, ...
• Output filter
    • mod_xsendfile
mod_passenger+Rails
•           Request
                      request    /tmp
    header    Body
    Rails
                      response          Rails
• Content generator
mod_cgi
• /tmp
                   request

               response      CGI
/cgi-bin/401.cgi
1:   #!/usr/bin/ruby
2:   STDERR.puts "Incoming CGI..."
3:
4:   puts <<__RESULT__
5:   Status: 401
6:
7:   __RESULT__
8:
9:   STDERR.puts "CGI done."
PUT /cgi-bin/401.cgi
$ curl localhost/cgi-bin/401.cgi 
  -T xcode_3.2.6_and_ios_sdk_4.3__final.dmg > /dev/null
  % Total    % Received % Xferd Average Speed    Time   Time    Time Current
                                 Dload Upload    Total  Spent   Left Speed
100 4237M    0     0 100 4237M       0   114M 0:00:37 0:00:37 --:--:-- 118M

==> access_log <==
::1 - - [05/Apr/2011:14:37:13 +0900] "PUT /cgi-bin/401.cgi HTTP/1.1" 401 -

==> error_log <==
[Tue Apr 05 14:37:50 2011] [error] [client ::1] Incoming CGI...
[Tue Apr 05 14:37:50 2011] [error] [client ::1] CGI done.




       14:37:13             PUT
                            14:37:50
Input filter
•

•


•
•

    • ap_hook_auth_checker() hook
•          ACCESS DENIED



    • ap_hook_access_checker() hook
mod_auth_httprequest
•

     • https://github.com/suzumura-ss/
       mod_auth_httprequest


•       URL   HEAD                  200(OK),
    201(Created), 202(Accepted)
• ap_hook_check_user_id() hook
 libcurl      HEAD

• ap_hook_auth_checker() hook



• config
PUT /


           HEAD /cgi-bin/auth.cgi



response
httpd.conf
<Directory "/var/www/html">
        :
  Require    valid-request
  AuthType AuthHttpRequest
  AuthName X-Auth-HttpRequest
  AuthHttpRequest-URL 
   http://localhost/cgi-bin/401.cgi
</Directory>
$ curl localhost/ 
  -T xcode_3.2.6_and_ios_sdk_4.3__final.dmg
  % Total    % Received % Xferd Average Speed    Time    Time     Time Current
                                 Dload Upload    Total   Spent    Left Speed
  0 4237M 100    475    0     0 90338       0 --:--:-- --:--:-- --:--:--     0

==> access_log <==
127.0.0.1 - - [05/Apr/2011:17:57:34 +0900] "HEAD /cgi-bin/auth.cgi HTTP/1.1"
401 - "-" "mod_auth_httprequest/0.1 libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3
libidn/0.6.5"
127.0.0.1 - - [05/Apr/2011:17:57:34 +0900] "PUT /xcode%5F3%2E2%2E6%5Fand%5Fios
%5Fsdk%5F4%2E3%5F%5Ffinal%2Edmg HTTP/1.1" 401 475 "-" "curl/7.15.5 (i686-
redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5"

==> error_log <==
[Tue Apr 05 17:57:34 2011] [error] [client 127.0.0.1] Incoming CGI...
[Tue Apr 05 17:57:34 2011] [error] [client 127.0.0.1] CGI done.

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

HTTPBuilder NG: Back From The Dead
HTTPBuilder NG: Back From The DeadHTTPBuilder NG: Back From The Dead
HTTPBuilder NG: Back From The Dead
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Ruby HTTP clients
Ruby HTTP clientsRuby HTTP clients
Ruby HTTP clients
 
Edward
EdwardEdward
Edward
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
OneRing @ OSCamp 2010
OneRing @ OSCamp 2010OneRing @ OSCamp 2010
OneRing @ OSCamp 2010
 
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
 
Observability with Consul Connect
Observability with Consul ConnectObservability with Consul Connect
Observability with Consul Connect
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
 
Nginx-lua
Nginx-luaNginx-lua
Nginx-lua
 
Annotation processing and code gen
Annotation processing and code genAnnotation processing and code gen
Annotation processing and code gen
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Top Node.js Metrics to Watch
Top Node.js Metrics to WatchTop Node.js Metrics to Watch
Top Node.js Metrics to Watch
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
Codified PostgreSQL Schema
Codified PostgreSQL SchemaCodified PostgreSQL Schema
Codified PostgreSQL Schema
 

Semelhante a Apache mod authまわりとか

Semelhante a Apache mod authまわりとか (20)

Apache2.3 探訪
Apache2.3 探訪Apache2.3 探訪
Apache2.3 探訪
 
20100305
2010030520100305
20100305
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
Web前端性能优化 2014
Web前端性能优化 2014Web前端性能优化 2014
Web前端性能优化 2014
 
Hacking Wordpress Plugins
Hacking Wordpress PluginsHacking Wordpress Plugins
Hacking Wordpress Plugins
 
Rack
RackRack
Rack
 
HTTP Caching and PHP
HTTP Caching and PHPHTTP Caching and PHP
HTTP Caching and PHP
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
Intro to CloudStack API
Intro to CloudStack APIIntro to CloudStack API
Intro to CloudStack API
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtime
 
PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)PHP記帳網頁教材(第一頁是空白的)
PHP記帳網頁教材(第一頁是空白的)
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
 
rest3d Web3D 2014
rest3d Web3D 2014rest3d Web3D 2014
rest3d Web3D 2014
 
RoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails exampleRoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails example
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
 
From zero to hero - Easy log centralization with Logstash and Elasticsearch
From zero to hero - Easy log centralization with Logstash and ElasticsearchFrom zero to hero - Easy log centralization with Logstash and Elasticsearch
From zero to hero - Easy log centralization with Logstash and Elasticsearch
 
From Zero to Hero - Centralized Logging with Logstash & Elasticsearch
From Zero to Hero - Centralized Logging with Logstash & ElasticsearchFrom Zero to Hero - Centralized Logging with Logstash & Elasticsearch
From Zero to Hero - Centralized Logging with Logstash & Elasticsearch
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKit
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Apache mod authまわりとか

  • 1. mod_auth 2011/04/08 @suzumura_ss
  • 3. Apache Hooks • • Input filter • Content generator • Output filter •
  • 4. Input filter (1) • post_read_request • translate_name • ex) mod_alias • map_to_storage • ex) <Directory />, <Files />, mod_proxy • header_parser • ex) mod_setenvif
  • 5. Input filter (2) • access_checker • ex) mod_access, mod_authz_host • check_user_id • auth_checker • type_checker • fixups
  • 6. Content generator and Output filter • • Content generator • mod_passenger, mod_cgi, ... • Output filter • mod_xsendfile
  • 7. mod_passenger+Rails • Request request /tmp header Body Rails response Rails • Content generator
  • 8. mod_cgi • /tmp request response CGI
  • 9.
  • 10. /cgi-bin/401.cgi 1: #!/usr/bin/ruby 2: STDERR.puts "Incoming CGI..." 3: 4: puts <<__RESULT__ 5: Status: 401 6: 7: __RESULT__ 8: 9: STDERR.puts "CGI done."
  • 11. PUT /cgi-bin/401.cgi $ curl localhost/cgi-bin/401.cgi -T xcode_3.2.6_and_ios_sdk_4.3__final.dmg > /dev/null % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 4237M 0 0 100 4237M 0 114M 0:00:37 0:00:37 --:--:-- 118M ==> access_log <== ::1 - - [05/Apr/2011:14:37:13 +0900] "PUT /cgi-bin/401.cgi HTTP/1.1" 401 - ==> error_log <== [Tue Apr 05 14:37:50 2011] [error] [client ::1] Incoming CGI... [Tue Apr 05 14:37:50 2011] [error] [client ::1] CGI done. 14:37:13 PUT 14:37:50
  • 12.
  • 14. • ap_hook_auth_checker() hook • ACCESS DENIED • ap_hook_access_checker() hook
  • 15. mod_auth_httprequest • • https://github.com/suzumura-ss/ mod_auth_httprequest • URL HEAD 200(OK), 201(Created), 202(Accepted)
  • 16. • ap_hook_check_user_id() hook libcurl HEAD • ap_hook_auth_checker() hook • config
  • 17. PUT / HEAD /cgi-bin/auth.cgi response
  • 18. httpd.conf <Directory "/var/www/html"> : Require valid-request AuthType AuthHttpRequest AuthName X-Auth-HttpRequest AuthHttpRequest-URL http://localhost/cgi-bin/401.cgi </Directory>
  • 19. $ curl localhost/ -T xcode_3.2.6_and_ios_sdk_4.3__final.dmg % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 4237M 100 475 0 0 90338 0 --:--:-- --:--:-- --:--:-- 0 ==> access_log <== 127.0.0.1 - - [05/Apr/2011:17:57:34 +0900] "HEAD /cgi-bin/auth.cgi HTTP/1.1" 401 - "-" "mod_auth_httprequest/0.1 libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5" 127.0.0.1 - - [05/Apr/2011:17:57:34 +0900] "PUT /xcode%5F3%2E2%2E6%5Fand%5Fios %5Fsdk%5F4%2E3%5F%5Ffinal%2Edmg HTTP/1.1" 401 475 "-" "curl/7.15.5 (i686- redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5" ==> error_log <== [Tue Apr 05 17:57:34 2011] [error] [client 127.0.0.1] Incoming CGI... [Tue Apr 05 17:57:34 2011] [error] [client 127.0.0.1] CGI done.

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n