2.1.0 • Published 5 months ago

kerberos v2.1.0

Weekly downloads
46,003
License
Apache-2.0
Repository
github
Last release
5 months ago

Kerberos

The kerberos package is a C++ extension for Node.js that provides cross-platform support for kerberos authentication using GSSAPI on linux/osx, and SSPI on windows. Much of the code in this module is adapted from ccs-kerberos and winkerberos.

Requirements

Linux

  • python v2.7
  • make
  • A proper C/C++ compiler toolchain, like GCC
  • Distribution-specific kerberos packages (e.g. krb5-dev on Ubuntu)

macOS

  • Xcode Command Line Tools: Can be installed with xcode-select --install
  • Distribution-specific kerberos packages (e.g. krb5 on Homebrew)

Windows

  • Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools by running npm install -g windows-build-tools from an elevated PowerShell (run as Administrator).
  • Option 2: Install dependencies and configuration manually

    1. Visual C++ Build Environment:
    • Option 1: Install Visual C++ Build Tools using the Default Install option.
    • Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup.

    :bulb: Windows Vista / 7 only requires .NET Framework 4.5.1

    1. Install Python 2.7 or Miniconda 2.7 (v3.x.x is not supported), and run npm config set python python2.7
    2. Launch cmd, npm config set msvs_version 2015

MongoDB Node.js Driver Version Compatibility

Only the following version combinations with the MongoDB Node.js Driver are considered stable.

kerberos@1.xkerberos@2.x
mongodb@6.xN/A
mongodb@5.x
mongodb@4.x
mongodb@3.xN/A

Installation

Now you can install kerberos with the following:

npm install kerberos

Testing

Run the test suite using:

npm test

NOTE: The test suite requires an active kerberos deployment, see test/scripts/travis.sh to better understand these requirements.

Documentation

Classes

Functions

KerberosClient

Properties

NameTypeDescription
usernamestringThe username used for authentication
responsestringThe last response received during authentication steps
responseConfstringIndicates whether confidentiality was applied or not (GSSAPI only)
contextCompletebooleanIndicates that authentication has successfully completed or not

kerberosClient.step(challenge, callback)

ParamTypeDescription
challengestringA string containing the base64-encoded server data (which may be empty for the first step)
callbackfunction

Processes a single kerberos client-side step using the supplied server challenge.

Returns: Promise - returns Promise if no callback passed

kerberosClient.wrap(challenge, options, callback)

ParamTypeDescription
challengestringThe response returned after calling unwrap
optionsobjectOptional settings
options.userstringThe user to authorize
callbackfunction

Perform the client side kerberos wrap step.

Returns: Promise - returns Promise if no callback passed

kerberosClient.unwrap(challenge, callback)

ParamTypeDescription
challengestringA string containing the base64-encoded server data
callbackfunction

Perform the client side kerberos unwrap step

Returns: Promise - returns Promise if no callback passed

KerberosServer

Properties

NameTypeDescription
usernamestringThe username used for authentication
responsestringThe last response received during authentication steps
targetNamestringThe target used for authentication
contextCompletebooleanIndicates that authentication has successfully completed or not

kerberosServer.step(challenge, callback)

ParamTypeDescription
challengestringA string containing the base64-encoded client data
callbackfunction

Processes a single kerberos server-side step using the supplied client data.

Returns: Promise - returns Promise if no callback passed

checkPassword(username, password, service, defaultRealm, callback)

ParamTypeDescription
usernamestringThe Kerberos user name. If no realm is supplied, then the defaultRealm will be used.
passwordstringThe password for the user.
servicestringThe Kerberos service to check access for.
defaultRealmstringThe default realm to use if one is not supplied in the user argument.
callbackfunction

This function provides a simple way to verify that a user name and password match those normally used for Kerberos authentication. It does this by checking that the supplied user name and password can be used to get a ticket for the supplied service. If the user name does not contain a realm, then the default realm supplied is used.

