2017-05-16 30 views
10

이것이 나에게 영향을 미치지 만, 어떤 이유로 외부에서 특정 포트에 액세스 할 수 없습니다. 가능한 모든 설정을 확인했지만 이것이 작동하지 않는 이유는 알 수 없습니다. 나는이 문제 (Ubuntu firewall 대 Dockcot 대 Postfix)를 어디에서 고칠 지 잘 모르겠다. 너희들이 나를 도울 수 있기를 정말로 바라고있다.일부 노출 된 Docker 포트는 외부에서 접근 할 수 없습니다. (dovecot, postfix)

참고 : mycooldomain.com은 현재 공유하고 싶지 않은 내 도메인의 자리 표시 자일뿐입니다.

나는 그것을 고치는 데 도움이되는 사람을 위해 맥주를 살 것이다! :) 내 루트 서버에

짧은 소개

, 나는 몇 가지 포트 (143, 25, 587, 993)을 노출하는 다음과 같은 고정 표시기 메일 서버 컨테이너 (https://github.com/tomav/docker-mailserver/)를 실행하고 있습니다. 컨테이너는 dovecot (IMAP) 및 postfix (SMTP)를 실행합니다.

TL; DR

는 I는 고정 표시기 용기에서 실행되는 상기 메일 서버 (비둘기장, 포스트 픽스)가 오직 하나 개의 포트 (143 - IMAP)에 연결할 수있다. 다른 포트 25, 587 및 993은 외부에서 액세스 할 수 없으며 호스트에서만 직접 액세스 할 수 있습니다. Docker는 올바르게 표시하고 iptables에 올바르게 나열됩니다. 컨테이너 (dovecot, postfix)의 로그는 요청이 들어 왔을 때 어떤 반응도 보이지 않으므로 (거부 된 요청이나 그런 요청이 없음), 컨테이너에서 서비스에 도달하지 못했다고 가정합니다. 다른 도커 컨테이너 포트 (예 : 내 웹 서버 : 80, 443).

내가 직접 호스트에서 모든 포트에 연결할 수 있습니다

는 (의는 IMAP 보안 포트 테스트하자) : 내 로컬 컴퓨터에서

[email protected]:~$ telnet mail.mycooldomain.com 993 
Trying xxx.xxx.xxx.xxx… 
Connected to mail.mycooldomain.com. 
Escape character is '^]'. 
220 mail.mycooldomain.com ESMTP Postfix (Ubuntu) 

하지만하지 :

여기 자세한 정보입니다

mastixmc$ telnet mail.mycooldomain.com 993 Trying xxx.xxx.xxx.xxx… telnet:connect to address xxx.xxx.xxx.xxx: Operation timed out telnet: Unable to connect to remote host 

docker-compose ps은 내가 이라고 표시합니다. a 차 제대로 바인딩 :

110/tcp, 
0.0.0.0:143-143/tcp, 
0.0.0.0:25->25/tcp, 4190/tcp,  
0.0.0.0:587->587/tcp,    
0.0.0.0:993->993/tcp, 995/tcp 

netstat -ntlp 나에게 같은 이야기 :

Proto Recv-Q Send-Q Local Address   Foreign Address   State  PID/Program name 
tcp6  0  0 :::587     :::*     LISTEN  - 
tcp6  0  0 :::143     :::*     LISTEN  - 
tcp6  0  0 :::80     :::*     LISTEN  - 
tcp6  0  0 :::25     :::*     LISTEN  - 
tcp6  0  0 :::443     :::*     LISTEN  - 
tcp6  0  0 :::2332     :::*     LISTEN  - 
tcp6  0  0 :::993     :::*     LISTEN  - 

내 웹 서버 (80/443) 및 비보안 IMAP (143)에 액세스 할 수 - 난에서 허용하지 것이다 미래. 그러나 다른 모든 포트는 액세스 할 수 없습니다.

난 우분투 아무것도 차단하지 않습니다 있는지 확인 UFW (즉, 필요하지 비록) 설정 :

Added user rules (see 'ufw status' for running firewall): 
ufw allow 80/tcp 
ufw allow 443/tcp 
ufw allow 25/tcp 
ufw allow 587/tcp 
ufw allow 143/tcp 
ufw allow 993/tcp 

로그 (Dovecot과, 후위) 나는 어떤 정보가 표시되지 않습니다보고 요청이 서비스에 도달하지 않은 것처럼 보입니다.

DEFAULT_FORWARD_POLICY="DROP" 

그리고 UFW

은/etc/기본/DID가 아닌 고정 표시기 엔진 변화 iptables = false : I

터치 다음 도커/UFW 설정하지 않았다. 당신이 고정 표시기 체인 (또한 내 UFW 규칙이있다) 제대로 규칙을 추가하는 것을 분명히 볼 수있는

는 여기에서 iptables에 전화 -L입니다 :

Chain INPUT (policy ACCEPT) 
target  prot opt source    destination 
ufw-before-logging-input all -- anywhere    anywhere 
ufw-before-input all -- anywhere    anywhere 
ufw-after-input all -- anywhere    anywhere 
ufw-after-logging-input all -- anywhere    anywhere 
ufw-reject-input all -- anywhere    anywhere 
ufw-track-input all -- anywhere    anywhere 

Chain FORWARD (policy DROP) 
target  prot opt source    destination 
DOCKER-ISOLATION all -- anywhere    anywhere 
DOCKER  all -- anywhere    anywhere 
ACCEPT  all -- anywhere    anywhere    ctstate RELATED,ESTABLISHED 
ACCEPT  all -- anywhere    anywhere 
ACCEPT  all -- anywhere    anywhere 
DOCKER  all -- anywhere    anywhere 
ACCEPT  all -- anywhere    anywhere    ctstate RELATED,ESTABLISHED 
ACCEPT  all -- anywhere    anywhere 
ACCEPT  all -- anywhere    anywhere 
DOCKER  all -- anywhere    anywhere 
ACCEPT  all -- anywhere    anywhere    ctstate RELATED,ESTABLISHED 
ACCEPT  all -- anywhere    anywhere 
ACCEPT  all -- anywhere    anywhere 
ufw-before-logging-forward all -- anywhere    anywhere 
ufw-before-forward all -- anywhere    anywhere 
ufw-after-forward all -- anywhere    anywhere 
ufw-after-logging-forward all -- anywhere    anywhere 
ufw-reject-forward all -- anywhere    anywhere 
ufw-track-forward all -- anywhere    anywhere 

Chain OUTPUT (policy ACCEPT) 
target  prot opt source    destination 
ufw-before-logging-output all -- anywhere    anywhere 
ufw-before-output all -- anywhere    anywhere 
ufw-after-output all -- anywhere    anywhere 
ufw-after-logging-output all -- anywhere    anywhere 
ufw-reject-output all -- anywhere    anywhere 
ufw-track-output all -- anywhere    anywhere 

Chain DOCKER (3 references) 
target  prot opt source    destination 
ACCEPT  tcp -- anywhere    172.19.0.3   tcp dpt:https 
ACCEPT  tcp -- anywhere    172.19.0.3   tcp dpt:http 
ACCEPT  tcp -- anywhere    172.19.0.7   tcp dpt:imaps 
ACCEPT  tcp -- anywhere    172.19.0.7   tcp dpt:submission 
ACCEPT  tcp -- anywhere    172.19.0.7   tcp dpt:imap2 
ACCEPT  tcp -- anywhere    172.19.0.7   tcp dpt:smtp 

Chain DOCKER-ISOLATION (1 references) 
target  prot opt source    destination 
DROP  all -- anywhere    anywhere 
DROP  all -- anywhere    anywhere 
DROP  all -- anywhere    anywhere 
DROP  all -- anywhere    anywhere 
DROP  all -- anywhere    anywhere 
DROP  all -- anywhere    anywhere 
RETURN  all -- anywhere    anywhere 
[...] 
Chain ufw-user-input (1 references) 
target  prot opt source    destination 
ACCEPT  tcp -- anywhere    anywhere    tcp dpt:imaps 
ACCEPT  udp -- anywhere    anywhere    udp dpt:imaps 
ACCEPT  tcp -- anywhere    anywhere    tcp dpt:2332 
ACCEPT  udp -- anywhere    anywhere    udp dpt:2332 
ACCEPT  tcp -- anywhere    anywhere    tcp dpt:http 
ACCEPT  udp -- anywhere    anywhere    udp dpt:http 
ACCEPT  tcp -- anywhere    anywhere    tcp dpt:https 
ACCEPT  udp -- anywhere    anywhere    udp dpt:https 
ACCEPT  tcp -- anywhere    anywhere    tcp dpt:submission 
ACCEPT  udp -- anywhere    anywhere    udp dpt:submission 
ACCEPT  tcp -- anywhere    anywhere    tcp dpt:http 
ACCEPT  tcp -- anywhere    anywhere    tcp dpt:imap2 
ACCEPT  udp -- anywhere    anywhere    udp dpt:imap2 

그래서 모든 것이 나에게 올바른 보인다.

업데이트 # 1 : 내 로컬 컴퓨터에서

PORT STATE SERVICE 
25/tcp filtered smtp 
80/tcp filtered http 
143/tcp filtered imap 
443/tcp filtered https 
587/tcp filtered submission 
993/tcp filtered imaps 

nmap은 (mycooldomain.com에 대한) :

PORT STATE SERVICE 
80/tcp open http 
143/tcp open imap 
443/tcp open https 
(mycooldomain.com에 대한) 고정 표시기 호스트에서

의 nmap

포트가 열려 있지 않으므로 원격에서 포트 25, 587 및 993에 연결할 수 없습니다.

업데이트 # 2 :

그래서 나는 모든 컨테이너를 중지하고 간단한 파이썬 HTTP 서버를 openend했습니다

sudo python -m SimpleHTTPServer 993 

는 또한이 포트에 액세스 할 수 없습니다. 그래서 포트 8080 => 성공으로 동일한 서버를 열었습니다.

우분투 또는 내 호스트가 포트 993을 차단하고있는 것 같습니다. 나는 현재 루트 서버를 제공하는 사람과 접촉하고있다.

이미 프로젝트 자체에 문제를 제기했지만 (https://github.com/tomav/docker-mailserver/issues/602) 그들은 저를 도울 수 없습니다.

내가 그것을 고정 ... 적어도 내 호스팅했던, 사전에 당신에게

Greetz,

샤샤

+1

고정 표시기없이 원격 액세스를 사용할 수 있습니까? 비 작동 포트에서 도커를 사용하여 아무 것도 실행할 수 없으며 연결을 시도 할 수 있습니까? 어쩌면 주인이 일부 항구를 막고있을 수도 있습니다. 'nmap' 스캔 결과도 흥미로울 것입니다. – fzgregor

+0

물론 SSH 데몬은 접근 가능한 상태로 실행 중입니다.원격 (예 : 포트 80 및 443에서 수신하는 역방향 프록시)에서 액세스 할 수있는 다른 도커 컨테이너가 있습니다. 이 답장 직후 nmap 포트 검사 결과를 추가합니다. – Sascha

+0

나는 현재 hoster와 접촉하여 메일 서버 포트를 차단하는지 여부를 확인합니다. – Sascha

답변

2

를 대단히 감사합니다. 특정 포트를 차단하는 다른 하드웨어 방화벽이있었습니다. 특정 메일 서버 방화벽 룰 세트를 활성화해야만 메일 서버를 실행할 수있었습니다.

도움과 의견을 보내 주셔서 감사합니다.

Greetz,

샤샤