@winlinux/auth
v1.1.0
Published
Basic, NTLM, Kerberos, Negotiate and CredSSP authentication for the winlinux WinRM and SMB2 clients.
Maintainers
Readme
@winlinux/auth
Authentication for the winlinux WinRM and SMB2 clients: Basic, NTLM,
Kerberos, Negotiate (SPNEGO) and CredSSP behind one AuthProvider
interface.
Most users want the winlinux
package, which wires this package to WinRM and SMB2. Use this package
directly only to supply an AuthProvider to @winlinux/winrm or
@winlinux/smb2.
npm install @winlinux/authimport { createAuthProvider } from '@winlinux/auth';
const authProvider = createAuthProvider('negotiate'); // 'basic' | 'ntlm' | 'kerberos' | 'negotiate' | 'credssp'
const credentials = { username: 'alice', password: process.env.WINLINUX_PASSWORD, domain: 'CORP' };
// Pass both to connect() of @winlinux/winrm or @winlinux/smb2.- NTLM: NTLMv2 only, with MIC,
mechListMICand channel bindings. - Kerberos: a password (
kinitinto a private temp ccache), a keytab (credentials.keytab) or the ticket cache (useTicketCache: true). It uses the optional@winlinux/krb-session-keyaddon when it loads, and thekerberospackage otherwise. Only the addon gives the session key that SMB2 signing and WinRM encryption over HTTP need.kerberosSessionKeyAvailable()says whether the addon loaded. With the addon, a Kerberos context also binds its AP-REQ to thechannelBindingsthe consumer sets on the target before the first step (the RFC 5929tls-server-end-pointbinding over TLS, as NTLM does); thekerberospackage sends none.channelBoundon the context says which happened. - The
kerberospackage is optional. Both Kerberos back ends areoptionalDependencies, and both are native addons. A consumer that uses NTLM or Basic only can install withnpm install @winlinux/auth --omit=optional: no native build runs, andcreateAuthProvider('ntlm')andcreateAuthProvider('basic')work as usual. Without either back end, the first step of a'kerberos'context fails with an error that saysnpm install kerberos. A'negotiate'context with a password falls back to NTLM, as for any client-side Kerberos failure; with the ticket cache alone (no password) it fails with the same error. Thewinlinuxpackage depends onkerberos, so the CLI keeps Kerberos out of the box. - CredSSP sends the password to the server. Only an explicit
'credssp'selects it;negotiatenever does.
The interface is the auth contract v1.2 (docs/contracts/auth-provider.md
in the repository).
ESM only, Node.js 22 or later. MIT license.
