SlideShare une entreprise Scribd logo
1  sur  54
Télécharger pour lire hors ligne
Marko Heijnen CODEKITCHEN
Mijn Site Beveiliging
WordPress Meetup Enschede
The moment my site
got hacked
Stay in this bubble
Alles begint met je
server setup
Opbouw van mijn site
Loadbalancer
Memcached
Elasticsearch
MariaDB
Server setup
Micro services
Webserver
1
Webserver
2
Thumbor
Public Private
CDN
Verkeer
WordPress setup
• Network install
• Running Trunk
• Folder structure:
• /bash
• /nginx
• /www
• /content
• /wp
wp-config.php fun
1 map hoger

Uit de www folder
WP-Config
• Security Keys
• $table_prefix
• WP_CONTENT_DIR / WP_CONTENT_URL
• UPLOADS
WP-Config
• Disable Plugin/Theme Editor

define( 'DISALLOW_FILE_EDIT', true );
• Disable Plugin/Theme Update en Installatie

define( 'DISALLOW_FILE_MODS', true );
• Block externe URL Requests

define( 'WP_HTTP_BLOCK_EXTERNAL', true );

define( 'WP_ACCESSIBLE_HOSTS',
'api.wordpress.org,*.github.com' );
Hardening WordPress
• PHP kan de bestanden niet aanpassen
• OPCache word niet ververst tenzij je PHP reload
• WordPress Network install

(Hernoeming van upload directory)
• Veel functionaliteit is zelf geschreven
Eigen functionaliteit
• Een eigen per site mu-plugins folder

