v0.2.0 • Open Source Bash Script for Debian & Ubuntu

From fresh VPS to hardened server in 60 seconds.

hpsr.sh is the interactive Bash assistant that applies a rock-solid technical baseline on brand-new servers: non-root admin user, cryptographic SSH keys, default-deny UFW firewall, Fail2ban, and automatic security patches without Ansible bloat or manual oversights.

curl -fsSL https://sh.hpsr.dev/setup.sh | bash

Paste this command into your terminal as root to launch the interactive wizard:

0 dependencies outside standard Bash. No changes are applied until your explicit confirmation.

< 60s Guided setup time
0 deps Native Bash and apt only
6 layers Automated hardening
100% Audit Logs, backups & report
Battle-tested on cloud providers and bare-metal hardware:
Debian 11 & 12Ubuntu 20, 22 & 24 LTSDigitalOceanHetzner CloudAWS EC2VultrLinode / AkamaiProxmox VE
HARDENING BLUEPRINT

The 6 security layers hpsr.sh applies to your machine

Every technical decision is calculated to eliminate common attack vectors on internet-facing servers without hurting developer ergonomics.

LAYER 01 · IDENTITY 01

Isolated admin user & clean sudo

Provisions a dedicated administrative user with clean sudoers membership and ~/.ssh directory restricted to strict permissions (700 for directories, 600 for authorized keys).

Stops day-to-day root usage and enforces the principle of least privilege from minute zero.
LAYER 02 · ACCESS 02

Asymmetric SSH hardening & custom port

Disables PermitRootLogin and PasswordAuthentication. Installs managed Ed25519 key pairs, validates sshd_config with sshd -t before reloading, and moves the listening port to 666 (or your custom choice).

Cuts out 99% of botnet scanner noise on port 22 and renders password brute-forcing obsolete.
LAYER 03 · NETWORK 03

UFW Firewall with Default-Deny Policy

Enables kernel firewalling with default deny incoming and allow outgoing. Strictly allows only your configured SSH port and essential web traffic (80/tcp and 443/tcp), with prompts for custom extra ports.

Locks down any stray or internal services from unwanted public network exposure.
LAYER 04 · DEFENSE 04

Fail2ban Anti-Bruteforce for SSH

Installs and provisions Fail2ban with a sane SSH jail: 1-hour ban after 5 failed authentication attempts inside a 10-minute window (findtime: 10m, bantime: 1h, maxretry: 5).

Mitigates aggressive dictionary attacks and automated bot sweeps.
LAYER 05 · MAINTENANCE 05

Automatic Security Patches (Unattended)

Configures unattended-upgrades so Debian or Ubuntu silently fetches and applies critical security patches for kernel and core packages in the background without destructive restarts.

Continuous protection against zero-day CVEs without requiring manual daily apt runs.
LAYER 06 · AUDITABILITY 06

Full traceability, sshd backup & Resend report

Generates a timestamped backup of sshd_config prior to edits, logs every executed command, compiles a detailed Markdown report, encrypts key bundles, and optionally delivers alerts via Resend.

Provides complete visibility over changes, safe rollback capabilities, and secure key backups.
COMPARISON MATRIX

Why hpsr.sh compared to alternatives?

Neither the fragility of improvised manual setups nor the heavy operational overhead of enterprise orchestrators for single servers.

Criteria Manual setup by hand RECOMENDADO hpsr.sh Ansible / CIS Benchmark
Average setup time 30 to 60 minutes 2 to 4 hours (crafting playbooks)
Required dependencies None (ad-hoc commands) Python, Ansible, control node, SSH agent
Learning curve Medium (remembering flags & syntax) High (YAML, roles, inventories, vault)
SSH lockout protection None (easy to break sshd syntax) Requires extensive staging tests
Firewall + Fail2ban included Manual step frequently forgotten Requires dedicated roles and tasks
Backups & change logs Rarely documented Depends on custom playbook design
LIVE SIMULATION

A clean, interactive, and predictable console flow

No hidden black magic. hpsr.sh presents a system snapshot, allows step-by-step configuration, and requires your explicit confirmation before applying a single change.

root@ubuntu:~ — hpsr.sh v0.2.0
SIMULACIÓN ACTIVA BASH 5.2 · DEBIAN/UBUNTU
POST-SETUP CHEATSHEET

Commands to verify your newly hardened server

Once execution finishes, verify the firewall state, Fail2ban jails, and your new SSH connection in just 10 seconds:

01

1. Verify UFW firewall status & rules

sudo ufw status verbose

Ensures the firewall is "active", defaults to deny incoming, and only exposes authorized ports.

02

2. Check active Fail2ban SSH jail

sudo fail2ban-client status sshd

Displays currently banned IPs and active jail filters in real-time.

03

3. Test SSH connection in a new terminal

ssh -p 666 -i ~/.ssh/your_key adminops@YOUR_IP

Verify connectivity with your new user and port before exiting the active root session.

04

4. Check unattended security upgrades service

sudo systemctl status unattended-upgrades

Confirms background automatic patching is active and healthy.

FREQUENTLY ASKED QUESTIONS

Everything you need to know before running it

Transparent technical answers to the most common questions regarding hpsr.sh internals.

What happens if I make a mistake and get locked out of my server?

hpsr.sh rigorously validates the syntax of your OpenSSH configuration using `sshd -t` before restarting or reloading any daemon. Additionally, the wizard explicitly asks you to open a separate terminal window and test logging in with your new user and key before closing your root session. If anything fails, your current session stays intact.

Why does it suggest changing the SSH port to 666 by default?

Moving SSH off port 22 is not encryption, but it is outstanding noise reduction: it cuts out over 98% of automated port scanners and brute-force bots on the public internet. If you prefer another port or want to keep port 22, the wizard allows you to input any port number.

Does it work on servers already running Docker or web applications?

hpsr.sh is specifically designed and optimized for fresh or newly restored VPS servers (Greenfield environments). If Docker is already installed, UFW rules can interfere with iptables chains managed by Docker. We strongly recommend running hpsr.sh as step one on a clean machine before installing Docker or production stacks.

Where are SSH keys stored and how are they transferred?

If you opt to have hpsr.sh generate an Ed25519 key pair, the public key is appended to authorized_keys inside a clearly marked managed block. The private key is output to the console and can be bundled into a password-encrypted zip or dispatched via Resend email. Sensitive temporary files are scrubbed right after.

Does it require a permanent connection or background agents?

No. hpsr.sh installs zero proprietary daemons, telemetry agents, or background processes. It only installs standard packages from official Debian/Ubuntu repositories via apt (ufw, fail2ban, unattended-upgrades, curl, zip). Once finished, nothing remains running in memory.

How can I inspect the code before running it?

The source code of hpsr.sh is 100% open, readable, and auditable. You can inspect it directly in your terminal using `curl -fsSL https://sh.hpsr.dev/setup.sh | less` or by checking the GitHub repository at https://github.com/hopsersmerk/hpsr.sh.

Stop improvising your server setup.

One single command separates you from a hardened Debian or Ubuntu server with secure SSH, active firewall, and automated security patches from minute one.

curl -fsSL https://sh.hpsr.dev/setup.sh | bash