DirectAdmin Security and Advanced Features

DirectAdmin is one of the most secure and flexible hosting control panels available. This guide covers essential security features including SSL on port 2222, Login Keys, Two-Factor Authentication, Security Questions, Brute Force Protection, and advanced customization options for securing your server.

secure and flexible hosting controlsecuring

~3 min read · Updated Mar 1, 2026

1. Securing DirectAdmin on Port 2222 with SSL


SSL encrypts the connection between the browser and the server, protecting sensitive data such as passwords and personal information from interception or tampering.

1.1 How to Enable SSL for DirectAdmin

DirectAdmin supports SSL on port 2222 by default. To enable it:

  1. Install a valid SSL certificate (Let’s Encrypt recommended).
  2. Edit /usr/local/directadmin/conf/directadmin.conf and ensure the following lines exist:

textssl=1
ssl_redirect_host=yourdomain.com
ssl_redirect_port=2222

Restart DirectAdmin:

systemctl restart directadmin

DirectAdmin will now be accessible only via https://yourdomain.com:2222.

---

2. What Is a Login Key and How Is It Created?


A Login Key is an additional security layer that allows you to generate temporary or restricted access keys instead of sharing your main password. These keys are ideal for API usage, scripts, or temporary technician access.

2.1 Login Key Features

  • Usage limits (one-time or unlimited)
  • Expiration date
  • Automatic deletion after use or expiration
  • IP restrictions
  • Command restrictions (CMD_*)
  • Disable HTML access to prevent browser login

2.2 How to Create a Login Key

  1. Log in as the target user (e.g., admin).
  2. Navigate to: User Level → Login Keys
  3. Click Create Key.
  4. Fill in the fields:
  • Key Name: for your reference
  • Key Value: generate randomly
  • Expires On: expiration date
  • Clear Key: delete after expiration
  • Allow HTM: enable only if browser login is needed
  • Commands: select only required CMD_* actions
  • Allowed IPs: restrict access to specific IPs
  • Current Password: enter your current password

The key will be shown only once—copy and store it securely.

2.3 Practical Use Cases

  • API for email management: allow only CMD_API_POP, CMD_API_EMAIL_VACATION
  • DNS Clustering: allow CMD_API_DNS_ADMIN, CMD_API_LOGIN_TEST
  • Technician access: enable HTML, set expiration to 5 days, restrict IP
---

3. Enabling Two-Factor Authentication and Security Questions


3.1 Two-Step Authentication (2FA)

  1. Go to: Dashboard → Change Password → Two-Step Authentication
  2. Scan the QR code using Google Authenticator, Authy, or FreeOTP
  3. Enter the temporary code
  4. Save your Scratch Codes for emergency access

3.2 Security Questions

In the same section, configure your Security Questions for additional protection.

3.3 Important Security Note

Failed attempts for 2FA or Security Questions are logged in failed_logins. If attempts exceed brutecount, the IP is added to ip_blacklist.

To unblock yourself:

/usr/local/directadmin/data/admin/ip_blacklist

To prevent future blocks, add your IP to:

/usr/local/directadmin/data/admin/ip_whitelist
---

4. Brute Force Monitoring and Attack Prevention


DirectAdmin includes two brute-force detection systems:

4.1 For DirectAdmin Login (Port 2222)

Navigate to:

Admin Level → Admin Settings → Blacklist IPs for excessive login attempts

Recommended value: 10–20 attempts.

4.2 For Other Services

Apache, Exim, Dovecot, SSH, ProFTPd:

Admin Level → Admin Settings → Parse service logs for brute force attacks

Monitor attacks via:

Admin Level → Brute Force Monitor

4.3 Hide Brute Force Notifications

If notifications are too frequent:

hide_brute_force_notifications=1

Add this to directadmin.conf and restart DirectAdmin.

4.4 WordPress xmlrpc.php Attacks

If “Scan for WordPress attacks” is enabled, even successful POST requests to xmlrpc.php (HTTP 200) are counted as attacks—weighted x4.

4.5 Custom Page for Blocked IPs

Create this file to replace the default block message:

/usr/local/directadmin/data/templates/custom/blacklisted_ip.html

You can display any custom HTML message to blocked visitors.

Written & researched by Dr. Shahin Siami

Related Articles

Email Client Configuration & Dovecot Quota/Monitoring Guide for DirectAdmin Users

This guide explains how to configure popular email clients (iPhone Mail, Thunderbird, Gmail POP/SMTP), enable Dovecot LMTP quota warnings, and check the last login time for all email accounts on a DirectAdmin server. It includes step by step instructions, recommended IMAP/SMTP settings, and useful administrative scripts.

Continue

Troubleshooting Dovecot in DirectAdmin – Fixing IMAP Errors, Authentication Issues, and SSL Certificate Checks

Dovecot is the IMAP/POP3 server used by DirectAdmin. Sometimes users encounter errors such as “Connection dropped by IMAP server” or “unknown user” during authentication. This guide explains how to fix corrupted Dovecot indexes, understand authentication logs, hide unnecessary warnings, and manually inspect SSL certificates on IMAP ports 143 and 993.

Continue

DNS Troubleshooting in DirectAdmin – When named is Running but Domains Do Not Resolve

Sometimes the named (BIND) service runs normally, yet DNS queries fail or domains do not resolve from outside. This guide provides a complete troubleshooting workflow for checking named listeners, firewall rules, named.conf configuration, DNS propagation issues, subdomain problems, resolv.conf errors, and common Apache/Nginx misconfigurations.

Continue

Managing DNS Records in DirectAdmin – Complete Practical Guide for Administrators

DirectAdmin provides a powerful DNS management system that allows administrators to control TTL values, create SRV records, enable DNSSEC, manage subdomain delegation, automate TLSA records, and perform mass DNS updates. This guide explains all essential DNS operations in DirectAdmin with real-world examples and best practices.

Continue

DNS and Nameservers in DirectAdmin – Complete, Practical, and Professional Guide

DNS is the backbone of the internet, responsible for translating domain names into IP addresses. DirectAdmin allows you to create private nameservers (ns1/ns2), manage DNS zones, configure DNS clustering, use external DNS, and troubleshoot common issues. This guide provides a complete, clear, and practical explanation of DNS concepts and their implementation in DirectAdmin.

Continue

CustomBuild in DirectAdmin – Complete Guide to Installation, Updates, Configuration, and Advanced Customization

CustomBuild is DirectAdmin’s primary software management system. It installs, updates, configures, and rebuilds essential services such as Apache, Nginx, PHP, MariaDB/MySQL, Exim, Dovecot, FTP servers, and more. Because most components are compiled from source, CustomBuild offers exceptional flexibility, fast access to new versions, and optimized performance.

Continue