Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress •...

46
Keep Your Wordpress Site Safe and Fast Updated & Revised for TCF ‘17 Louis Judice, Founder The Round Mountain Group, LLC Email: [email protected] Tel. +1 908 376-6622 Copyright 2016-2017 The Round Mountain Group LLC

Transcript of Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress •...

Page 1: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Keep Your Wordpress Site Safe and Fast

Updated & Revised for TCF ‘17

Louis Judice, FounderThe Round Mountain Group, LLC

Email: [email protected]. +1 908 376-6622

Copyright 2016-2017 The Round Mountain Group LLC

Page 2: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

About Me• Fifth TCF talk/workshop

• RCA/DEC/HP

• Founded RMG in 2004

• Wordpress development + hosting

• Manage several servers, 40+ client sites

• Sites range from small business to multimillion $$ enterprises to government

• Play all roles (user to WP developer + admin to sysadmin)

• Extensive experience in online security issues

Page 3: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

C’mon…What’s the WORST That Can REALLY Happen to My Site?

CENSOR

ED

Page 4: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

About This Workshop• Focus on Wordpress

• Security and Performance Inter-Related

• Examples in Centos Linux / cPanel / WHM environment

• Most concepts apply to other OS, Control Panels as well as to Joomla, Drupal, etc.

• Difficulty from easy to complex

• Relevant to bloggers, site admin, system admin

• Few comprehensive sources of information to protect the entire Wordpress ecosystem

Page 5: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Wordpress• Started in 2003 as a blogging tool

• Millions of sites in operation

• Blogs to Fortune 500 Corporate Sites

• Most popular web platform on earth

• Free, Open Source

• Massive EcoSystem of Add-ons, Plug-ins, Themes, etc.

• 4/5 sites “managed” by inexperienced users

• 90% of sites not up to date

• Targeted by hackers, scammers and every disreputable bot in the galaxy

Page 6: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

What My Site Log Looks Like:

Page 7: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

A Dense Threat Environment• Specifically targeting you or your site (theft, credit cards, email or true denial of

service (DOS))

• Brute force attacks (hijack your site to commandeer it’s mail or compute capabilities; bot recruitment, defacto denial of service)

• Directory scanners (scan your site for known vulnerabilities)

• Bots Behaving Badly (web crawlers that don’t obey the rules of etiquette or actively steal your content)

• Distributed Denial of Service (DDOS)

• Idiot users (never attribute to malice what is better explained by stupidity)

• High chance of success given abundance of poorly managed sites

• Even unsuccessful attacks impact performance

Page 8: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Who Are These People??• Recreational hackers just havin’ fun

• Hacktivists (if they are after you, then you might have bigger problems…)

• Spam Mailbot Network Owners

• Criminal Gangs (extortion sites, porn sites, gambling sites. Eg. Ukrainian Counterfeit Sports Logo Merchandise )

• The other 9 million search engines you never heard of

• Russia, China, Ukraine, Vietnam, US predominate - but due to compromised servers and IP spoofing - hard to tell….

• Geo-restrictions of limited value

Page 9: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

The Problem• If they get in - you’re in trouble

• If they don’t get in - there is still a problem

• Web servers see a bot asking for 1000 nonexistent files exactly as if 1000 users simultaneously asked for 1 non-existent file

• In other words, they slow down, hang or crash

• Wordpress likes to handle 403 non-existent errors on its own. This makes things worse since WP will quickly run out of memory.

• The bot moves on, accomplishing nothing. And your server is hung.

• Welcome to the Internet!

Page 10: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Impact On Performance

Peaks Associated With DOS Attacks

Page 11: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Wordpress Popularity Makes It An Easy Target

“If 1% of 50 million sites have weak passwords, that’s 500,000 sites that can be cracked in seconds.”

Page 12: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

The Less Likely an Attack On Wordpress will Succeed…

The More Likely Attackers Will Move On to Another Target.

Page 13: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Security and performance are interrelated.

Since most unwanted visitors will likely do no real harm and can’t be blocked it’s best to

run fast sites and move them along.

Page 14: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Let’s Get Started• Difficulty Level

• Access: WP Admin, cPanel (or equivalent), root or WHM

• Hosting Type: wordpress.com, shared, vps/dedicated, reseller

• Security + Performance: Inter-related