For this to work properly the Kerberos must be configured properly on this machine. That will likely mean ensuring that the edu.mit.Kerberos preference file has the correct realms and KDCs listed.

IMPORTANT: This method is vulnerable to KDC spoofing attacks and it should only be used for testing. Do not use this in any production system - your security could be compromised if you do.

Returns: Promise - returns Promise if no callback passed

principalDetails(service, hostname, callback)

ParamTypeDescription
servicestringThe Kerberos service type for the server.
hostnamestringThe hostname of the server.
callbackfunction

This function returns the service principal for the server given a service type and hostname.

Details are looked up via the /etc/keytab file.

Returns: Promise - returns Promise if no callback passed

initializeClient(service, options, callback)

ParamTypeDescription
servicestringA string containing the service principal in the form 'type@fqdn' (e.g. 'imap@mail.apple.com').
optionsobjectOptional settings
options.principalstringOptional string containing the client principal in the form 'user@realm' (e.g. 'jdoe@example.com').
options.gssFlagsnumberOptional integer used to set GSS flags. (e.g. GSS_C_DELEG_FLAGGSS_C_MUTUAL_FLAGGSS_C_SEQUENCE_FLAG will allow for forwarding credentials to the remote host)
options.mechOIDnumberOptional GSS mech OID. Defaults to None (GSS_C_NO_OID). Other possible values are GSS_MECH_OID_KRB5, GSS_MECH_OID_SPNEGO.
callbackfunction

Initializes a context for client-side authentication with the given service principal.

Returns: Promise - returns Promise if no callback passed

initializeServer(service, callback)

ParamTypeDescription
servicestringA string containing the service principal in the form 'type@fqdn' (e.g. 'imap@mail.apple.com').
callbackfunction

Initializes a context for server-side authentication with the given service principal.

Returns: Promise - returns Promise if no callback passed

vocovo-ascoltatoridebox-web-corehackly-mongodb@xqy/keystone@infinitebrahmanuniverse/nolb-kerdecentraleyes-net@everything-registry/sub-chunk-2011parse2useyekonga-servervulnerable-jstokumxtoothacheteslamstest-js-accounttest-js-contractucms-plugin-storage-mongodbukiyoe-modelstwreporter-keystone@eybo/keystonevocovo-patched-ascoltatoriuserbase-mongoose-adaptoruniformity@ionaai/rtnreport@ionaai/rtnapirmg-clientreact-redux-hybrid-render-application-starterrws-js-serverruyingshoppinpal-warehouse-mongosimple-kerberossmile-adminsmile-text-editorsmile-topicstems@mongodb-js/devtools-connect@mongosh/service-provider-server@eklogvinov/keystone@peterpme/keystoneb4amtfreact-pack-fullstack@qp-mongosh/service-provider-server@rws-framework/server@nodulus/shellemnutteasy-kerberoseasyexpressedencms@twreporter/keystonefirestonefamilytree@webgap/database-dao@zalastax/nolb-keramps-kerberos-authenticatorgestta-basebuildanytv-node-mongoanytv-node-youku-uploaderapi.fuelrats.comappmoviemongorito-tcombbifcore-js-accountbifcore-js-contractmongodb-topology-managermongoboostermouldjsnode-populator-mongodbjgg-keystonemy613-apihorizontec-keystonehuntcrash-store-dbkooropenframe-apiserverhapi-mongoose-opt-paginatebeework_control_centerartur-keystonemeerkatarch-keystoneacklen-keystonekeystone-eskeystone-diamantidoukeystone-nthrivekeystone-zkeystone_osskeystone-ruskerberos-agentobasecred-auth-managercrowd-pulse-datanofulnownz-order-managementcloudlify-keystonejaydata-libretsnode-sensu-pluginsascoltatoriascoltatori-sbgramene-swaggergsalescmsaxios-kerberosmicrpkeymuni
2.1.0

5 months ago

2.0.3

8 months ago

2.0.2

8 months ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.0-beta.0

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.24

6 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago