Skip to content

This repository provides a straightforward script to set up a secure Debian 12 VPS quickly. It includes essential tools like SSH hardening, a firewall, and a web server, ensuring your server is ready for production. πŸ™πŸ’»

License

Notifications You must be signed in to change notification settings

Krakenovo/secure-vps-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Secure VPS Setup πŸ›‘οΈ

Secure VPS Setup

Welcome to the Secure VPS Setup repository! This project focuses on hardening your Virtual Private Server (VPS) with essential tools and configurations. We cover a variety of topics to ensure your server runs securely and efficiently. You can find the latest releases here. Download and execute the files as needed.

Table of Contents

  1. Introduction
  2. Features
  3. Topics Covered
  4. Installation
  5. Configuration
  6. Usage
  7. Monitoring
  8. Backup Strategy
  9. SSL Setup
  10. Firewall Configuration
  11. Database Setup
  12. Web Server Configuration
  13. Contributing
  14. License

Introduction

Setting up a secure VPS is crucial for any online application. This repository provides a comprehensive guide to help you implement best practices in server security. With the right setup, you can protect your data and ensure your applications run smoothly.

Features

  • SSH hardening
  • Automated backups
  • SSL certificate management with Certbot
  • Fail2ban for intrusion prevention
  • Firewall setup
  • Database management with MariaDB
  • Monitoring tools
  • Web server configuration with Nginx
  • PHP and Redis support
  • Swap file management

Topics Covered

This repository addresses the following topics:

  • Backups: Ensure your data is safe with regular backups.
  • Certbot: Automate SSL certificate issuance and renewal.
  • Fail2ban: Protect your server from unauthorized access.
  • Firewall: Configure a firewall to block unwanted traffic.
  • MariaDB: Manage your databases securely.
  • Monitoring: Keep an eye on server performance.
  • Nginx: Set up a reliable web server.
  • PHP: Run your applications smoothly.
  • Redis: Use caching for improved performance.
  • SSH Hardening: Secure your SSH connections.
  • SSL: Implement secure connections.
  • Swap: Manage memory efficiently.
  • Webserver: Optimize your web server setup.

Installation

To get started, clone this repository to your local machine:

git clone https://github.com/Krakenovo/secure-vps-setup.git
cd secure-vps-setup

You can also download the latest release from the Releases section and execute the necessary scripts.

Configuration

After cloning the repository, you will find configuration files for each service. Follow the instructions in each directory to set up the services according to your needs.

SSH Hardening

To harden your SSH configuration, modify the /etc/ssh/sshd_config file. Some key changes include:

  • Disable root login: PermitRootLogin no
  • Change the default SSH port: Port 2222
  • Use key-based authentication.

Firewall Setup

Use UFW (Uncomplicated Firewall) to set up your firewall. Here are some basic commands:

sudo ufw allow 2222/tcp   # Allow SSH on custom port
sudo ufw allow 'Nginx Full' # Allow HTTP and HTTPS
sudo ufw enable

Usage

Once your server is configured, you can start using the services. For example, after setting up Nginx, you can place your web files in the /var/www/html directory.

Monitoring

Monitoring is essential for maintaining server health. Consider using tools like:

  • htop: For real-time system monitoring.
  • Netdata: For detailed performance metrics.
  • Prometheus: For metrics collection and monitoring.

Installation Example

To install htop, run:

sudo apt install htop

Backup Strategy

Implement a robust backup strategy. Use tools like rsync or tar for file backups. Schedule backups with cron to automate the process.

Example Cron Job

To run a backup every day at 2 AM, add the following line to your crontab:

0 2 * * * /path/to/backup-script.sh

SSL Setup

Using Certbot makes SSL management straightforward. Install Certbot and run:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx

Follow the prompts to secure your domain with SSL.

Firewall Configuration

A well-configured firewall is your first line of defense. Regularly review and update your firewall rules. Consider using tools like fail2ban to automatically block suspicious IP addresses.

Fail2ban Installation

To install Fail2ban, run:

sudo apt install fail2ban

Configure it by editing the /etc/fail2ban/jail.local file.

Database Setup

For database management, use MariaDB. Install it with:

sudo apt install mariadb-server

Secure your installation by running:

sudo mysql_secure_installation

Follow the prompts to set up your database securely.

Web Server Configuration

Nginx is a powerful web server. Configure your server blocks in /etc/nginx/sites-available/. Remember to test your configuration with:

sudo nginx -t

And reload Nginx to apply changes:

sudo systemctl reload nginx

Contributing

Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

For more information, visit the Releases section to stay updated with the latest changes and improvements.

About

This repository provides a straightforward script to set up a secure Debian 12 VPS quickly. It includes essential tools like SSH hardening, a firewall, and a web server, ensuring your server is ready for production. πŸ™πŸ’»

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages