๐Ÿ“– FMH Backup Manager โ€” Handy Hints

โ† Back to Admin Panel

Contents

๐Ÿ”‘ SSH Keys โ€” How They Work

SSH keys let you log into remote servers without a password. Each machine has its own key pair:

A key only works for the specific user it's been added to. For example:

๐Ÿ’ก The Mac Pro has its own key at /Users/macpro/.ssh/id_ed25519. Your laptop has a separate key. Both need to be deployed to servers you want to access from each machine.

๐Ÿ†• Generating a New SSH Key

Run this on the machine that needs the key (e.g. your laptop):

ssh-keygen -t ed25519

Press Enter for defaults. Your key pair will be at:

View your public key:

cat ~/.ssh/id_ed25519.pub

๐Ÿš€ Deploying Keys to Servers

Via the Admin Panel (Mac Pro's key)

Go to Managed Servers โ†’ click ๐Ÿ”‘ Push Key on a server. Enter the server password. This deploys the Mac Pro's key to root and your configured additional user.

Via the Admin Panel (your laptop's key)

Go to SSH Keys โ†’ click + Add SSH Key. Paste your laptop's public key. Then click ๐Ÿ”„ Sync All Keys to push it to all managed servers.

Via command line

# Standard port
ssh-copy-id philcoates@server.com

# Custom port
ssh-copy-id -p 60437 philcoates@server.com

# To a specific user
ssh-copy-id -p 60437 root@server.com

Manually (if root login is disabled)

# SSH in as philcoates first
ssh -p 60437 philcoates@server.com

# Copy your authorized_keys to root
sudo mkdir -p /root/.ssh
sudo cp ~/.ssh/authorized_keys /root/.ssh/authorized_keys
sudo chmod 700 /root/.ssh
sudo chmod 600 /root/.ssh/authorized_keys

๐Ÿ”— Connecting to Servers

# Standard port (22)
ssh philcoates@server.com

# Custom port
ssh -p 60437 philcoates@server.com

# As root (key auth only after hardening)
ssh -p 60437 root@149.102.131.105

# Get root shell when logged in as philcoates
sudo su -

SSH Config (avoid typing port every time)

Add to ~/.ssh/config:

Host filemaker
    HostName filemaker.fmhosting.uk
    User philcoates
    Port 60437

Host henderson
    HostName henderson.fmhosting.uk
    User philcoates
    Port 22

Then just:

ssh filemaker
ssh henderson

๐Ÿ–ฅ๏ธ Setting Up a New Server

Full workflow for a fresh Contabo server:

  1. Add the server in Managed Servers โ†’ + Add Server
  2. Click ๐Ÿ”‘ Push Key โ€” enter the initial root password
  3. Click ๐Ÿ” Test to verify SSH key access works
  4. Add your laptop's key in SSH Keys and Sync All Keys
  5. Click ๐Ÿ”’ Apply Hardening โ€” tick Zabbix/RustDesk if needed
  6. Set up the backup job in + Add Backup Job
  7. Create a client access code if the client needs download access
โš ๏ธ Before hardening, make sure the SSH key works! Hardening disables password auth โ€” if your key isn't deployed, you'll be locked out.

๐Ÿ‘ค Adding a New User to a Server

# SSH in as root
ssh -p 60437 root@server.com

# Create user
adduser philcoates

# Grant sudo access (passwordless)
echo "philcoates ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/philcoates
chmod 440 /etc/sudoers.d/philcoates

# Copy root's authorized_keys to new user
mkdir -p /home/philcoates/.ssh
cp /root/.ssh/authorized_keys /home/philcoates/.ssh/
chown -R philcoates:philcoates /home/philcoates/.ssh
chmod 700 /home/philcoates/.ssh
chmod 600 /home/philcoates/.ssh/authorized_keys
๐Ÿ’ก Set the additional username in Settings โ†’ Additional SSH Deploy Username so Push Key deploys to both root and this user automatically.

๐Ÿ”’ Security Hardening

The hardening script applies these protections:

Optional firewall ports (checkboxes in the hardening dialog):

๐Ÿ’ก The script auto-detects the SSH port from the server config, and only adds FileMaker jails if FMS is installed.
โš ๏ธ Non-root users (e.g. philcoates) need passwordless sudo for hardening to work. Check with: sudo -n whoami

๐Ÿš” Fail2ban Management

# Check status
sudo systemctl status fail2ban

# List active jails
sudo fail2ban-client status

# Check specific jail
sudo fail2ban-client status sshd
sudo fail2ban-client status fms-admin

# Unban an IP
sudo fail2ban-client set sshd unbanip 1.2.3.4

# Ban an IP
sudo fail2ban-client set sshd banip 1.2.3.4

# View banned IPs
sudo fail2ban-client status sshd | grep "Banned IP"

# Restart after config changes
sudo systemctl restart fail2ban

# View fail2ban log
sudo tail -50 /var/log/fail2ban.log
โš ๏ธ If fail2ban won't start, check: sudo fail2ban-client -t โ€” usually a bad jail config or missing log file.

๐Ÿ›ก๏ธ UFW Firewall

# Check status
sudo ufw status verbose

# Enable/disable
sudo ufw enable
sudo ufw disable

# Allow a port
sudo ufw allow 10050/tcp

# Allow a port range
sudo ufw allow 21115:21119/tcp

# Allow from specific IP
sudo ufw allow from 149.22.74.121

# Remove a rule
sudo ufw status numbered
sudo ufw delete 5

# Reset (remove all rules)
sudo ufw reset

๐Ÿ“ฅ Backup Downloads

How downloads work in the admin panel and client portal:

Temp ZIPs are stored in rsync-gui/temp-downloads/ and auto-cleaned after 12 hours.

๐Ÿ’ก Caddy reverse proxy has flush_interval -1 set to enable streaming. Without this, large downloads buffer and appear to hang.

๐Ÿ—„๏ธ FMS Backup Requests

Clients can request a fresh FileMaker Server backup from the download portal. Configure per client code:

1-hour cooldown between requests. All events logged to audit trail.

๐Ÿ”ง Maintenance

App service (Mac Pro)

# Restart the app
launchctl unload ~/Library/LaunchAgents/com.rsync-gui.plist
launchctl load ~/Library/LaunchAgents/com.rsync-gui.plist

# Check if running
launchctl list | grep rsync

# View logs
tail -f /Users/macpro/Shared/files/rsync-gui/logs/output.log
tail -f /Users/macpro/Shared/files/rsync-gui/logs/error.log

Caddy reverse proxy (Mac Pro)

# Config location
/usr/local/etc/Caddyfile

# Reload after config change
sudo caddy reload --config /usr/local/etc/Caddyfile

Database maintenance

In Settings โ†’ ๐Ÿ”ง Maintenance:

Both run automatically on startup and daily.

View hardening log on a server

sudo cat /var/log/server-hardening.log

๐Ÿ” Troubleshooting

Locked out of a server

Use Contabo VNC console to log in, then:

# Re-enable password auth temporarily
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config.d/*.conf
sudo systemctl restart ssh

Fail2ban won't start

# Check what's wrong
sudo fail2ban-client -t
sudo journalctl -u fail2ban --no-pager -n 30

# Common fix: remove stale FMS jail on non-FM server
sudo rm -f /etc/fail2ban/jail.d/fms-admin.conf
sudo systemctl restart fail2ban

UFW not active after hardening

sudo ufw enable

Downloads not working

Check Caddy has flush_interval -1 in both reverse_proxy blocks:

cat /usr/local/etc/Caddyfile

Permission denied on hardening

The user needs passwordless sudo:

echo "philcoates ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/philcoates
sudo chmod 440 /etc/sudoers.d/philcoates

Banned yourself with fail2ban

Use Contabo VNC, or from another server:

sudo fail2ban-client set sshd unbanip YOUR_IP

๐Ÿ“‚ Key File Paths

Mac Pro (app server)

App:              /Users/macpro/Shared/files/rsync-gui/
Data:             /Users/macpro/Shared/files/rsync-gui/data.json
Logs:             /Users/macpro/Shared/files/rsync-gui/logs/
Temp downloads:   /Users/macpro/Shared/files/rsync-gui/temp-downloads/
Mac Pro SSH key:  /Users/macpro/.ssh/id_ed25519
Caddy config:     /usr/local/etc/Caddyfile
LaunchAgent:      ~/Library/LaunchAgents/com.rsync-gui.plist

Remote servers

Hardening log:    /var/log/server-hardening.log
Fail2ban config:  /etc/fail2ban/jail.local
Fail2ban log:     /var/log/fail2ban.log
UFW rules:        sudo ufw status numbered
SSH config:       /etc/ssh/sshd_config
FMS logs symlink: /opt/fms-logs โ†’ /opt/FileMaker/.../Logs
Backups dir:      /root/security-hardening-backups/

URLs

Admin panel:      https://fmhadmin.fmhosting.uk
Client portal:    https://fmhbackup.fmhosting.uk
Phil's fixed IP:  149.22.74.121