Course Overview
Locked video preview

Paid video

Please purchase the course to watch.

Setting up a secure VPS

Securing and ssh hardening

Here is a summary of the video transcript:

  • Objective: SSH Hardening and Server Security
    The video focuses on securing a newly provisioned server before production use. The goal is to enforce strict SSH access controls and apply essential security configurations through a reusable bash script.

  • Core Security Principles
    Root login must be disabled, and password-based SSH authentication must be turned off. Access should only be allowed via SSH keys to ensure that only authorized users with the correct private key can connect.

  • Admin User Setup
    A dedicated admin user is created with a home directory and added to the sudo group. This user must authenticate with an SSH key to log in and provide a password for privileged (sudo) operations.

  • SSH Configuration Hardening
    The script modifies SSH settings to disable root login, disable password authentication, enforce key-based access, limit login attempts, restrict sessions, and allow only specified users. The default SSH port is changed, and only essential ports are left open.

  • Fail2Ban Integration
    Fail2Ban is installed and configured to monitor failed login attempts and automatically ban IP addresses after repeated failures. This reduces brute-force risks and lowers unnecessary server load.

  • Firewall Configuration
    A firewall is configured to allow only HTTP (80), HTTPS (443), and the custom SSH port. All other ports are closed unless explicitly required, such as for a public database.

  • Script Execution and Validation
    The hardening script is uploaded, executed, and the server is rebooted. Verification confirms that root login is blocked, SSH access requires the custom port and key authentication, and administrative actions require a password.

  • Next Steps
    With SSH security in place, the next step is to configure a reverse proxy (Caddy) and associate a domain to enable HTTPS for securely running the application.