Page 15: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Passwords• Strong passwords are #1 prevention tool

• Password managers vs. writing it down?

• Set policies when possible, but be VERY firm in regard to any privileged account.

• Longer, upper lower case, numbers

• Fact is:

• For brute force there are other defenses

• If “intercepted” little to stop someone, so don’t transmit passwords over insecure methods

Page 16: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Backups• Don’t rely on one backup!

• We keep cPanel weekly, monthly backups for full account restoration or move

• We also keep UpDraft (plugin) backups as a backup (Wordpress Site: cPanel agnostic)

• We send backups to 2 different Amazon Web Services S3 Data Centers

• Test it!!!

• Backups are also useful for moving sites to new servers

Page 17: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Backups

Page 18: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

User Permissions

• Difficulty: Easy

• “Stinginess with privileges is kindness in disguise”

• Limit user roles and permissions strictly.

Page 19: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Admin Account Name• Difficulty: Easy

• Don’t use “admin” - pick something else when site is set up

• You can also change the admin account name after the fact but this is more difficult.

• Use strong passwords (or implement password policy)

• 90% of brute force attacks assume admin account is “admin”

admin

Page 20: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

White Listing WP-Login• Difficulty: Moderate, Requires

cPanel, .htaccess

• Exclude all but certain IP addresses from accessing WP login screen.

• Caveat: Comcast, etc. may change your IP address, locking YOU out. Some hosts don’t allow .htaccess to be edited.

• .htaccess missing? Turn on “hidden file access”

• Tip: whitelist by network (CIDR notation). This blocks 99.9999% of web from ever reaching your login screen

Added at the end of .htaccess

Get Network CIDR: http://countryipblocks.net

Page 21: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

System Level Whitelisting• Difficulty: expert

• Resources to block: cPanel, WHM, FTP, SSH

• WHM Host Access Control

• Check with your host - they may need some IP’s unblocked for maintenance

• Consider a Proxy or VPN with a FIXED IP address

Page 22: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Limit Plug-ins

• Difficulty: Easy

• Plug-ins vary in security impact

• Out dated plug-ins are a major vulnerability

• Disable/delete unused plug-ins

Page 23: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Stay Up to Date• Difficulty: Easy to Tedious

• Keep Wordpress, Themes, Plug-ins Up to Date

• Many updates are security related

• When they go out, all the bad actors are now aware of issues they can try to exploit

• WP 4.0+ and many plug-ins allow for auto update.

Page 24: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Comments• Difficulty: Easy

• If comments are not part of your model TURN THEM OFF

• Delete “HELLO WORLD” post

• Force users to register

• Use approval feature

• Use ASKIMET or other anti-spam comment plug-in

• Ignore at your peril

Comments can usually be controlled in the Theme Control Panel

Page 25: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Block XMLRPC.PHP

• Difficulty: Moderate

• Requires access to cPanel and .htaccess file

• Very common exploit in older WP versions

• So many bad actors look for this, it’s best to just block it to keep them away.

Added at the end of .htaccess

Page 26: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Install Wordfence Plug-in• Difficulty: Easy to Moderate

• Wordfence is a free, comprehensive security solution

• Firewall to block or throttle bad bots and stupid users (be careful until you know how it works)

• Login security, password policy

• Virus scanning

• Send emails when it takes action

• Premium (paid) version supports geo restrictions

Page 27: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Wordfence (continued)

Page 28: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Wordfence (continued)

Page 29: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Limit Login Attempts• Difficulty: Easy

• There are numerous plugins to limit login attempts

• If you are NOT running Wordpress you should run one of them.

• Check reputations and pick the most widely used with best feedback.

• We use Johan Enfeldt’s plugin

Page 30: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

6G Firewall • Difficulty: moderate, requires

cPanel, .htaccess

• 6G is a set of code you insert in .htaccess

• It filters out many bad queries, bad requests, bad user agent, etc.

• Free

• http://perishablepress.com

• Caution if you use mod_userdir (tilde) or some other special characters.

• Comes as a plugin too, but see previous caveats.

Page 31: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Blackhole for Bad Bots

• Difficulty: expert - requires care or you may block users

• Essentially advertises a honeypot in robots.txt

• Then snags any bots that go there.

• http://perishablepress.com

Page 32: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Linux Firewall: CSF/LFD• Difficulty: Expert, Linux Administrator

