SlideShare a Scribd company logo
Secure Your Site
Matt Farina
Lead Engineer
HP Cloud
You can get the slides at...

http://bit.ly/SecureYourSite
• @mattfarina on twitter
• Drupal.org UID 25701 (Over 8 Years)
• Co-Author of Drupal 7 Module Development
• Lead Engineer at HP Cloud
Did you hear, Adobe was hacked

http://techcrunch.com/2013/10/03/adobe-gets-hacked-product-source-code-and-data-for-2-9m-customers-likely-accessed/
A Picture Of The Internet

http://motherboard.vice.com/blog/this-is-most-detailed-picture-internet-ever
420,000 Hacked Linux Based Systems

http://motherboard.vice.com/blog/this-is-most-detailed-picture-internet-ever
71% attacked sites of orgs with less than 100 People

http://www.forbes.com/sites/cherylsnappconner/2013/09/14/are-you-prepared-71-of-cyber-attacks-hit-small-business/
Scan port 22 (ssh) for the Internet in a day

http://blog.erratasec.com/2013/09/we-scanned-internet-for-port-22.html
I’ve Watched Attacks Happen
I’ve Found Hacked Servers
For the sake of your
users, secure your site.
Harden Your Servers

https://help.ubuntu.com/12.04/serverguide/security.html
Keep packages up to date for security releases

https://help.ubuntu.com/community/AutoWeeklyUpdateHowTo
Lock Down Access

Web Server

DB Server
Use A VPN

http://openvpn.net/
Removing X-Powered-By Header

> curl -i -X HEAD https://drupal.org
...
X-Powered-By: PHP/5.3.27
...

; In your php.ini file set
expose_php = off

http://stackoverflow.com/questions/2661799/removing-x-powered-by
On to Drupal
Use HTTPS/SSL/TLS
Secure your site
You can redirect to https via .htaccess

# Redirect when the request comes to http
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Secure Pages Module

https://drupal.org/project/securepages
Secure UID 1

https://drupal.org/node/947312
If you’re on Drupal 6 use real password hashing

https://drupal.org/project/password
PHP Password API

http://php.net/password
PHP Password API Backward Compatability

https://github.com/ircmaxell/password_compat
Change Admin
passwords regularly and
make them strong.
Remove the clues it’s Drupal

• Remove the text files (e.g., CHANGELOG.txt)
• Remove install.php
• web.config or .htaccess if not in use
Remove Generator Meta Tag

<meta name="generator" content="Drupal 7 (http://drupal.org)" />

/**
* Implements hook_html_head_alter().
*/
function custom_html_head_alter(&$head_elements) {
if (isset($head_elements['system_meta_generator'])) {
unset($head_elements['system_meta_generator']);
}
}
Remove X-Generator Header

