Accessing SMTP server with AUTH NTLM from Node.js

A couple of little scripts that help with manual testing SMTP servers using NTLM authentication. The scripts handle generating the initial handshake and ...

Accessing SMTP server with AUTH NTLM from Node.js
  1. Ask the exchange server admins to enable PLAIN auth under STARTTLS (it is secure and appears to only involve ticking a couple of checkboxes)
  2. Set up a local relay (e.g. postfix) that relays to Exchange, and use the postfix relay from nodemailer
  3. Fork nodemailer and add NTLM support

Unfortunately we hit political issues on the easy options (1) and (2), so had to fork nodemailer.

I didn't send a pull request yet, but the fork is here. For the time being the easiest way to use it is via npm by referring directly to the github project in your package json, e.g.:

"dependences": {
  "nodemailer": "steveliles/nodemailer"
}

If you're interested, most of the change was actually in a sub-sub-project. and the forks of nodemailer, nodemailer-smtp-pool, and nodemailer-smtp-transport are only necessary to get my smtp-connection fork to be picked up.

We didn't need to implement the NTLM protocol, as SamDecrock's httpntlm already did the hard work.

It has only been tested against Exchange 2007 over TLS (with STARTTLS) and no domain or workstation.

If you do need domain + workstation in the credentials, just add them to nodemailer's options.auth and they will be passed through, e.g.

var smtpConfig = {
    host: 'ntlm.boo.hoo',
    port: 25,
    auth: {
        domain: 'windows-domain',
        workstation: 'windows-workstation',
        user: 'user@somedomain.com',
        pass: 'pass'
    }
};

We were even more unlucky in that the exchange server we're connecting to doesn't have a valid SSL certificate, but luckily nodemailer can handle that by setting tls: {rejectUnauthorized: false} in the options.


Click Here to Visit

What's Your Reaction?

like
0
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0