• Comprehensive firewall for Linux systems.

• Free, open source.

• Defends against many common attacks, including DDOS attacks.

• Supports RBLs

• Alerts via email when it takes action

• Main limitation is that it uses IPTABLES which can impact performance if blocked list grows too large.

• CSF/LFD or equivalent is an absolute must for any Linux web server.

Page 33: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

CSF/LFD (continued)

Email from CSF after blocking DDOS attack

Page 34: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Logs• Difficulty: Takes practice

• Almost everything is logged but few people take the time to read or understand them

• Logs reveal errors like broken links, as well as suspicious activity

• Apache, cPanel and Linux itself all generate logs

• cPanel “Latest Visitors” and “Error Log” are very useful

• Not all attacks “Fast and Furious”

• Linux logs are for experts only

Page 35: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Logs (continued)

Page 36: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Logs (continued)

Page 37: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

IP Deny Manager

• Difficulty: Easy

• cPanel Access Required

• CIDR format can be used but be careful!

• countryipblocks.net is a good resource for researching IP addresses

Page 38: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

SSL Encryption• ALERT!!!

• Difficulty: Moderate

• Ranking signal to Google

• Big changes in 2017 in Chrome!

• Shared Hosting: contact your host

• VPS/Dedicated: cPanel SSL Manager - FREE!

• Velvet Blues Plugin to update URL’s: Use carefully

Page 39: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Caching• Difficulty: Moderate

• Caching Plug-Ins keep your most commonly used content on disk, avoiding a database lookup to render your pages

• Speedup can be dramatic

• Saving CPU and memory while under attack will often prevent hangs and crashes.

• Several good Caching Plug-ins are available; we use W3-Total Cache. It is free and open source

Source: dashboardjunkie.com

Page 40: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Content Delivery Network (CDN)• Difficulty: Moderate to Expert

• Takes caching a step further by storing your most used content on a network of servers that are positioned around the world to be close to users.

• CDN greatly reduces server load under normal operations or under attack

• In Wordpress, usually works in concert with a caching plug-in.

• Many options, the most popular and easiest is Cloudflare which also offers geo restrictions.

• Our experience has been mixed with Cloudflare. Easy to set up, unpredictable performance.

• We use Amazon Web Services Cloudfront. It is not free and is very complex to set up. However it delivers high performance. Source: labs.ripe.net

Page 41: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Minify/GZIP/EWWW• Moderate, but be careful

• Most caching plugins, as well as standalone minifiers will remove blank, wasted space in html, css, etc. This helps websites load faster.

• Minify can break some things in Wordpress so watch out.

• GZIP compression is usually less problematic and can be turned on in caching plugins.

• Remember all of these trade off more CPU on host for faster transmission.

• EWWW Image Optimizer

Page 42: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Perfomance Testing• Difficulty: Easy

• http://tools.pingdom.com/fpt

• Provides overall stats and detailed timing information

• Reveals surprises like broken redirects, unoptimized images, etc.

• Also serves as a handy proxy for testing your site!

• Free

Page 43: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Uptime Monitoring• Difficulty: Easy to Moderate

• Numerous services will test your site and inform you if it’s down or has changed.

• Be sure notifications are “out of band”; ie. don’t use email hosted on the machine you’re testing

• Some are free with limitations; sophisticated features usually come at a price.

• We use Site24x7, a paid service: Linux clients, defacement monitoring, etc.

Page 44: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Some Notes On Email• Whole other “ball of wax”; 90% of email is

spam.

• On server we run Barracuda Reputation Block List (RBL) and SpamAssassin to get about 80% of spam. CSF/LFD does good job here as well.

• Forwarding issues, especially to Gmail

• Better to push users to hosted solutions with a mail exchanger like Gmail Apps for Biz; Amazon Cloudmail, etc.

• Use SMTP login for site generated email when possible

Page 45: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

If all else fails…

• Lighten or cache errors

• More CPU power (speed or cores)

• More memory

• Apache Keep Alive and other tuning parameters

Page 46: Keep Your Wordpress Site Safe and Fast2017.pdfAbout This Workshop • Focus on Wordpress • Security and Performance Inter-Related • Examples in Centos Linux / cPanel / WHM environment

Technology For Life Lived In Motion!

http://roundmountaingroup.com