Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /usr/share/doc/proftpd-doc/howto/ drwxr-xr-x |
Viewing file: Select action/file-type: ProFTPD: Connection ACLs
Many sites running
However, there is one important thing to note: ProFTPD is not a firewall.
Never forget this. You cannot prevent TCP connections from ever
reaching
For example, you can simply reject all connections to your <Limit LOGIN> DenyAll </Limit>A more practical example would look like: <Limit LOGIN> # These are trusted addresses Allow from 1.2.3.4 5.6.7.8 Allow from trusted-domain.com # Everyone else is denied DenyAll </Limit> The above configuration demonstrates the concept of a whitelist: known trusted (i.e. "white") addresses are explicitly listed and allowed, and all others are denied. Conversely, you might use a blacklist, where known bad/malicious/untrusted (i.e. "black") addresses are explicitly listed and denied, and all others are allowed: <Limit LOGIN> Order deny,allow # These are known bad addresses Deny from 1.2.3.4 5.6.7.8 Deny from evil-domain.com # Everyone else is allowed AllowAll </Limit> It is useful to know about whitelists versus blacklists, as it can affect how large your ACLs become. Sites which run publicly available FTP servers but which need to weed out bad clients tend to use blacklists; over time, these blacklists can become quite large. Sites which know who will be using their FTP server and only want those people to be able to connect will use whitelists; these whitelists tend to remain fairly small/short.
Large Blacklists
<Limit LOGIN>
Order deny,allow
# -- Add blacklisted addresses here --
Deny from ...
Deny from ...
# Many more
Over time, your number of blacklisted IP addresses starts to become large
and unwieldy. You might have thousands of such addresses; you notice that
proftpd starts acting strangely, and starts slowing down.
When this happens, you should start looking for ways to make your list shorter. If your list is comprised of entries for each individual IP address, you should think about using glob expressions and netmasks to reduce the number of entries. For example, rather than using something like this: Deny from 1.2.3.4 Deny from 1.2.3.5 Deny from 1.2.3.6 Deny from 1.2.3.7 Deny from 1.2.3.8 Deny from 1.2.3.9you could (as of proftpd-1.3.4rc1 and later) use a range:
Deny 1.2.3.[4-9]or even use a glob wildcard such as this, which makes for even fewer entries in your address lists: Deny 1.2.3.*Or you could use netmasks such as: Deny 1.2.3.0/8
Using Classes
To do this, you would rewrite your large
<Class blacklist>
# Put all of your blacklisted address/range lines here, as
Why does using classes like this make things faster? When using classes, the
label (i.e. the class name in the When you do not use classes, then proftpd scans each configuration, each netmask/address for each command. That's why things slow down so much.
Alternatives
You can use a module like
And if you find yourself starting to block large blocks of addresses from
countries/regions, you should start thinking about connection ACLs in terms of
geolocation information. For this, the |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0036 ]-- |