Security checklists
Choose where it runs and what it is built with, from WordPress to Kubernetes and self-hosted AI models. You get a checklist with why each step matters and the commands to check and fix it. Tick items off as you go; your progress stays in this browser.
Security checklist: Ubuntu or Debian VPS with Nginx, WordPress, MySQL or MariaDB
Server and SSH
0 of 11 done
-
Work as a normal user with sudo, not as root
HighMistakes and stolen sessions as root can change everything on the box. A named user also leaves a clearer audit trail.
Check which users can sudo
getent group sudo
Fix (replace deploy with your username)
sudo adduser deploy sudo usermod -aG sudo deploy # copy your key so the new user can log in sudo rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy
-
Turn off SSH password logins
Critical PortGate Server Guard checks thisBots try passwords against every public SSH server, all day. With keys only, guessing is useless. Test a key login in a second terminal before you close the first one.
Check (both should say no)
sudo sshd -T | grep -Ei '^(passwordauthentication|kbdinteractiveauthentication) '
Fix (a drop-in that wins over cloud-init's 50-cloud-init.conf)
printf 'PasswordAuthentication no\nKbdInteractiveAuthentication no\n' | sudo tee /etc/ssh/sshd_config.d/00-hardening.conf sudo sshd -t && sudo systemctl reload ssh
-
Stop root logging in with a password
Critical PortGate Server Guard checks thisRoot is the one username every attacker knows. prohibit-password keeps key-based root access working if you rely on it; use no once you log in as your own user.
Check (want without-password, which is how sshd shows prohibit-password, or no)
sudo sshd -T | grep -i '^permitrootlogin '
Fix
echo 'PermitRootLogin prohibit-password' | sudo tee /etc/ssh/sshd_config.d/01-root.conf sudo sshd -t && sudo systemctl reload ssh
-
Turn the firewall on, deny incoming by default
Critical PortGate Server Guard checks thisAnything that starts listening later (a debug server, a database) stays private unless you open it on purpose. Allow your SSH port first so you do not lock yourself out.
Check
sudo ufw status verbose
Fix (change 22 if SSH runs on another port)
sudo ufw allow 22/tcp sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw default deny incoming sudo ufw enable
-
Only the ports you expect face the internet
Critical PortGate Server Guard checks thisDatabases, caches and admin panels left on 0.0.0.0 are found by scanners within hours. Docker-published ports skip UFW, so check what is listening, not just your firewall rules.
Check (anything on 0.0.0.0 or [::] besides 22, 80 and 443 needs a reason)
sudo ss -tulpn | grep -Ev '127\.0\.0\.1|\[::1\]'
Check from outside (run on another machine)
nmap -Pn --top-ports 1000 example.com
-
Install security updates automatically
HighMost break-ins use bugs that were patched weeks earlier. Automatic security updates close that gap without you remembering to log in.
Check
systemctl is-enabled unattended-upgrades && cat /etc/apt/apt.conf.d/20auto-upgrades
Fix
sudo apt update && sudo apt install -y unattended-upgrades sudo dpkg-reconfigure -plow unattended-upgrades
-
Reboot after kernel and library updates
MediumUpdates to the kernel, OpenSSL or glibc only protect you once the server restarts. Pick a quiet time each week.
Check
[ -f /var/run/reboot-required ] && cat /var/run/reboot-required.pkgs || echo "no reboot needed"
-
Ban addresses that keep failing to log in
Medium PortGate Server Guard checks thisEven with keys only, brute-force traffic fills logs and wastes CPU. Fail2ban blocks an address after repeated failures.
Check
sudo fail2ban-client status sshd
Fix (Debian and Ubuntu enable the sshd jail by default)
sudo apt install -y fail2ban && sudo systemctl enable --now fail2ban
-
Review who logged in
Medium PortGate Server Guard checks thisA login you do not recognise is the earliest sign of a stolen key or password.
Recent logins
last -a | head -20
Successful SSH logins today
sudo journalctl -u ssh --since today | grep -i accepted
-
Keep the clock in sync
MediumWrong time breaks TLS, two-factor codes and log timelines when you investigate an incident.
Check (want System clock synchronized: yes)
timedatectl status
-
Back up off the server and test a restore
HighRansomware, a bad deploy or a provider outage can take the server and its local backups together. A backup you have never restored is a guess.
Example with restic to S3-compatible storage
restic -r s3:https://s3.example.com/my-bucket init restic -r s3:https://s3.example.com/my-bucket backup /var/www /etc restic -r s3:https://s3.example.com/my-bucket snapshots
Test a restore into a scratch folder
restic -r s3:https://s3.example.com/my-bucket restore latest --target /tmp/restore-test
Nginx
0 of 7 done
-
Serve every site over HTTPS with automatic renewal
Critical PortGate domain monitoring checks thisExpired certificates take sites down and teach visitors to click through warnings.
Fix
sudo certbot --nginx -d example.com -d www.example.com
Check renewal works
sudo certbot renew --dry-run
-
Block .env, .git and other dotfiles
Critical PortGate domain monitoring checks thisAn exposed .env leaks database passwords and API keys; an exposed .git leaks your source. Bots request both on every site.
Check (want 403 or 404)
curl -s -o /dev/null -w '.env %{http_code}\n' https://example.com/.env curl -s -o /dev/null -w '.git %{http_code}\n' https://example.com/.git/configFix (inside each server block, keeps /.well-known for certificates)
location ~ /\.(?!well-known) { deny all; } -
Send security headers
High PortGate domain monitoring checks thisHSTS keeps browsers on HTTPS, nosniff and frame headers block common content and clickjacking tricks.
Check
curl -sI https://example.com | grep -Ei 'strict-transport|x-content-type|x-frame|referrer-policy|content-security'
Fix (in the HTTPS server block)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always;
-
Hide the Nginx version
MediumThe version number tells scanners exactly which known bugs to try.
Check
curl -sI https://example.com | grep -i '^server:'
Fix (in the http block of nginx.conf)
server_tokens off;
-
Allow only TLS 1.2 and 1.3
MediumTLS 1.0 and 1.1 have known weaknesses and every current browser supports 1.2 or newer.
Check (TLS 1.1 should fail to connect)
openssl s_client -connect example.com:443 -tls1_1 </dev/null 2>&1 | grep -Ei 'handshake failure|alert|no protocols|Cipher is'
Fix (http or server block)
ssl_protocols TLSv1.2 TLSv1.3;
-
Rate-limit login and API endpoints
MediumSlows down password guessing and stops one client from exhausting the server.
Fix (zone in the http block, limit in the location)
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m; location = /login { limit_req zone=login burst=5 nodelay; # your existing proxy_pass or try_files line } -
Test the config before every reload
MediumA typo in a reload can take every site on the server down.
Always
sudo nginx -t && sudo systemctl reload nginx
WordPress
0 of 9 done
-
Keep core, plugins and themes updated
CriticalOutdated plugins are the most common way WordPress sites get hacked.
Check
wp core check-update && wp plugin list --update=available && wp theme list --update=available
Fix
wp core update && wp plugin update --all && wp theme update --all
-
Delete plugins and themes you do not use
HighDeactivated plugins can still be attacked directly through their files.
Check
wp plugin list --status=inactive && wp theme list --status=inactive
Fix
wp plugin delete plugin-slug
-
Review administrators and require two-factor sign-in
CriticalAn extra admin account is a common backdoor after a break-in.
Check
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
-
Stop PHP running in the uploads folder
Critical PortGate Malware Guard checks thisAttackers upload webshells disguised as images; if PHP cannot run there, the shell is dead weight.
Check (should print nothing)
find wp-content/uploads -type f -name '*.php'
Fix on Nginx
location ~* /wp-content/uploads/.*\.php$ { deny all; } -
Turn off the theme and plugin editor
HighA stolen admin login otherwise becomes code execution through Appearance, Theme File Editor.
Fix
wp config set DISALLOW_FILE_EDIT true --raw
-
Verify core and plugin files against WordPress.org
High PortGate Malware Guard checks thisChanged core files are a strong sign of a hack.
Check
wp core verify-checksums && wp plugin verify-checksums --all
-
Lock down wp-config.php
HighIt holds the database password and secret keys.
Check
ls -l wp-config.php
Fix
chmod 640 wp-config.php
-
Block xmlrpc.php if you do not use it
MediumXML-RPC lets attackers try many passwords per request. Jetpack and some mobile apps need it, so check first.
Check (405 or 403 means blocked)
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://example.com/xmlrpc.phpFix on Nginx
location = /xmlrpc.php { deny all; } -
Keep debug output off in production
MediumDebug output shows file paths and sometimes database errors to visitors.
Check (want false)
wp config get WP_DEBUG
MySQL and MariaDB
0 of 4 done
-
Listen on localhost only
Critical PortGate Server Guard checks thisA database on the internet gets password guesses and exploit attempts all day.
Check (want 127.0.0.1:3306)
sudo ss -ltnp | grep 3306
Fix (under [mysqld], then restart)
bind-address = 127.0.0.1
-
Remove anonymous users, the test database and remote root
CriticalDefault installs can leave accounts that need no password.
Check
sudo mysql -e "SELECT user, host FROM mysql.user;"
Fix
sudo mysql_secure_installation
-
Give the app its own user with only the rights it needs
HighIf the app is hacked, the attacker gets one database, not all of them.
Fix
CREATE USER 'app'@'localhost' IDENTIFIED BY 'a-long-random-password'; GRANT SELECT, INSERT, UPDATE, DELETE ON app.* TO 'app'@'localhost';
-
Back up the database daily and test a restore
HighA backup you have not restored is a guess.
Example (crontab)
0 3 * * * mysqldump --single-transaction --routines app | gzip > /var/backups/app-$(date +\%F).sql.gz
Commands are for Ubuntu or Debian VPS. Read each one before you run it, test on a staging server where you can, and keep an SSH session open while you change SSH or firewall settings.