> curl -i -X HEAD https://2013.drupalcampmi.org
...
X-Generator: Drupal 7 (http://drupal.org)
...

// Override the header.
drupal_add_http_header(‘X-Generator’, ‘’)

https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_add_http_header/7
Add X-Frame-Options Header

> curl -i -X HEAD https://marketplace.hpcloud.com
...
X-Frame-Options: SAMEORIGIN
...

drupal_add_http_header('X-Frame-Options', 'SAMEORIGIN');

https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
Secure The Filesystem

http://www.lullabot.com/blog/article/keeping-drupals-files-safe
Web server user
should not have write
permission to Drupal
Backup to offsite location

http://www.hpcloud.com/products-services/object-storage
Backup and Migrate Module

https://drupal.org/project/backup_migrate
Encrypt Backups

https://drupal.org/project/aes
Backup Creds Not On Production Server

Web Server

DB Server

Backup Server

Storage
I shouldn’t have to tell
you but...
Keep Drupal Up To Date

https://drupal.org/project/usage/drupal
Update Manager Module

https://drupal.org/documentation/modules/update
Sign-up For Security Announcements
Encrypt Sensitive
Information
AES Encryption Module

https://drupal.org/project/aes
PHP Secure Communications Library

http://phpseclib.sourceforge.net/
Encrypted Field Modules

• Encrypted Settings Field

https://drupal.org/project/encset

• Field Encryption

https://drupal.org/project/field_encrypt

• Encrypted Text

https://drupal.org/project/encrypted_text
Or, Store Them In A Secure Service
drupal_http_request()
does not check SSL
certificates.
Guzzle

http://guzzlephp.org/
Using Guzzle

// A simple example
GuzzleHttpStaticClient::mount();
$response = Guzzle::get('http://guzzlephp.org');

// A little more complicated
$client = new GuzzleHttpClient('http://guzzlephp.org');
$request = $client->get('/');
$response = $request->send();
Inject Cert To drupal_http_request()

$opts = array(
‘ssl’ => array(
‘verify_host’ => TRUE,
‘verify_peer’ => TRUE,
‘allow_self_signed’ => FALSE,
‘cafile’ => ‘path/to/cert.pem’,
),
);
$context = stream_create_context($opts);
$ops = array(
‘context’ => $context,
);
$res = drupal_http_request(‘http://example.com’, $ops);
Review Your Logs
Regularly
Logstash

http://logstash.net/
Loggly

http://www.loggly.com/
Automated Alerts

http://www.loggly.com/docs/alerts-overview/
This is just the
beginning...
Questions?
Slides are at...
http://bit.ly/SecureYourSite

More Related Content

KEY
Drupal Security Intro
PPT
Securing Drupal 7: Do not get Hacked or Spammed to death!
PDF
Hack Proof Your Drupal Site
ODP
Drupal Security Hardening
PDF
Attacking Drupal
PDF
Doing Drupal security right
PDF
Browser Serving Your Web Application Security - NorthEast PHP 2017
PDF
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Drupal Security Intro
Securing Drupal 7: Do not get Hacked or Spammed to death!
Hack Proof Your Drupal Site
Drupal Security Hardening
Attacking Drupal
Doing Drupal security right
Browser Serving Your Web Application Security - NorthEast PHP 2017
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)

What's hot (20)

PDF
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017
PDF
Drupal and Security: What You Need to Know
PPTX
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
PPTX
Dan Catalin Vasile - Hacking the Wordpress Ecosystem
PPTX
REST Easy with Django-Rest-Framework
PDF
Building RESTful APIs
PDF
Secure Your Wordpress
PDF
Django Rest Framework - tips & trick
PPTX
WordPress Security - A Hacker's Guide - WordCamp 2019 Islamabad
PDF
HTTPS + Let's Encrypt
PPTX
Securing Your WordPress Installation
PDF
MySQL for Beginners - part 1
PPTX
關於SQL Injection的那些奇技淫巧
PPTX
SANS @Night Talk: SQL Injection Exploited
PDF
Csp and http headers
PPTX
Hashicorp Vault ppt
PDF
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
PPTX
BGOUG 2014 Decrease Your MySQL Attack Surface
PPTX
Tips & Tricks in securing your WordPress installation
PPTX
Vault - Secret and Key Management
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017
Drupal and Security: What You Need to Know
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
Dan Catalin Vasile - Hacking the Wordpress Ecosystem
REST Easy with Django-Rest-Framework
Building RESTful APIs
Secure Your Wordpress
Django Rest Framework - tips & trick
WordPress Security - A Hacker's Guide - WordCamp 2019 Islamabad
HTTPS + Let's Encrypt
Securing Your WordPress Installation
MySQL for Beginners - part 1
關於SQL Injection的那些奇技淫巧
SANS @Night Talk: SQL Injection Exploited
Csp and http headers
Hashicorp Vault ppt
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
BGOUG 2014 Decrease Your MySQL Attack Surface
Tips & Tricks in securing your WordPress installation
Vault - Secret and Key Management
Ad

Viewers also liked (20)

PPT
Alfresco from an agile framework perspective
PDF
Blocks & layouts szeged
KEY
Twig for Drupal @ Frontendunited Amsterdam 2012
PDF
Powering a Lean Startup With Drupal V.1
PDF
Using Drupal to power SaaS
PDF
Contributing to drupal
PDF
Crowds and Creativity
PPTX
Drupal Backbone.js in the Frontend
KEY
Automating Drupal Development: Makefiles, features and beyond
PDF
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
PDF
Competing with Giants - How to Win With Drupal vs. Proprietary Alternatives
PDF
Multilenguaje en Drupal 8
PPTX
Views primer
PDF
Contribuir en Drupal: Por dónde empiezo?
ODP
Drupalcon2007 Sun
PDF
Why I Hate Drupal
PDF
Drupal 8 Configuration Management with Features
PDF
Frontend thunderdome
PDF
Faster Drupal sites using Queue API
PDF
Building and Maintaining a Distribution in Drupal 7 with Features
Alfresco from an agile framework perspective
Blocks & layouts szeged
Twig for Drupal @ Frontendunited Amsterdam 2012
Powering a Lean Startup With Drupal V.1
Using Drupal to power SaaS
Contributing to drupal
Crowds and Creativity
Drupal Backbone.js in the Frontend
Automating Drupal Development: Makefiles, features and beyond
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Competing with Giants - How to Win With Drupal vs. Proprietary Alternatives
Multilenguaje en Drupal 8
Views primer
Contribuir en Drupal: Por dónde empiezo?
Drupalcon2007 Sun
Why I Hate Drupal
Drupal 8 Configuration Management with Features
Frontend thunderdome
Faster Drupal sites using Queue API
Building and Maintaining a Distribution in Drupal 7 with Features
Ad

Similar to Secure your site (20)

PDF
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
ODP
Drupal Theme Development - DrupalCon Chicago 2011
PDF
Development Setup of B-Translator
PDF
Drupal 8 what to wait from
PPT
Drupal @ MediaCamp Athens
PPTX
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)
PPTX
An Introduction to Dashing and Smashing
PPTX
Anatomy of a Drupal Hack - TechKnowFile 2014
PPTX
Speed up your developments with Symfony2
PDF
Drupal campleuven: Secure Drupal Development
PDF
Drupal Security from Drupalcamp Bratislava
PDF
[rwdsummit2012] Adaptive Images in Responsive Web Design
PDF
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
PPTX
Cloud init and cloud provisioning [openstack summit vancouver]
PDF
[html5tx] Adaptive Images in Responsive Web Design
PPT
Benefit of CodeIgniter php framework
PDF
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
PDF
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
PPTX
Web Components: back to the future
PDF
Drupal performance and scalability
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Theme Development - DrupalCon Chicago 2011
Development Setup of B-Translator
Drupal 8 what to wait from
Drupal @ MediaCamp Athens
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)
An Introduction to Dashing and Smashing
Anatomy of a Drupal Hack - TechKnowFile 2014
Speed up your developments with Symfony2
Drupal campleuven: Secure Drupal Development
Drupal Security from Drupalcamp Bratislava
[rwdsummit2012] Adaptive Images in Responsive Web Design
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Cloud init and cloud provisioning [openstack summit vancouver]
[html5tx] Adaptive Images in Responsive Web Design
Benefit of CodeIgniter php framework
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Web Components: back to the future
Drupal performance and scalability

