SlashRhumSlashNeisson Apprentice
Joined: 30 Dec 2006 Posts: 201 Location: Lille
|
Posted: Mon Aug 25, 2008 11:23 am Post subject: [PROFTPD] Règles IPTABLES correctes avec OPENWRT |
|
|
Bonjour à tous,
Après avoir parcouru pas mal de sujet sur openwrt et en autre la définition des règles iptables dans
http://wiki.openwrt.org/OpenWrtDocs/WhiteRussian/Configuration#head-f75305e7f78bdd5dac537564851e5a06a448cb95
L'objectif et d'avoir un server ftp accessible depuis l'extérieur avec des règles correctes.
Mon proftpd.conf:
Code: |
ServerName "ProFTPD SERVER"
ServerIdent on "Va voir ailleurs si j'y suis"
ServerType standalone
DefaultServer on
DeferWelcome off
RequireValidShell off
AuthPAM on
AuthPAMConfig ftp
RootLogin off
Port xxxxx
MasqueradeAddress yy.yyy.yyy.yyy
PassivePorts uuuuu vvvvv
IdentLookups off
UseReverseDNS off
# Log définitions
LogFormat default "%s %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
LogFormat write "%h %l %u %t \"%r\" %s %b"
SyslogFacility AUTH
# End log définitions
ExtendedLog /var/log/proftpd/access.log WRITE,READ write
ExtendedLog /var/log/proftpd/auth.log AUTH auth
ExtendedLog /var/log/ftp.log AUTH
Umask 022
MaxInstances 5
MaxLoginAttempts 3
#DefaultRoot /home/ftp
<Global>
DefaultRoot ~
</Global>
User nobody
Group nogroup
# Normally, we want files to be overwriteable.
<Directory />
AllowOverwrite off
</Directory>
# A basic anonymous configuration, with no upload directories.
<Anonymous /home/ftp/pub>
User ftp
Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp".
UserAlias anonymous ftp
# Limit the maximum number of anonymous logins.
MaxClients 2
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayChdir .message
# Limit WRITE everywhere in the anonymous chroot.
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>
|
ma conf LAN: INTERNET --> FREEBOX -->WRT54GL --> Server
Code: |
IPRouteur: 192.168.1.1
IPServer: 192.168.1.102
|
Mes règles sous openwrt
Code: | # vi /etc/firewall.user |
Code: |
## -- This allows port ftp to be answered by (dropbear on) the router
iptables -t nat -A prerouting_wan -p tcp --dport xxxxx -j ACCEPT
iptables -A input_wan -p tcp --dport xxxxx -j ACCEPT
iptables -t nat -A prerouting_rule -d yy.yyy.yyy.yyy -p tcp --dport xxxxx -j DNAT --to IPServer
iptables -A forwarding_rule -p tcp --dport xxxxx -d IPServer -j ACCEPT
iptables -t nat -A postrouting_rule -s 192.168.1.100/24 -p tcp --dport xxxxx -d IPServer -j MASQUERADE
iptables -t nat -A prerouting_wan -p tcp --dport uuuuu:vvvvv -j ACCEPT
iptables -A input_wan -p tcp --dport uuuuu:uuuuu -j ACCEPT
iptables -t nat -A prerouting_rule -d yy.yyy.yyy.yyy -p tcp --dport uuuuu:vvvvv -j DNAT --to IPServer
iptables -A forwarding_rule -p tcp --dport uuuuu:vvvvv -d IPServer -j ACCEPT
iptables -t nat -A postrouting_rule -s 192.168.1.100/24 -p tcp --dport uuuuu:vvvvv -d IPServer -j MASQUERADE
|
J'ai bien les modules ip_conntrack_ftp et ip_nat_ftp chargé dans le routeur
Scenarii:
1) ma connection en ftp dans mon LAN -->OK
2) ma connection en ftp depuis l'extérieur --> OK
Ma question est de savoir si mes règles IPTABLES vous semblent correctes et je suis ok pour vos remarques afin de les optimiser au mieux _________________ Gentoo only |
|