{"id":567,"date":"2021-07-23T12:33:04","date_gmt":"2021-07-23T12:33:04","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/proftpd-configuration-for-host-access-control\/"},"modified":"2021-07-23T12:33:04","modified_gmt":"2021-07-23T12:33:04","slug":"proftpd-configuration-for-host-access-control","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/proftpd-configuration-for-host-access-control\/","title":{"rendered":"ProFTPD Configuration for Host Access Control"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\"><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<p>This document provides an example of how to configure ProFTPd to utilize the <em>Host Access Control<\/em> feature from the command line to restrict access by IP address to FTP. The information in this document applies to systems that run cPanel &#038; WHM in CentOS 7, CloudLinux\u2122 7, and Red Hat\u00ae Enterprise Linux\u00ae 7 and earlier.<\/p>\n<p>ProFTPD does not automatically reference the <code>\/etc\/hosts.allow<\/code> or <code>\/etc\/hosts.deny<\/code> files to restrict access to the FTP service.<\/p>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>This document describes an unsupported workaround that we do <strong>not<\/strong> guarantee will work in the future.<\/p>\n<ul>\n<li>After you perform these steps on a server, the system administrator <strong>must<\/strong> manage and maintain the server\u2019s database software.<\/li>\n<li>We recommend that <strong>only<\/strong> experienced system administrators attempt to perform these steps.<\/li>\n<li>We are <strong>not<\/strong> responsible for any data loss that an attempt to perform these steps causes.<\/li>\n<\/ul><\/div>\n<\/div>\n<h3 id=\"centos-8-almalinux-8-and-cloudlinux-8-systems\">CentOS 8, AlmaLinux 8, and CloudLinux 8 systems<\/h3>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n<p>CentOS 8 removed support for the TCP Wrappers package (<code>tcp_wrappers<\/code>). This change means that ProFTPD does <strong>not<\/strong> use TCP-Wrappers-based access controls on CentOS 8, AlmaLinux 8, and CloudLinux 8 systems. The rest of ProFTPD\u2019s functionality still works in those operating systems. ProFTPD\u2019s functionality in cPanel &#038; WHM version 92 on CentOS 6 and 7, CloudLinux 6 and 7, and Red Hat Enterprise Linux 7 systems continues to use TCP-Wrappers-based access controls.<\/p>\n<p>The unsupported workaround described in this document is <strong>not<\/strong> supported in CentOS 8 or AlmaLinux 8. Instead, use the functionality available in WHM\u2019s <em>Host Access Control<\/em> interface.<\/p>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>cPanel &#038; WHM version 92 for CentOS 8 and CloudLinux 8 is <strong>experimental<\/strong> software and we do <strong>not<\/strong> recommend using it in production environments. For more information, read our cPanel &#038; WHM version 92 for CentOS 8 documentation.<\/p>\n<p>Upgrade to a later version of cPanel &#038; WHM to use CentOS 8 and CloudLinux 8 in production environments.<\/p>\n<\/p><\/div>\n<\/div><\/div>\n<\/div>\n<h2 id=\"system-requirements\">System Requirements:<\/h2>\n<p>To configure ProFTPD, the following software <strong>must<\/strong> run on your server:<\/p>\n<ul>\n<li>ProFTPD version 1.3.3 and later.<\/li>\n<li>The <code>mod_wrap<\/code> module.<\/li>\n<\/ul>\n<p>As the <code>root<\/code> user, run the following command to confirm that you have the correct version of ProFTPD and <code>mod_wrap<\/code> installed on your server:<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-GO\" data-lang=\"GO\"><span style=\"color:#a6e22e\">proftpd<\/span> <span style=\"color:#f92672\">-<\/span><span style=\"color:#a6e22e\">V<\/span> | <span style=\"color:#a6e22e\">awk<\/span> <span style=\"color:#960050;background-color:#1e0010\">'<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">Version<\/span><span style=\"color:#f92672\">\/<\/span> {<span style=\"color:#a6e22e\">print<\/span> <span style=\"color:#960050;background-color:#1e0010\">$<\/span><span style=\"color:#ae81ff\">0<\/span>}; <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">mod_wrap<\/span><span style=\"color:#f92672\">\/<\/span> {<span style=\"color:#a6e22e\">print<\/span> <span style=\"color:#e6db74\">\"mod_wrap is installed\"<\/span>}<span style=\"color:#960050;background-color:#1e0010\">'<\/span><\/code><\/pre>\n<\/div>\n<p>The output will resemble the following example:<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-GO\" data-lang=\"GO\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">2\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">3\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">4\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-GO\" data-lang=\"GO\"><span style=\"color:#a6e22e\">root<\/span><span style=\"color:#960050;background-color:#1e0010\">@<\/span><span style=\"color:#a6e22e\">testserver<\/span> [<span style=\"color:#960050;background-color:#1e0010\">~<\/span>]<span style=\"color:#960050;background-color:#1e0010\">#<\/span> <span style=\"color:#a6e22e\">proftpd<\/span> <span style=\"color:#f92672\">-<\/span><span style=\"color:#a6e22e\">V<\/span> | <span style=\"color:#a6e22e\">awk<\/span> <span style=\"color:#960050;background-color:#1e0010\">'<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">Version<\/span><span style=\"color:#f92672\">\/<\/span> {<span style=\"color:#a6e22e\">print<\/span> <span style=\"color:#960050;background-color:#1e0010\">$<\/span><span style=\"color:#ae81ff\">0<\/span>}; <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">mod_wrap<\/span><span style=\"color:#f92672\">\/<\/span> {<span style=\"color:#a6e22e\">print<\/span> <span style=\"color:#e6db74\">\"mod_wrap is installed\"<\/span>}<span style=\"color:#960050;background-color:#1e0010\">'<\/span>\n  <span style=\"color:#a6e22e\">Version<\/span>: <span style=\"color:#ae81ff\">1.3.5<\/span><span style=\"color:#a6e22e\">rc1<\/span> (<span style=\"color:#a6e22e\">devel<\/span>)\n<span style=\"color:#a6e22e\">mod_wrap<\/span> <span style=\"color:#a6e22e\">is<\/span> <span style=\"color:#a6e22e\">installed<\/span>\n<span style=\"color:#a6e22e\">root<\/span><span style=\"color:#960050;background-color:#1e0010\">@<\/span><span style=\"color:#a6e22e\">testserver<\/span> [<span style=\"color:#960050;background-color:#1e0010\">~<\/span>]<span style=\"color:#960050;background-color:#1e0010\">#<\/span><\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<h2 id=\"create-a-virtualhost-container\">Create a VirtualHost container<\/h2>\n<p>To configure ProFTPD, create a Virtual Host container. To do this, perform the following steps as the <code>root<\/code> user:<\/p>\n<ol>\n<li>\n<p>Open the <code>\/etc\/proftpd.conf<\/code> file with a text editor and add the following lines after the comments:\n<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-GO\" data-lang=\"GO\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">2\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-GO\" data-lang=\"GO\"><span style=\"color:#a6e22e\">TCPAccessFiles<\/span> <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">etc<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">hosts<\/span>.<span style=\"color:#a6e22e\">allow<\/span> <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">etc<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">hosts<\/span>.<span style=\"color:#a6e22e\">deny<\/span>\n<span style=\"color:#a6e22e\">TCPServiceName<\/span> <span style=\"color:#a6e22e\">ftp<\/span><\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>Each Virtual Host that requires Host Access Control needs this entry in the <code>\/etc\/proftpd.conf<\/code> file.<\/li>\n<li>You <strong>must<\/strong> specify both <code>\/etc\/hosts.allow<\/code> and <code>\/etc\/hosts.deny<\/code> or you will receive an error.<br \/>\n<\/li>\n<\/ul><\/div>\n<\/div>\n<\/li>\n<li>\n<p>Run the <code>\/usr\/local\/cpanel\/scripts\/restartsrv_proftpd<\/code> script to restart ProFTPD.<\/p>\n<\/li>\n<li>\n<p>Add access deny rules to the <code>\/etc\/ftpusers<\/code> file. This file lists of all of the users for whom to deny FTP access.<\/p>\n<\/li>\n<li>\n<p>Log in to your FTP server to test the new configuration.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>If ProFTPD rejects connections due to Host Access Control configuration, the system will report those failures as authentication failures. For example:<\/p>\n<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 2\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 3\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 4\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 5\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 6\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 7\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 8\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 9\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">10\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">11\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\">  <span style=\"color:#a6e22e\">root<\/span><span style=\"color:#960050;background-color:#1e0010\">@<\/span><span style=\"color:#a6e22e\">testserver<\/span> [<span style=\"color:#960050;background-color:#1e0010\">~<\/span>]<span style=\"color:#960050;background-color:#1e0010\">#<\/span> <span style=\"color:#a6e22e\">ftp<\/span> <span style=\"color:#ae81ff\">10.1.1.1<\/span>\n  <span style=\"color:#a6e22e\">Connected<\/span> <span style=\"color:#a6e22e\">to<\/span> <span style=\"color:#ae81ff\">10.1.1.1<\/span>.\n  <span style=\"color:#ae81ff\">220<\/span> <span style=\"color:#a6e22e\">ProFTPD<\/span> <span style=\"color:#ae81ff\">1.3.5<\/span><span style=\"color:#a6e22e\">rc1<\/span> <span style=\"color:#a6e22e\">Server<\/span> (<span style=\"color:#a6e22e\">ProFTPD<\/span>) [::<span style=\"color:#a6e22e\">ffff<\/span>:<span style=\"color:#ae81ff\">10.1.1.1<\/span>]\n  <span style=\"color:#a6e22e\">Name<\/span> (<span style=\"color:#ae81ff\">10.1.1.1<\/span>:<span style=\"color:#a6e22e\">root<\/span>): <span style=\"color:#a6e22e\">cptest<\/span>\n  <span style=\"color:#ae81ff\">331<\/span> <span style=\"color:#a6e22e\">Password<\/span> <span style=\"color:#a6e22e\">required<\/span> <span style=\"color:#66d9ef\">for<\/span> <span style=\"color:#a6e22e\">cptest<\/span>\n  <span style=\"color:#a6e22e\">Password<\/span>:\n  <span style=\"color:#ae81ff\">530<\/span> <span style=\"color:#a6e22e\">Access<\/span> <span style=\"color:#a6e22e\">denied<\/span>\n  <span style=\"color:#a6e22e\">ftp<\/span>: <span style=\"color:#a6e22e\">Login<\/span> <span style=\"color:#a6e22e\">failed<\/span>\n  <span style=\"color:#a6e22e\">ftp<\/span>&gt; <span style=\"color:#a6e22e\">quit<\/span>\n  <span style=\"color:#ae81ff\">221<\/span> <span style=\"color:#a6e22e\">Goodbye<\/span>.\n  <\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div><\/div>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"virtualhost-container-example\">VirtualHost container example<\/h2>\n<p>The following example resembles a complete VirtualHost container.<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-GO\" data-lang=\"GO\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 2\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 3\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 4\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 5\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 6\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 7\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 8\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 9\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">10\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-GO\" data-lang=\"GO\">&lt;<span style=\"color:#a6e22e\">VirtualHost<\/span> <span style=\"color:#ae81ff\">10.1.1.1<\/span>&gt;\n <span style=\"color:#a6e22e\">ServerName<\/span> <span style=\"color:#a6e22e\">ftp<\/span>.<span style=\"color:#a6e22e\">testserver<\/span>.<span style=\"color:#a6e22e\">tld<\/span>\n <span style=\"color:#a6e22e\">AuthUserFile<\/span> <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">etc<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">proftpd<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">wcraft<\/span>\n <span style=\"color:#a6e22e\">MaxClients<\/span> <span style=\"color:#ae81ff\">3<\/span> <span style=\"color:#e6db74\">\"Sorry, this ftp server has reached its maximum user count (%m). Please try again later\"<\/span>\n <span style=\"color:#a6e22e\">DirFakeGroup<\/span> <span style=\"color:#a6e22e\">On<\/span> <span style=\"color:#a6e22e\">ftpgroup<\/span>\n <span style=\"color:#a6e22e\">DirFakeUser<\/span> <span style=\"color:#a6e22e\">On<\/span> <span style=\"color:#a6e22e\">ftpuser<\/span>\n <span style=\"color:#a6e22e\">DefaultRoot<\/span> <span style=\"color:#960050;background-color:#1e0010\">~<\/span>\n<span style=\"color:#a6e22e\">TCPAccessFiles<\/span> <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">etc<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">hosts<\/span>.<span style=\"color:#a6e22e\">allow<\/span> <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">etc<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">hosts<\/span>.<span style=\"color:#a6e22e\">deny<\/span>\n <span style=\"color:#a6e22e\">TCPServiceName<\/span> <span style=\"color:#a6e22e\">ftp<\/span>\n[<span style=\"color:#a6e22e\">truncated<\/span>]<\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview This document provides an example of how to configure ProFTPd to utilize the Host Access Control feature from the command line to restrict access by IP address to FTP. The information in this document applies to systems that run cPanel &#038; WHM in CentOS 7, CloudLinux\u2122 7, and Red Hat\u00ae Enterprise Linux\u00ae 7 and &hellip;<\/p>\n","protected":false},"author":1,"featured_media":568,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/567"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=567"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/567\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/568"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}