More from Matthew Farina (19)

PDF
How Helm, The Package Manager For Kubernetes, Works
PPTX
Exploring the Future of Helm
PDF
PPTX
Helm project update at cncf 2019
PPTX
Helm @ Orchestructure
PDF
Measuring How Helm Is Used
PDF
Testing Lessons Learned From The Community Charts
PDF
Kubecon SIG Apps December 2017 Update
PDF
Dipping Your Toes Into Cloud Native Application Development
PPTX
A Dive Into Containers and Docker
PPTX
HP Helion OpenStack and Professional Services
PPTX
Why OpenStack matters and how you can get involved
PDF
Faster front end performance
PDF
Faster mobile sites
PDF
Front end performance improvements
KEY
Building Faster Websites
PPT
Drupal Calendaring, A Technological Solution
KEY
Make Drupal Better
KEY
Intro To jQuery In Drupal
How Helm, The Package Manager For Kubernetes, Works
Exploring the Future of Helm
Helm project update at cncf 2019
Helm @ Orchestructure
Measuring How Helm Is Used
Testing Lessons Learned From The Community Charts
Kubecon SIG Apps December 2017 Update
Dipping Your Toes Into Cloud Native Application Development
A Dive Into Containers and Docker
HP Helion OpenStack and Professional Services
Why OpenStack matters and how you can get involved
Faster front end performance
Faster mobile sites
Front end performance improvements
Building Faster Websites
Drupal Calendaring, A Technological Solution
Make Drupal Better
Intro To jQuery In Drupal

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Cloud computing and distributed systems.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
Teaching material agriculture food technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Electronic commerce courselecture one. Pdf
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Per capita expenditure prediction using model stacking based on satellite ima...
“AI and Expert System Decision Support & Business Intelligence Systems”
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx
Cloud computing and distributed systems.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Teaching material agriculture food technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Electronic commerce courselecture one. Pdf

Secure your site