Home

Awesome

CiderPress - Hardened wordpress installer

You ever wanna self-host a blog or whatever, and are getting ready to choose something, and you're all like "Why not wordpress?" and your security nerd friends start to convulse and sperg out as though the seventh seal is breaking?

Then proceed to splain you how bad wordpress is? Well, this script is designed to shut them up, and make you a much harder target to hit. Remember that harder to hit doesn't mean invincible. Ask anyone who plays XCOM.

What Purpose Does this Script Serve?

Takes an ubuntu 18.04 linux install, and installs wordpress running on nginx.

Why nginx?

Personal preference, mainly.

What, specifically does the script do?

These tasks include:

Instructions for use:

  1. Download this repo via git, or download the .zip file that github will provide you. Unzip it and fill out the ciderpress.conf file. The file is heavily commented with default settings and recommendations

  2. Make sure that you read the comments in the file and fill out ALL of the variables in the ciderpress.conf file

    1. Its pretty important that you avoid special characters for the wp_mysql_password variable. shell scripts treat special characters in unique ways that could cause this script to spontaenously combust, so I didn't bother trying to enumerate what special characters are safe. Yeah, this goes against security advice security professionals typically give you, but can be offset if you just make the password longer. Like say, 25+ characters. Download a password manager like say KeepassXC (https://keepassxc.org/) and use that to generate (and store) your password. If not having special characters STILL doesn't set well with you, use the mysqladmin command to change the password later, and edit wp-config.php in your wordpress directory to use the new password you specify.

    2. You might notice theres a section that involves using letsencrypt for a free SSL cert. If you want to use letsencrypt there are some prerequisites for that. First, you need to ensure that the api can reach your web server on port 80/tcp since we'll be using the challenge/response method for getting our cert. That means poking holes in your firewall. Next, you need to ensure that your webserver has a public IP address, and a domain name that letsencrypt can resolve in order to get your SSL cert. Freenom offers free hostnames for up to a year for a few TLDs. I have no idea if letsencrypt will work for dynamic DNS domains, but its something you are welcome to try. Good luck. OTHERWISE, the script will generate a self-signed SSL certificate for use on your website, if you modify the config file to do so. Yeah, web browsers will give you sad faces when you try to browse to it, and crypto nerds will scream bloody murder, but this is a Wendys, sir.

    3. The variable wp_hostname is very important. Make sure that this is set to a fully qualified domain name that your clients can resolve, otherwise your wordpress install will be horribly broken. You can also try setting this to an IP address if you don't want to bother with DNS, but I haven't tested it, so I have no idea if that'd work. At the very least, if you did this, you will NOT be able to get a letsencrypt ssl cert.

  3. The script has to be run as root, or via sudo privs because of all things we'll be doing that requires root privs (e.g. package installation, modifying file permissions, etc.) bash ciderpress.sh or sudo bash ciderpress.sh should be enough to get the ball rolling. The script keeps a log of the output of all the commands it runs in /var/log/ciderpress_install.log. This file can be used to help troubleshoot failures if the script bombs out.

    1. theres a portion of the script that generates a dhparam.pem file. The script warns you that it'll take some time to do. Its no joke. Its gonna take about 15 or so minutes on a moderately powerful system, and the CPU is gonna kick and scream the entire time. If you wanna make sure that the script is still running, open up another terminal session (e.g. second SSH session, etc.) and run the command tail -f /var/log/ciderpress_install.log
  4. Your system WILL reboot as a part of this script.

    1. This script installs several plugins and enables a few of them for you automatically. However, one of these plugins, google-authenticator needs to be activated manually. This is because you need to login to the wordpress console to set up two-factor authentication for your admin user (and other users you might add later).
      1. Make sure that your web server can keep accurate time. 2FA relies heavily on time for your server being relatively accurate. Be aware that if you are running wordpress in a VM and you revert a snapshot, you might need to update the system clock/time. Consider looking into NTP or the hwclock -s command.

References:

Patch Notes:

2019-08-30

2019-10-02