Configuring DDoS Protection for a Server
Please note
This guide describes how to enable DDoS protection for a website or web application hosted on a Cloud server. The domain of the website or web application must be pointed to the IP address of that server.
Please note: These instructions apply only if a website or web application that is intended to operate via this domain is already hosted on the server.
If other services (such as email, an API, or a game server) are running on the same IP address, the conditions for enabling DDoS protection may differ.
When is this type of protection needed?
DDoS protection filters out malicious traffic before it overloads the server. This ensures that the website remains accessible to visitors even during an attack.
For example, let’s use the subdomain protection.example.com and the IP address 78.27.236.62
####How to enable DDoS protection
Step 1. Verify that the domain is pointing to the Cloud Server's IP address
Before creating an SSL certificate, add a DNS record for the domain you want to secure and specify the Cloud Server’s IP address.
For example, for protection.example.com, create an A record with the value 78.27.236.62.
Where do I configure DNS?
Create the record in the control panel of the provider whose DNS servers host your domain.
This may not be the same provider from whom you purchased the domain.
Step 2. Create an RSA SSL certificate on the server
Connect to the server hosting the website for which you want to enable protection. Create the certificate using the following command:
certbot certonly --standalone --key-type rsa -d protection.example.com
The DDoS panel requires an SSL certificate with an RSA key.
The --standalone mode uses port 80 to verify the domain. Make sure the port is accessible from the Internet.
If the port is occupied by a web server, temporarily stop it. During this time, the websites it serves will be unavailable. After verification, restart the web server.
After creating the certificate, check the key type:
openssl x509 -in /etc/letsencrypt/live/protection.example.com/cert.pem -text -noout | grep -A2 “Public Key Algorithm”
The following line should appear:
Public Key Algorithm: rsaEncryption
Step 3. Prepare the SSL certificate files
To import via the hosting control panel, you'll need three files: the SSL certificate (.crt), the CA certificate chain, and the private key (.key).
To download the files from the server to your PC, follow the instructions below
Linux
Run the following command on a trusted device where you want to download the files. It copies the files from the cloud server and renames them immediately:
ssh root@78.27.236.62 \
"tar -C /etc/letsencrypt/live/protection.example.com \
--dereference -czf - cert.pem chain.pem privkey.pem" \
| tar -xzf - \
&& cp cert.pem protection.crt \
&& cp chain.pem ca_bundle.crt \
&& cp privkey.pem protection.key
protection.crt- SSL certificateca_bundle.crt- CA certificate chainprotection.key- private key
Important! This command transfers
privkey.pemvia SSH and creates a local file containing the private key. Run it only on a trusted device and do not share theprotection.keyfile with third parties.
Using Windows and WinSCP
Install WinSCP and connect to the server via SSH: root@78.27.236.62
Upload the following files to your computer:
/etc/letsencrypt/live/protection.example.com/cert.pem
/etc/letsencrypt/live/protection.example.com/chain.pem
/etc/letsencrypt/live/protection.example.com/privkey.pem
After downloading, rename the files:
chain.pem → ca_bundle.crt
cert.pem → protection.crt
privkey.pem → protection.key
Step 4. Import the SSL Certificate
In the control panel, open the “DDoS Protection” section and click “Import SSL Certificate”.
In the form, enter:
Certificate Name - a name of your choice
Domains - protection.example.com
Certificate Authority (CA) Certificate - the ca_bundle.crt file
Web Server Certificate - the protection.crt file
Private Key - the protection.key file
Click “Import Certificate” and wait for the message confirming successful import.
Step 5. Submit a request to enable DDoS protection
In the “DDoS Protection” section, click “I’m under a DDoS attack!”. Select the IPv4 and IPv6 addresses for which you want to enable protection.
Then click the button:
“Submit a ‘I’m Under a DDoS Attack’ Request.”
After submitting the request
Protection will be enabled within 5–10 minutes. After that, check the site’s availability via HTTPS.