Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect #551

Closed
ekkis opened this issue Mar 17, 2017 · 7 comments
Closed

Unable to connect #551

ekkis opened this issue Mar 17, 2017 · 7 comments
Labels

Comments

@ekkis
Copy link

@ekkis ekkis commented Mar 17, 2017

I've started the container using docker-compose as suggested. successfully added an account:

$ setup.sh email list

admin@whatever.io

but when I try to telnet into the server (I want to follow something like: http://commandlinemac.blogspot.com/2008/12/smtp-testing-from-command-line.html) I just get immediately disconnected

$ telnet localhost 25

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

what could the issue here be?

@ekkis
Copy link
Author

@ekkis ekkis commented Mar 18, 2017

just for kicks I configured my mail client to try to connect to localhost. I tried using both "admin@whatever.io" and "admin" for the user name (both failed). tried port 587, with and without SSL (both failed), port 25. no can do. it cannot connect

@ekkis
Copy link
Author

@ekkis ekkis commented Mar 18, 2017

also, I've exec'd into the container (telnet's not available but nc is) and tried this:

# echo -e "EHLO whatever.io\nAUTH PLAIN MDBhZG1pbjAwbjBtNGlsLXBhc3Mt\n" |nc localhost 25

220 mail.whatever.io ESMTP Postfix (Ubuntu)
250-mail.whatever.io
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
535 5.7.8 Error: authentication failed:
500 5.5.2 Error: bad syntax

where the parameter to AUTH PLAIN was generated like this (notice I'm using only "admin" as the account name ("admin@whatever.io" produces similar results)):

perl -MMIME::Base64 -e 'print encode_base64("00admin00mypass")'

help?

@ekkis
Copy link
Author

@ekkis ekkis commented Mar 18, 2017

more thrashing about. I changed my docker-compose.yml to look like this:

  mail:
    image: tvial/docker-mailserver:2.1
    hostname: mail
    domainname: mydomain.com
    container_name: mail
    ports:
    - "25:25"
    - "587:587"
    volumes:
    - ./mail/data:/var/mail
    - ./mail/state:/var/mail-state
    - ./mail/config:/tmp/docker-mailserver/
    environment:
    - ENABLE_SPAMASSASSIN=1
    - ENABLE_CLAMAV=1
    - ENABLE_FAIL2BAN=1
    - ENABLE_POSTGREY=1
    - ONE_DIR=1
    - DMS_DEBUG=1
    - SMTP_ONLY=1
    - SSL_TYPE=self-signed
    - ENABLE_SASLAUTHD=1
    - PERMIT_DOCKER=host
    cap_add:
    - NET_ADMIN

so as you can see, I turned debugging on, made the server SMTP only (I only need it to send mail), turned on SSL (with a self-signed cert), and enabled SASL's AUTHD. I also found PERMIT_DOCKER, which I believe means it can share services with my docker host (from where I'm performing the testing)

I rebuilt the image like this:

docker-compose up -d --no-deps --build mail
and verified that the running container now has only 2 ports mapped. and attempted again to test using telnet. as before, it just hangs up on me.

I also tried connecting using openssl but that didn't go very well either:

$ openssl s_client -starttls smtp -crlf -connect localhost:25

> CONNECTED(00000003)
> didn't found starttls in server response, try anyway...
> 140735150669904:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177:
> ---
> no peer certificate available
> ---
> No client certificate CA names sent
> ---
> SSL handshake has read 0 bytes and written 343 bytes
> ---
> New, (NONE), Cipher is (NONE)
> Secure Renegotiation IS NOT supported
> Compression: NONE
> Expansion: NONE
> No ALPN negotiated
> SSL-Session:
>     Protocol  : TLSv1.2
>     Cipher    : 0000
>     Session-ID: 
>     Session-ID-ctx: 
>     Master-Key: 
>     Key-Arg   : None
>     PSK identity: None
>     PSK identity hint: None
>     SRP username: None
>     Start Time: 1489800209
>     Timeout   : 300 (sec)
>     Verify return code: 0 (ok)
> ---

I also found that my previous Base64 encryption was messed up. this is correct:

perl -MMIME::Base64 -e 'print encode_base64("\000admin\000mypass")'

but when trying it I get authentication failures:

535 5.7.8 Error: authentication failed: authentication failure

for both the account name "admin" and the fully-qualified version:

perl -MMIME::Base64 -e 'print encode_base64("\000admin\@whatever.io\000mypass")'

so I just can't get this to work

@ekkis
Copy link
Author

@ekkis ekkis commented Mar 18, 2017

all right. enough aggravation with this. I found something that actually just works: sudo docker pull catatnight/postfix

@ekkis ekkis closed this Mar 18, 2017
@ekkis ekkis reopened this Mar 18, 2017
@ekkis
Copy link
Author

@ekkis ekkis commented Mar 18, 2017

I closed the issue but, actually, I think I'll leave it open. I'm happy to work with whomever wants to help to see if we can figure it out and help the project

@tomav
Copy link
Owner

@tomav tomav commented Mar 18, 2017

Hi @ekkis,

There are a lot of comments so I'm gonna try to answer as I can.

  • In your first comment, connection is refused in IPv6 but worked in IPv4. So that's ok.
  • Username are full address email as stated in the Wiki.
  • These scripts may help to test authentication through telnet or netcat
  • If you just need a SMTP, you're right, you will find other docker images for that. This image is useful if you want to setup a full mail server.
  • If you need more help, please follow the Guidelines => configuration + startup debug log

Let me know if I can help.

@tomav tomav added the question label Mar 18, 2017
@tomav
Copy link
Owner

@tomav tomav commented Mar 27, 2017

Hi @ekkis, without news from you, I close this issue.
Feel free to reopen with necessary items and we'll help you.
Thanks.

@tomav tomav closed this Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.