Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2014 Adobe Systems Incorporated. All Rights R...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Prerequisite Knowledge
 Before watching this,...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Securing Apache HTTP Server
 Keep Apache HTTP...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Firewall Rules
4
TCP 4503
TCP
80/443
Load
Bala...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Firewall Rules
 If you are using the Link Che...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Keep bad traffic out!
 Leverage dispatcher to...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Dispatcher Security
 Keep dispatcher up to da...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Dispatcher Security – Implementing /filter in ...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Dispatcher Security
 If your site doesn’t all...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Dispatcher Security – Cache Flooding and Flush...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Dispatcher Security – Preventing Against DoS A...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Dispatcher Security – Protect Against DoS Atta...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
DEMO
13
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Using a CDN
 Use a CDN
 A content delivery n...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Using a CDN
 Use a CDN
 Another way of reduc...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Using a CDN
1. Whole site through CDN
 Pros
...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Using a CDN
3. Custom flush agent + long TTLs
...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Using a CDN
 For non-cacheable URLs (with que...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Using a CDN
 For all approaches it would be n...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Using a CDN
 Tips for using a CDN
 Use mod_d...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Client-side Browser Caching
 Using the Client...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Client-side Browser Caching
 If using SSI in ...
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
DEMO
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Upcoming SlideShare
Loading in …5
×

AEM (CQ) Dispatcher Security and CDN+Browser Caching

12,717 views

Published on

This presentation cover Adobe AEM Dispatcher security and CDN and browser caching.

This presentation is the second part of a webinar on AEM Dispatcher:
http://dev.day.com/content/ddc/en/gems/dispatcher-caching---new-features-and-optimizations.html

Visit url above to view the whole presentation. Domique Pfister the primary engineer developing AEM Dispatcher covers the first part on new features.

Published in: Technology
  • Be the first to comment

AEM (CQ) Dispatcher Security and CDN+Browser Caching

  1. 1. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Securing Dispatcher + CDN and Client-side caching Andrew Khoury – Senior Customer Satisfaction Engineer 1
  2. 2. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Prerequisite Knowledge  Before watching this, you need to know:  Basics of HTTP protocol  Apache HTTP Server configurations  AEM Dispatcher  Which requests get cached  Familiarity with dispatcher.any configurations  For review, refer to this past Dispatcher webinar:https://github.com/cqsupport/webinar-dispatchercache 2
  3. 3. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Securing Apache HTTP Server  Keep Apache HTTP Server binaries up to date - http://httpd.apache.org/  Be aware of the latest Apache security reports:  http://httpd.apache.org/security_report.html  Limit Apache user access –http://httpd.apache.org/docs/2.2/misc/security_tips.html  Disable .htaccess files: AllowOverride None  If using SSI, set: Options +IncludesNOEXEC not: Options +Includes  Disable UserDir or don’t load mod_userdir UserDir disabled  Disable directory listing in Apache Options -Indexes  Disable Apache modules you are not using  Consider using a Web Application Firewall (WAF) such as mod_security or using a WAF appliance (not covered in this presentation) 3
  4. 4. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Firewall Rules 4 TCP 4503 TCP 80/443 Load Balancer Dispatchers Publish Instances Author Instance(s) TCP 80/443 TCP 4503 TCP 80/443 TCP 4503 TCP 80/443 TCP 4503 TCP 80/443 External Networks *Allow all outbound TCP/IP for Link Checker and cloud services. *Allow all outbound TCP/IP for Link Checker Internal Network Author Dispatcher TCP 4502 TCP 80/443
  5. 5. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Firewall Rules  If you are using the Link Checker then allow all outbound TCP/IP connections  If you are not using the Link Checker, but plan to use some Cloud Services then implement outbound firewall rules as mentioned here: http://helpx.adobe.com/analytics/kb/adobe-ip-addresses.html 5
  6. 6. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Keep bad traffic out!  Leverage dispatcher to keep bad traffic out  Web Server + Dispatcher  Last line of defense before AEM  Prevent extra load by  Blocking bad requests  Caching valid requests (whenever possible) 6
  7. 7. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Dispatcher Security  Keep dispatcher up to date  Bug Fix Listing: http://www.aemstuff.com/tools/dispatcheronlinetracker.html  Latest Dispatcher Download: https://www.adobeaemcloud.com/content/companies/public/adobe/dispatcher/di spatcher.html 7
  8. 8. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Dispatcher Security – Implementing /filter in dispatcher.any  Keeping bad traffic out using /filter rules  Use the new dispatcher rule format (covered earlier)  Use a whitelist style /filter section  Deny everything first  Then only allow what you need  For allow rules, be specific  For example, specify the “method” (“GET”, “POST”, “HEAD”, etc.)  For deny rules, don’t be specific  Use the new vanity URL feature (After dispatcher 4.1.9 is released) 8
  9. 9. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Dispatcher Security  If your site doesn’t allow user logins then  Block HTTP basic auth  List all allowed headers in /clientheaders in dispatcher.any  Omit header “Authorization”  Block AEM token authentication (/filter section) /0091 { /type ”deny” /url ”*/j_security_check” }  Block unused request methods (Apache httpd.conf) <LimitExcept HEAD GET POST> deny from all </LimitExcept> 9
  10. 10. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Dispatcher Security – Cache Flooding and Flushing  Error pages  4xx and 5xx responses  Set correct HTTP status (in response from publish)  Cache custom error pages  use DispatcherPassError (httpd.conf)  Return 403 or 404 for bad requests  Block unused selectors (in AEM publish)  Block unused querystrings (in AEM publish)  How?  Use cq-urlfilter – https://github.com/justinedelson/cq-urlfilter  Or implement a solution (javax.servlet.Filter) in your application  Set /serveStaleOnError “1”  Block unwanted cache flushes  /allowedClients - restrict which hosts can flush the cache 10
  11. 11. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Dispatcher Security – Preventing Against DoS Attacks  Implement a periodic refreshing script to cache expensive requests.  RSS feed  Site map  Sample script: 11 #!/bin/bash #recache_file.sh usage: recache_file.sh /content/geometrixx/en.html PUBLISH_SERVER=http://host:4503 CACHE_ROOT=/var/www/html filename=$(basename "$1") tmpfilepath=/tmp/tmp_cache_$filename if [ -f $tmpfilepath$1 ] ; then echo "Not running recache_file.sh - File exists: $tmpfilepath$1" exit 0 fi status=`curl -o $tmpfilepath --silent --write-out '%{http_code}n' $PUBLISH_SERVER$1` if [ $status -eq 200 ]; then mv $tmpfilepath $CACHE_ROOT$1; #chown apache:apache $CACHE_ROOT$1; Else rm -f $tmpfilepath fi
  12. 12. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Dispatcher Security – Protect Against DoS Attacks  Configure /ignoreUrlParams  Allowing requests with querystrings to get cached  Allow rules to “ignore” querystring parameters  Set request timeout per AEM instance (in /renders section)  Set /timeout so that you don’t run out of threads in a apache when the back end is unresponsive.  5-10 minutes is usually long enough. 12
  13. 13. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. DEMO 13
  14. 14. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Using a CDN  Use a CDN  A content delivery network (CDN) is a large distributed system of cache servers that optimize content delivery using geographical proximity  CDNs leverage the Cache-Control header or manually configured TTL values to decide when the cached item is stale.  Some CDNs support purge requests where you can flush items from the cache on demand.  Popular CDN providers – Akamai, Amazon, Rackspace, etc… 14 Browser Cache CDN Dispatcher AEM Publish Instances
  15. 15. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Using a CDN  Use a CDN  Another way of reducing traffic from reaching the back-end  Multiple Deployment Options 1. Use short TTLs and serve all URLs through CDN 2. Serve assets (images, videos, etc.), clientlibs and static resources such as js, css, etc. only through CDN 3. Implement a custom flush agent that can purge the CDN and use long TTLs (serve everything through CDN) 15
  16. 16. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Using a CDN 1. Whole site through CDN  Pros  Html pages benefit from CDN edge cache performance.  Optimal page load performance  Cons  Potentially expensive as you are serving everything out of the CDN  User waits for TTL expiration before receiving latest content 2. Assets, clientlibs and static resources in CDN  Pros  Save money on CDN charges  Immediate content updates  Cons  More traffic going to Dispatcher servers 16
  17. 17. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Using a CDN 3. Custom flush agent + long TTLs  Pros  Gives ability to deliver content on-demand and cache for long periods  Reduces dispatcher traffic  Cons  In real practice not effective or worth the effort:  CDN purges are generally slow anyway (so I have been told)  Development and maintenance costs on a custom flush agent  Possibly makes sense if you have a very large high traffic site. 17
  18. 18. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Using a CDN  For non-cacheable URLs (with querystring, POST requests, etc) Dispatcher will not process the response through the Apache handler.  So the headers returned will match those coming from AEM.  Some CDNs (e.g. Cloudfront) will cache responses that don’t have a “Cache- Control: max-age” set.  Solutions  Set headers to tell the CDN and browser not to cache: Cache-Control: no-cache Pragma: no-cache  Or if relevant, set a short expiration like 30 seconds, for example: Cache-Control: max-age=30  Or allow the browser to cache, but not the CDN, for example: Cache-Control: private, max-age=30 18
  19. 19. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Using a CDN  For all approaches it would be nice to:  Cache js, css and other “static” files for a very long time  Be able to use domain sharding  How do we do that?  Use solution developed by Adobe Consulting  http://adobe-consulting- services.github.io/acs-aem- commons/#features  Versioned Clientlibs – adds md5 hash to clientlib urls  Static Reference Rewriter – rewrites the domain of resources included in the page.  Used to point clientlibs and other static resources to the CDN  and handles domain sharding 19
  20. 20. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Using a CDN  Tips for using a CDN  Use mod_deflate in apache to save money on CDN charges.  If your site has personalization then consider leveraging ESI 20
  21. 21. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Client-side Browser Caching  Using the Client-side Browser Cache  Often overlooked  Easy to implement  Saves you money on CDN charges  Use mod_expires  Leverage Etags and Last Modified Since headers  When not using a CDN, use Sticky Sessions on your load balancer 21
  22. 22. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Client-side Browser Caching  If using SSI in Apache  Last Modified Since will not be sent  Use mod_expires to set an expiration on those html files  ***No cache related headers are sent for files not cached by dispatcher  Note: If user clicks refresh it will re-request the URL (bypassing cache) 22
  23. 23. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. DEMO
  24. 24. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

×