Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[PROFTPD] Règles IPTABLES correctes avec OPENWRT
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
SlashRhumSlashNeisson
Apprentice
Apprentice


Joined: 30 Dec 2006
Posts: 201
Location: Lille

PostPosted: Mon Aug 25, 2008 11:23 am    Post subject: [PROFTPD] Règles IPTABLES correctes avec OPENWRT Reply with quote

Bonjour à tous,

Après avoir parcouru pas mal de sujet sur openwrt et en autre la définition des règles iptables dans
Code:
/etc/firewall.user


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. :wink:

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 :wink:

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 :idea:
_________________
Gentoo only
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum