[РЕШЕНО] не пускает на FTP извне
Добрый день, уважаемые гуру.
уже 3-й день бьюсь над проблемой - фантазия закончилась, поэтому нужна ваша помосчь.
в общем суть:
два сервака на Gentoo: 1 - шлюз, 2 - ФТП.
по политике безопасности, жестко ограничили доступ извне.
вот настройки:
Шлюз
iptables -t nat -A PREROUTING -d x.x.x.x -i eth2 -p tcp -m tcp -m multiport --ports 21,20,56000:58000 -m comment "Access for FTP" -j ftp_access
iptables -t nat -A ftp_access -s y.y.y.y -i eth2 -m comment --comment "access from YYYY" -j DNAT --to-destination 10.a.a.a
в логах на фтп:
Thu Jul 20 13:28:59 2017 [pid 1] [user] OK LOGIN: Client "b.b.b.b"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "230 Login successful."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "OPTS utf8 on"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Always in UTF8 mode."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "SYST"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "215 UNIX Type: L8"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "SITE help"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "214 CHMOD UMASK HELP"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PWD"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "257 "/""
Thu Jul 20 13:28:59 2017 [pid 1] [user] OK LOGIN: Client "b.b.b.b"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "230 Login successful."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "OPTS utf8 on"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Always in UTF8 mode."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "SYST"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "215 UNIX Type: L8"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "SITE help"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "214 CHMOD UMASK HELP"
Thu Jul 20 13:28:59 2017 [pid 1] [user] OK LOGIN: Client "b.b.b.b"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PWD"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "257 "/""
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "230 Login successful."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "TYPE A"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Switching to ASCII mode."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "OPTS utf8 on"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Always in UTF8 mode."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PASV"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "227 Entering Passive Mode (10,a,a,a,225,40)."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PWD"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "257 "/""
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "TYPE A"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Switching to ASCII mode."
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PASV"
Thu Jul 20 13:28:59 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "227 Entering Passive Mode (10,a,a,a,223,229)."
причем почему-то логи дублируются, хотя попытка была всего одна.
Еще момент - ФТП работает из TotalComander'а
активный режим:
Thu Jul 20 13:36:20 2017 [pid 2] FTP command: Client "b.b.b.b", "USER user"
Thu Jul 20 13:36:20 2017 [pid 2] [user] FTP response: Client "b.b.b.b", "331 Please specify the password."
Thu Jul 20 13:36:34 2017 [pid 2] [user] FTP command: Client "b.b.b.b", "PASS
Thu Jul 20 13:36:34 2017 [pid 1] [user] OK LOGIN: Client "b.b.b.b"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "230 Login successful."
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "SYST"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "215 UNIX Type: L8"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "FEAT"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "211-Features:"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " EPRT??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " EPSV??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " MDTM??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " PASV??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " REST STREAM??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " SIZE??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " TVFS??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " UTF8??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "211 End"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "HELP SITE"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "214-The following commands are recognized."
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " ABOR ACCT ALLO APPE CDUP CWD DELE EPRT EPSV FEAT HELP LIST MDTM MKD??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " MODE NLST NOOP OPTS PASS PASV PORT PWD QUIT REIN REST RETR RMD RNFR??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " XPWD XRMD??"
Thu Jul 20 13:36:34 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "214 Help OK."
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "OPTS UTF8 ON"
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Always in UTF8 mode."
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PWD"
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "257 "/""
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "TYPE A"
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Switching to ASCII mode."
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PORT 94,232,52,69,237,225"
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 PORT command successful. Consider using PASV."
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "LIST"
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "150 Here comes the directory listing."
Thu Jul 20 13:36:35 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "226 Directory send OK."
пассивный режим:
Thu Jul 20 13:42:01 2017 [pid 2] FTP command: Client "b.b.b.b", "USER user"
Thu Jul 20 13:42:01 2017 [pid 2] [user] FTP response: Client "b.b.b.b", "331 Please specify the password."
Thu Jul 20 13:42:08 2017 [pid 2] [user] FTP command: Client "b.b.b.b", "PASS
Thu Jul 20 13:42:08 2017 [pid 1] [user] OK LOGIN: Client "b.b.b.b"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "230 Login successful."
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "SYST"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "215 UNIX Type: L8"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "FEAT"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "211-Features:"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " EPRT??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " EPSV??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " MDTM??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " PASV??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " REST STREAM??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " SIZE??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " TVFS??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " UTF8??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "211 End"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "HELP SITE"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "214-The following commands are recognized."
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " ABOR ACCT ALLO APPE CDUP CWD DELE EPRT EPSV FEAT HELP LIST MDTM MKD??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " MODE NLST NOOP OPTS PASS PASV PORT PWD QUIT REIN REST RETR RMD RNFR??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", " XPWD XRMD??"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "214 Help OK."
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "OPTS UTF8 ON"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Always in UTF8 mode."
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PWD"
Thu Jul 20 13:42:08 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "257 "/""
Thu Jul 20 13:42:09 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "TYPE A"
Thu Jul 20 13:42:09 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "200 Switching to ASCII mode."
Thu Jul 20 13:42:09 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "PASV"
Thu Jul 20 13:42:09 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "227 Entering Passive Mode (10,a,a,a,221,58)."
Thu Jul 20 13:42:09 2017 [pid 3] [user] FTP command: Client "b.b.b.b", "LIST"
Thu Jul 20 13:42:09 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "150 Here comes the directory listing."
Thu Jul 20 13:42:09 2017 [pid 3] [user] FTP response: Client "b.b.b.b", "226 Directory send OK."
народ, помогите плиз, уже и не знаю что делать, все варианты перепробовал.
клиенты должны подключаться к ФТП через проводник и из программы, в которой есть возможность использовать и активный и пассивный режим.
- Для комментирования войдите или зарегистрируйтесь
/
Замечание с точки зрения общего метода:
На шлюзе политика NAT у тебя какая?
Пакеты не попадающие в правила как-то отслеживаешь?
:wq
--
Live free or die
вообще ACCEPT везде
вообще ACCEPT везде
Покажи zgrep -i conn
Покажи
а также все правила
iptables
и таблицу(ы) маршрутизации на шлюзе. Из данных обрывков ничего не ясно.P.S. Если у тебя паранойя - замени СЕД'ом внешний адрес на
ExtAddr
:)P.P.S. Кстати, локально через шлюз, но без НАТа все работает?
gw~# zgrep -i conn
gw~# zgrep -i conn /proc/config.gz
CONFIG_NF_CONNTRACK=m
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_ZONES=y
CONFIG_NF_CONNTRACK_PROCFS=y
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_TIMEOUT=y
CONFIG_NF_CONNTRACK_TIMESTAMP=y
CONFIG_NF_CONNTRACK_LABELS=y
CONFIG_NF_CONNTRACK_AMANDA=m
CONFIG_NF_CONNTRACK_FTP=m
CONFIG_NF_CONNTRACK_H323=m
CONFIG_NF_CONNTRACK_IRC=m
CONFIG_NF_CONNTRACK_BROADCAST=m
CONFIG_NF_CONNTRACK_NETBIOS_NS=m
CONFIG_NF_CONNTRACK_SNMP=m
CONFIG_NF_CONNTRACK_PPTP=m
CONFIG_NF_CONNTRACK_SANE=m
CONFIG_NF_CONNTRACK_SIP=m
CONFIG_NF_CONNTRACK_TFTP=m
CONFIG_NETFILTER_XT_CONNMARK=m
CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m
CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
CONFIG_NF_CONNTRACK_IPV4=m
CONFIG_NF_CONNTRACK_PROC_COMPAT=y
CONFIG_CONNECTOR=y
A lsmod|grep conn?
A
?
gw ~ # lsmod | grep
gw ~ # lsmod | grep conn
nf_conntrack_ipv4 12411 1
nf_defrag_ipv4 1267 1 nf_conntrack_ipv4
nf_conntrack_ftp 6775 0
nf_conntrack 66106 5 nf_nat,nf_nat_ipv4,nf_conntrack_ftp,iptable_nat,nf_conntrack_ipv4
Вроде бы все нормально...
Вроде бы все нормально... далее без инфы из http://www.gentoo.ru/node/29394#comment-217829 и логов файервола гадать бессмысленно.
Так как там без НАТ'а?
Так как там без НАТ'а?
autoreconnect?..
autoreconnect?.. :)
без NATa через шлюз работает,
без NATa через шлюз работает, по VPN цепляются.
http://www.gentoo.ru/node/293
http://www.gentoo.ru/node/29394#comment-217835
Проверь значение
Проверь значение net.netfilter.nf_conntrack_helper в sysctl - в новых ядрах оно отключено и FTP будет ломаться
Нейтральность - высшее достижение сознания!
РЕШЕНО
всем спасибо за помощь, узнал новые вещи.
проблема была в антивире. он не подхватывал доменные настройки, и работал на дефалтовых, вот и не пускал никуда))))