(/mu-plugins/blog/markoheijnen/plugin-name)
• plugins folder heeft alleen WordPress.org plugins
• Overzicht van plugins is nu opgeschoond
Login
Hardening login
• Moeilijk en lange wachtwoord
• IP block voor super admin account (login via VPN)
• Binnenkort verplicht 2fa voor admins
• Binnenkort fail2ban integratie
• Fail2ban scant log files zoals /var/log/apache/
error_log en bant IPs die malicious tekens vertonen
• Zoals te vaak foutief ingelogd
• Fail2ban update dan de firewall rules om de IPs
voor een bepaalde tijd te blokkeren
Fail2ban
Integratie met WordPress
• WordPress logt de foutieve pogingen via
bijvoorbeeld syslog()
• Voegt nieuwe filter toe aan Fail2ban
• Hierbij leg je uit hoe de log item opgebouwd is
• Voorbeeld: wp-fail2ban
Multiserver setup
• In plaats van log file worden acties in een database
opgeslagen
• Op de Fail2ban server draait een cronjob die
nieuwe geblokte IPs toevoegt
• fail2ban-client om IPs te blokken
• Of dit word een microservice die het beheerd
Firewall
UFW
• ufw default deny incoming
• ufw default deny outgoing
• ufw allow out http(s)
• ufw allow out DNS
• ufw allow from {your.home.ip}
• ufw allow out on eth1 to {internal.ip} port 3142
Application Firewall
Application Firewall
• Actieve preventie van vulnerabilities zoals cross-
site scripting (XSS) en SQL injection
• Sucuri of CloudFlare als een service
• NinjaFirewall als een plugin
• Zelf hou ik het voorlopig op modSecurity
• Momenteel bekijk ik de rule sets van owasp.org
Detection Layer
Apticron
• Cronjob checks als er server update zijn
• Stuurt een mail wanneer er updates zijn
• Totale lijst of alleen nieuwe updates
Apt-dater and Apt-dater-host
• Terminal-based remote package update manager
• Een tool om meerdere servers te managen
• Groeperen van servers
• Install en update packages
Use WordPress to
manage WordPress
Server Features
• Geeft alle Linux packages updates weer
• Geeft alle PECL updates weer
• Toont aan als je WP-CLI updates heeft
• Het updaten van WP-CLI
• Opnieuw opstarten van een service
WordPress Features
• Geeft alle WordPress updates weer
• Mogelijkheid om een update te doen (todo)
• Checksum scans
• Upload directory scans
• Backups (todo)
• Send WP CLI command (todo)
Lijst met alle servers
Lijst met alle sites
Overview van je site
Security checks voor je site
Checksums voor
plugins/themes
WP Central
• Begon als een platform voor statistieken
• Daarna met een API voor contributors
• Nu het opvragen van checksums voor plugins en
themes
• http://wpcentral.io/api/
Node.js server
• Een microserver voor het genereren en opvragen
van de checksums
• Indien het nog niet bestaat word het in de queue
geplaatst en ontvangt de gebruiker een melding
• Tussen WordPress en de node.js applicatie zit
nginx die mogelijk crashes afvangt
WP Central API
• http://wpcentral.io/api/checksums/theme/
twentyfifteen/1.2
• [{"code":"wpcentral_server_error","message":"Gener
ating checksums”}]
• [{"file":"header.php","checksum":"c0919b5f4b6e4f3a
58b858b2305e9146"},{},{},{},{},{},{},{},{},{},{},{},{},{}]
WP-CLI
Coming Soon
Coming Soon
• API endpoint word officieel gereleased
• HTTPS (TLS)
• Mogelijk GPG
• Open Source Vulnerability database

(met hoge IP rate check)
Ideeën zijn meer

dan welkom
Log aggregation
Log aggregation
• Logstash
• Fluentd
• OSSEC
OSSEC
• Een Open Source Host-based Intrusion Detection
System
• Performs log analysis, file integrity checking, policy
monitoring, rootkit detection, real-time alerting and
active response
• Works with a manager and agents
• https://hackertarget.com/defending-wordpress-
ossec/
Het gebruik van
WordPress plugins
WordPress plugins
• Persoonlijk geen voorstander om het als
bescherming te hebben
• Als iemand in je site komt heeft de persoon de
mogelijkheid om het uit te schakelen
• Gebruik het als een hulp voor server technologie
• Zoals bij Fail2ban
• Een plugin is je laatste middel voor bescherming
Verdere ideeën
Verdere ideeën
• Notificaties (microservice)
• Bij elke succesvolle admin login
• Bij elke file aanpassing
• Plugin activatie/deactivatie
Conclusie
Conclusie
• Wanneer je een VPS neemt dien je ook een
gedeelte van de veiligheid op je te nemen
• Host doen over het algemeen diverse dingen al
voor je zoals het blokken van zwakheden in
populaire plugins
• Je hoeft niet door te draaien zoals ik maar check
regelmatig je site en je log files. Zelfs al is het
handmatig
Marko Heijnen
• Founder of CodeKitchen
• Lead developer of GlotPress
• Core contributor for
WordPress
• Organizer for WordCamp
Belgrade
Marko Heijnen
info@markoheijnen.com
@markoheijnen
Bedankt voor

je aandacht
Vragen?
@markoheijnen
markoheijnen.com



codekitchen.eu

Contenu connexe

En vedette

WordPress Workshop TOM on TOUR
WordPress Workshop TOM on TOURWordPress Workshop TOM on TOUR
WordPress Workshop TOM on TOURRedkiwiwebsites
 
WordPress Security and Best Practices
WordPress Security and Best PracticesWordPress Security and Best Practices
WordPress Security and Best PracticesRobert Vidal
 
The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017LinkedIn
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 

En vedette (7)

WordPress Workshop TOM on TOUR
WordPress Workshop TOM on TOURWordPress Workshop TOM on TOUR
WordPress Workshop TOM on TOUR
 
WordPress Security
WordPress SecurityWordPress Security
WordPress Security
 
WordPress Security and Best Practices
WordPress Security and Best PracticesWordPress Security and Best Practices
WordPress Security and Best Practices
 
The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Similaire à Mijn site beveiliging

Open Computer and Software Inventory
Open Computer and Software InventoryOpen Computer and Software Inventory
Open Computer and Software Inventory247 Invest
 
Infra as Code workshop
Infra as Code workshopInfra as Code workshop
Infra as Code workshopMarinoDekker
 
Hosting van Drupal gemeentesites @ DrupalJam 2014
Hosting van Drupal gemeentesites @ DrupalJam 2014Hosting van Drupal gemeentesites @ DrupalJam 2014
Hosting van Drupal gemeentesites @ DrupalJam 2014Bas van der Zalm
 
Presentatie Webscale op DrupalJam 2014
Presentatie Webscale op DrupalJam 2014 Presentatie Webscale op DrupalJam 2014
Presentatie Webscale op DrupalJam 2014 Webscale
 
De 10 geboden van WordPress Development
De 10 geboden van WordPress DevelopmentDe 10 geboden van WordPress Development
De 10 geboden van WordPress DevelopmentFloris Lof
 
Installatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web clientInstallatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web clientSandro Pibia
 
Web Application Security; Hacking your way in!
Web Application Security; Hacking your way in!Web Application Security; Hacking your way in!
Web Application Security; Hacking your way in!Peter Schuler
 
Bart Lageweg - Ansible/Cobbler
Bart Lageweg - Ansible/CobblerBart Lageweg - Ansible/Cobbler
Bart Lageweg - Ansible/CobblerSplend
 
Techdays System Center 2012 Operations Manager end-to-end management walter ...
Techdays  System Center 2012 Operations Manager end-to-end management walter ...Techdays  System Center 2012 Operations Manager end-to-end management walter ...
Techdays System Center 2012 Operations Manager end-to-end management walter ...wwwally
 
MediaMosa Installatie & Configuratie
MediaMosa Installatie & ConfiguratieMediaMosa Installatie & Configuratie
MediaMosa Installatie & ConfiguratieMediaMosa
 
Oracle Database Appliances, how to install, patch and manage them
Oracle Database Appliances, how to install, patch and manage themOracle Database Appliances, how to install, patch and manage them
Oracle Database Appliances, how to install, patch and manage themMark Koreman
 
CFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion TechsessieCFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion TechsessieMartin Simons
 
De gevaren van WordPress plugins
De gevaren van WordPress pluginsDe gevaren van WordPress plugins
De gevaren van WordPress pluginsTrendwerk
 
Component-based ontwikkelen met OSGi: van embedded tot enterprise
Component-based ontwikkelen met OSGi: van embedded tot enterpriseComponent-based ontwikkelen met OSGi: van embedded tot enterprise
Component-based ontwikkelen met OSGi: van embedded tot enterpriseMarcel Offermans
 
SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)
SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)
SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)Fred Janssen
 

