# Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT
#ssh port -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#vsftpd -A INPUT -p TCP --dport 61001:62000 -j ACCEPT -A OUTPUT -p TCP --sport 61001:62000 -j ACCEPT
-A INPUT -p TCP --dport 20 -j ACCEPT -A OUTPUT -p TCP --sport 20 -j ACCEPT -A INPUT -p TCP --dport 21 -j ACCEPT -A OUTPUT -p TCP --sport 21 -j ACCEPT
#mysql port -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
#tomcat remote debug port -A INPUT -p tcp -m tcp --dport 5005 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
重启防火墙:
1 2 3
[czh@centos6 vsftpd]$ sudo service iptables restart [sudo] password for czh: iptables: Applying firewall rules: [ OK ]
修改selinux:解决外网是可以访问上去了,可是发现没法返回目录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[czh@centos6 ftpfile]$ getsebool -a | grep ftp allow_ftpd_anon_write --> off allow_ftpd_full_access --> off allow_ftpd_use_cifs --> off allow_ftpd_use_nfs --> off ftp_home_dir --> off ftpd_connect_db --> off ftpd_use_fusefs --> off ftpd_use_passive_mode --> off httpd_enable_ftp_server --> off tftp_anon_write --> off tftp_use_cifs --> off tftp_use_nfs --> off [czh@centos6 ftpfile]$ setsebool -P allow_ftpd_full_access on Cannot set persistent booleans without managed policy. [czh@centos6 ftpfile]$ sudo setsebool -P allow_ftpd_full_access on [sudo] password for czh: [czh@centos6 ftpfile]$ sudo setsebool -P ftp_home_dir on [czh@centos6 ftpfile]$
防止匿名账户不能创建更改文件情况:
1 2 3
[czh@centos6 ftpfile]$ sudo vim /etc/selinux/config [czh@centos6 ftpfile]$ sudo setenforce 0 [czh@centos6 ftpfile]$ sudo service vsftpd restart