This is driving me crazy I really really hope someone can help me out.
I had proftpd running and working (with the default port 21).
But now I want to use IPTABLES in combination with a different FTP port.
I have the following
- ip_conntrack_ftp , modprobe ip_conntrack and ip_nat_ftp
I added these modules by in my "/etc/modules" file (1 module per line) and rebooted my UBUNTU VPS
- My iptables looks like this: http://vpsbible.com/security/harden-...eate-firewall/
I added one extra rule (don't mind the below port number, I used another valid one)
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allows all outbound traffic
# You can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Allows SSH connections
# THE -dport NUMBER IS THE SAME ONE YOU SET UP IN THE SSHD_CONFIG FILE
-A INPUT -p tcp -m state --state NEW --dport 30000 -j ACCEPT
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT
In my proftpd configuration file I have correctly changed the default port from 21 to 12345.
-A INPUT -p tcp --dport 12345 -j ACCEPT
- My "/etc/network/interfaces" has the correct ipatables file: "pre-up iptables-restore < /etc/iptables.up.rules"
I seem to connect to my server to a certain degree but when the server connection procedure hits the following procedure
"Enerting passive mode" , "Get directory"
I get the below error
"500 Illegal port command"
"PORT command failed"
(I tried passive and active way in total commander I also tried in winscp but I also get errors there)
If I change back the default port to 21 (in the proftpd configuration file) I can not connect, which makes sense, because I havent made an exception in my firewall.
So if I add the port 21 in my iptables (see below) I can can connect AND upload/download files.
-A INPUT -p tcp --dport 21 -j ACCEPT
What am I missing? What am I doing wrong?