Similaire à Mijn site beveiliging (20)

Open Computer and Software Inventory
Open Computer and Software InventoryOpen Computer and Software Inventory
Open Computer and Software Inventory
 
Infra as Code workshop
Infra as Code workshopInfra as Code workshop
Infra as Code workshop
 
Hosting van Drupal gemeentesites @ DrupalJam 2014
Hosting van Drupal gemeentesites @ DrupalJam 2014Hosting van Drupal gemeentesites @ DrupalJam 2014
Hosting van Drupal gemeentesites @ DrupalJam 2014
 
Presentatie Webscale op DrupalJam 2014
Presentatie Webscale op DrupalJam 2014 Presentatie Webscale op DrupalJam 2014
Presentatie Webscale op DrupalJam 2014
 
De 10 geboden van WordPress Development
De 10 geboden van WordPress DevelopmentDe 10 geboden van WordPress Development
De 10 geboden van WordPress Development
 
Installatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web clientInstallatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web client
 
Web Application Security; Hacking your way in!
Web Application Security; Hacking your way in!Web Application Security; Hacking your way in!
Web Application Security; Hacking your way in!
 
Bart Lageweg - Ansible/Cobbler
Bart Lageweg - Ansible/CobblerBart Lageweg - Ansible/Cobbler
Bart Lageweg - Ansible/Cobbler
 
Vagrant
VagrantVagrant
Vagrant
 
Techdays System Center 2012 Operations Manager end-to-end management walter ...
Techdays  System Center 2012 Operations Manager end-to-end management walter ...Techdays  System Center 2012 Operations Manager end-to-end management walter ...
Techdays System Center 2012 Operations Manager end-to-end management walter ...
 
Oracle 12c Launch Event 03 Web logic 12.1.2 new features Edwin Biemond
Oracle 12c Launch Event 03 Web logic 12.1.2 new features Edwin BiemondOracle 12c Launch Event 03 Web logic 12.1.2 new features Edwin Biemond
Oracle 12c Launch Event 03 Web logic 12.1.2 new features Edwin Biemond
 
MediaMosa Installatie & Configuratie
MediaMosa Installatie & ConfiguratieMediaMosa Installatie & Configuratie
MediaMosa Installatie & Configuratie
 
Oracle Database Appliances, how to install, patch and manage them
Oracle Database Appliances, how to install, patch and manage themOracle Database Appliances, how to install, patch and manage them
Oracle Database Appliances, how to install, patch and manage them
 
Workshop VirtualBox (Jesus Isern Comas)
Workshop VirtualBox (Jesus Isern Comas)Workshop VirtualBox (Jesus Isern Comas)
Workshop VirtualBox (Jesus Isern Comas)
 
CFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion TechsessieCFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion Techsessie
 
Een goede DEV omgeving opzetten
Een goede DEV omgeving opzettenEen goede DEV omgeving opzetten
Een goede DEV omgeving opzetten
 
De gevaren van WordPress plugins
De gevaren van WordPress pluginsDe gevaren van WordPress plugins
De gevaren van WordPress plugins
 
Component-based ontwikkelen met OSGi: van embedded tot enterprise
Component-based ontwikkelen met OSGi: van embedded tot enterpriseComponent-based ontwikkelen met OSGi: van embedded tot enterprise
Component-based ontwikkelen met OSGi: van embedded tot enterprise
 
SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)
SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)
SNUG 2007 - Lotus Domino 8 Administration (dutch/nederlands)
 
Cloudmanagers
CloudmanagersCloudmanagers
Cloudmanagers
 

Plus de Marko Heijnen

Custom coded projects
Custom coded projectsCustom coded projects
Custom coded projectsMarko Heijnen
 
Security, more important than ever!
Security, more important than ever!Security, more important than ever!
Security, more important than ever!Marko Heijnen
 
My Contributor Story
My Contributor StoryMy Contributor Story
My Contributor StoryMarko Heijnen
 
WooCommerce & Apple TV
WooCommerce & Apple TVWooCommerce & Apple TV
WooCommerce & Apple TVMarko Heijnen
 
The moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp SofiaThe moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp SofiaMarko Heijnen
 
The moment my site got hacked
The moment my site got hackedThe moment my site got hacked
The moment my site got hackedMarko Heijnen
 
My complicated WordPress site
My complicated WordPress siteMy complicated WordPress site
My complicated WordPress siteMarko Heijnen
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescueMarko Heijnen
 
Protecting your site by detection
Protecting your site by detectionProtecting your site by detection
Protecting your site by detectionMarko Heijnen
 
GlotPress aka translate.wordpress.org
GlotPress aka translate.wordpress.orgGlotPress aka translate.wordpress.org
GlotPress aka translate.wordpress.orgMarko Heijnen
 
Writing clean and maintainable code
Writing clean and maintainable codeWriting clean and maintainable code
Writing clean and maintainable codeMarko Heijnen
 
Extending WordPress as a pro
Extending WordPress as a proExtending WordPress as a pro
Extending WordPress as a proMarko Heijnen
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPressMarko Heijnen
 
Bootstrapping your plugin
Bootstrapping your pluginBootstrapping your plugin
Bootstrapping your pluginMarko Heijnen
 
The development and future of GlotPress
The development and future of GlotPressThe development and future of GlotPress
The development and future of GlotPressMarko Heijnen
 
Why Javascript matters
Why Javascript mattersWhy Javascript matters
Why Javascript mattersMarko Heijnen
 
The code history of WordPress
The code history of WordPressThe code history of WordPress
The code history of WordPressMarko Heijnen
 
Building plugins like a pro
Building plugins like a proBuilding plugins like a pro
Building plugins like a proMarko Heijnen
 
Perfect your images using WordPress - WordCamp Europe 2013
Perfect your images using WordPress - WordCamp Europe 2013Perfect your images using WordPress - WordCamp Europe 2013
Perfect your images using WordPress - WordCamp Europe 2013Marko Heijnen
 

Plus de Marko Heijnen (20)

Custom coded projects
Custom coded projectsCustom coded projects
Custom coded projects
 
Security, more important than ever!
Security, more important than ever!Security, more important than ever!
Security, more important than ever!
 
My Contributor Story
My Contributor StoryMy Contributor Story
My Contributor Story
 
WooCommerce & Apple TV
WooCommerce & Apple TVWooCommerce & Apple TV
WooCommerce & Apple TV
 
The moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp SofiaThe moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp Sofia
 
The moment my site got hacked
The moment my site got hackedThe moment my site got hacked
The moment my site got hacked
 
My complicated WordPress site
My complicated WordPress siteMy complicated WordPress site
My complicated WordPress site
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
Protecting your site by detection
Protecting your site by detectionProtecting your site by detection
Protecting your site by detection
 
GlotPress aka translate.wordpress.org
GlotPress aka translate.wordpress.orgGlotPress aka translate.wordpress.org
GlotPress aka translate.wordpress.org
 
Writing clean and maintainable code
Writing clean and maintainable codeWriting clean and maintainable code
Writing clean and maintainable code
 
Extending WordPress as a pro
Extending WordPress as a proExtending WordPress as a pro
Extending WordPress as a pro
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPress
 
Bootstrapping your plugin
Bootstrapping your pluginBootstrapping your plugin
Bootstrapping your plugin
 
The development and future of GlotPress
The development and future of GlotPressThe development and future of GlotPress
The development and future of GlotPress
 
Why Javascript matters
Why Javascript mattersWhy Javascript matters
Why Javascript matters
 
The code history of WordPress
The code history of WordPressThe code history of WordPress
The code history of WordPress
 
Building plugins like a pro
Building plugins like a proBuilding plugins like a pro
Building plugins like a pro
 
Perfect your images using WordPress - WordCamp Europe 2013
Perfect your images using WordPress - WordCamp Europe 2013Perfect your images using WordPress - WordCamp Europe 2013
Perfect your images using WordPress - WordCamp Europe 2013
 
Dealing with media
Dealing with mediaDealing with media
Dealing with media
 

Mijn site beveiliging