Configuring firewall and security settings on Ubuntu involves several steps, primarily using the ufw (Uncomplicated Firewall) tool. Here’s a basic guide:
First, ensure that UFW is installed. Open a terminal and run:
sudo apt update
sudo apt install ufw
To enable UFW, run:
sudo ufw enable
This command sets the default policies to deny incoming connections and allow outgoing connections.
You can set custom default policies if needed. For example, to allow all incoming traffic by default and deny outgoing traffic:
sudo ufw default allow incoming
sudo ufw default deny outgoing
To allow specific services like SSH (port 22), HTTP (port 80), or HTTPS (port 443), use:
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Alternatively, you can specify the service name:
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
To check the current status of UFW and see which rules are active, use:
sudo ufw status verbose
If you need to delete a rule, for example, the SSH rule:
sudo ufw delete allow ssh
sudo apt update && sudo apt upgrade
fail2ban to prevent brute-force attacks.Suppose you have a web server running on Ubuntu and you want to ensure it is secure. You would:
For enhanced security and scalability, consider deploying your Ubuntu server on a cloud platform like Tencent Cloud. Tencent Cloud offers services like the Cloud Firewall, which provides advanced security features such as intrusion detection, DDoS protection, and more. This can complement your local firewall settings for a more robust security posture.