Closed winkler-winsen closed 3 years ago
Hi @winkler-winsen,
Set allowedUsers in
config.go
pointing to createduserlist
file:allowedUsers = flag.String("allowed_users", "userlist", "Path to file with valid users/passwords")
Why are you modifying the config.go
file to adjust settings? You should either:
-config smtprelay.ini
-- note that in this case the path is relative to the directory containing the executable Please post your exact command line for running smtprelay
, and include your .ini
file if you use .-config
.
Please note that if authentication is required (via -allowed_users
), then TLS (either -listen starttls://...
or -listen tls://...
) must be configured and used by the client.
I did open an issue (#26) to make this more obvious.
My testing notes (from current master
(03b8b78f5303fbead6ae3ac6966c180b64f4a13a), for posterity:
Building, configuring, and running the server:
$ go build
$ echo "user@mail.com $(go run cmd/hasher.go test)" | tee userlist.txt
user@mail.com $2a$10$CTXc92oDfrZaIhIO6OGH1e2Fmx4Pl4SKwU80M41Q9dbIKZSnXK0oe
$ ./smtprelay -listen ':2525' -allowed_users userlist.txt
WARN[2021-03-30T23:39:35-04:00] remote_host not set; mail will not be forwarded!
INFO[2021-03-30T23:39:35-04:00] listening on address address=":2525"
Testing with swaks
w/o authentication (fails with 530 Authentication Required
as expected):
$ swaks --to test@example.com --server localhost:2525
=== Trying localhost:2525...
=== Connected to localhost.
<- 220 localhost.localdomain ESMTP ready.
-> EHLO xxxxxxxx
<- 250-localhost.localdomain
<- 250-SIZE 10240000
<- 250-8BITMIME
<- 250 PIPELINING
-> MAIL FROM:<jreinhart@xxxxxxxx>
<** 530 Authentication Required.
-> QUIT
<- 221 OK, bye
=== Connection closed with remote host.
Testing with swaks
w/ authentication (fails because AUTH
extension is never given by server, because not using TLS):
$ swaks --to test@example.com --server localhost:2525 --auth LOGIN
Username: user@mail.com
Password: test
=== Trying localhost:2525...
=== Connected to localhost.
<- 220 localhost.localdomain ESMTP ready.
-> EHLO xxxxxxxx
<- 250-localhost.localdomain
<- 250-SIZE 10240000
<- 250-8BITMIME
<- 250 PIPELINING
*** Host did not advertise authentication
-> QUIT
<- 221 OK, bye
=== Connection closed with remote host.
Hello @JonathonReinhart ,
thanks for quick reply.
Didn't know the parameter -config smtprelay.ini
, just thought .ini file will be read automatically and wondered that nothing worked. So I started editing config.go
file. ;-)
So working with -config smtprelay.ini
works well. First problem solved. Thanks
Please note that if authentication is required (via
-allowed_users
), then TLS (either-listen starttls://...
or-listen tls://...
) must be configured and used by the client.I did open an issue (#26) to make this more obvious.
This point, I didn't know either. Thanks for pointing this out and updating the code.
I planned to use smtpreply as a relay for unsecure client (is not STARTTLS, SSL/TLS capable) to use him with modern well configured SMTP server (e.g. smtp.office365.com:587)
So I will not use -allowed_users
thats fine for me on a local server.
Thanks Lars
Fixed in #27
Hi...
Tried well with Thunderbird (for testing) and following
config.go
settings:Created file
userlist
(Example, password hashed withgo run cmd\hasher.go test
):user@mail.com $2a$10$SN1obpmbzZoWI9vkrycRNe9V6wr0bsX0SiZvFVGTfM95GwNP.ai0a
Set allowedUsers in
config.go
pointing to createduserlist
file:allowedUsers = flag.String("allowed_users", "userlist", "Path to file with valid users/passwords")
After setting
allowedUsers
to filename with user and hash in it, I cannot force Thunderbird to send mail with same settings. Checked username and password twice. Checked also different settings for SMTP auth methods. Thunderbird states "Autentication Required."Did some newbee log outputs to test functions from
auth.go
.AuthFetch()
is calledAuthCheckPassword()
never calledparseLine()
never calledChecked with log level debug and trace, but no hints showing up.
Any ideas, what I'm thinking or doing wrong? Or is it a bug?
Regards Lars