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

Having problems with auth #121

Closed
mbuk opened this issue Feb 8, 2017 · 4 comments
Closed

Having problems with auth #121

mbuk opened this issue Feb 8, 2017 · 4 comments

Comments

@mbuk
Copy link
Contributor

mbuk commented Feb 8, 2017

Here is my config

  port: 25,
  webhook: 'http://localhost:8000',
  disableWebhook: true, // Disable the webhook posting.
  disableDNSValidation: true,
  smtpOptions: { 
    banner: 'Hello World', 
    logger: false, 
    requireAuthentication: true, 
    authMethods: ['PLAIN', 'LOGIN'], 
    disabledCommands: ['STARTTLS'], 
    ignoreTLS: true
  }
});

Here is authorizeUser

/* Access simplesmtp server instance. */
mailin.on('authorizeUser', function(connection, username, password, done) {
  done(null,true);
}); 

If it try to connect via telnet auth I get this:

220 localhost ESMTP Hello Smtp Server
helo blah.here.com
250 localhost Nice to meet you, [127.0.0.1]
auth login
334 VXNlcm5hbWU6
dQ==
334 UGFzc3dvcmQ6
cA==
535 Error: Authentication credentials invalid
535 Unauthorized user
500 Error: command not recognized

I expect it to work as in authorizeUser I am doing done(null,true);

I saw this: #106

but that doesn't work either.

What am I doing wrong?!

@mbuk
Copy link
Contributor Author

mbuk commented Feb 8, 2017

If I use done(null,{user:1});

The output to the client is:

auth login
334 VXNlcm5hbWU6
dQ==
334 UGFzc3dvcmQ6
cA==
235 Authentication successful
535 Unauthorized user
500 Error: command not recognized

and on the server with logging on:

[2017-02-08 13:28:58] DEBUG: [d1TROrfyPmwq] C: auth login
[2017-02-08 13:28:58] DEBUG: [d1TROrfyPmwq] S: 334 VXNlcm5hbWU6
[2017-02-08 13:29:03] DEBUG: [d1TROrfyPmwq] C: dQ==
[2017-02-08 13:29:03] DEBUG: [d1TROrfyPmwq] S: 334 UGFzc3dvcmQ6
[2017-02-08 13:29:06] DEBUG: [d1TROrfyPmwq] C: cA==
[2017-02-08 13:29:06] INFO: [d1TROrfyPmwq] u authenticated using LOGIN
[2017-02-08 13:29:06] DEBUG: [d1TROrfyPmwq] S: 235 Authentication successful
[2017-02-08 13:29:06] INFO: [d1TROrfyPmwq] Authentication error for u using LOGIN
Unauthorized user
[2017-02-08 13:29:06] DEBUG: [d1TROrfyPmwq] S: 535 Unauthorized user
[2017-02-08 13:29:06] DEBUG: [d1TROrfyPmwq] C: 
[2017-02-08 13:29:06] DEBUG: [d1TROrfyPmwq] S: 500 Error: command not recognized
[2017-02-08 13:30:06] DEBUG: [d1TROrfyPmwq] S: 421 Timeout - closing connection
[2017-02-08 13:30:06] INFO: [d1TROrfyPmwq] Connection closed to [127.0.0.1]

@mbuk
Copy link
Contributor Author

mbuk commented Feb 14, 2017

@Flolagale

Wondering if this function:

 function onAuth(auth, session, streamCallback) {
        if (_this.emit('authorizeUser', session, auth.username, auth.password, streamCallback)) {
             streamCallback(new Error('Unauthorized user'));
        }
    }

should actually be an if (!

function onAuth(auth, session, streamCallback) {
        if (!_this.emit('authorizeUser', session, auth.username, auth.password, streamCallback)) {
             streamCallback(new Error('Unauthorized user'));
        }
    }

@mbuk
Copy link
Contributor Author

mbuk commented Apr 27, 2017

Or am I wrong?

@mbuk
Copy link
Contributor Author

mbuk commented Sep 8, 2021

After 4+ years I'm closing this - appears to be abandoned and it's cluttering up my github account

@mbuk mbuk closed this as completed Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant