npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

authenticate-pam

v1.0.5

Published

Asynchronous PAM authentication for Node.JS

Downloads

979

Readme

node-authenticate-pam

Asynchronous PAM authentication for NodeJS

You will most likely need to run it as root in most common environments! Running as non-root on my system (openSUSE 12.1) made a segfault happen somewhere in libpam! - but seems ok on on openSUSE Leap 42.2

It tries to superseed the previous and outdated node-pam extension with the following improvements:

  • Allows to provide own service name, for example common-auth or any custom service name defined in /etc/pam.d
  • Allows to provide PAM_RHOST via 'remoteHost' option. It is used to provide remote network authentication that will skip any local only authentication methods like for example fingerprint reading.
  • Already mentioned utilization of libuv and node-gyp
  • Proper type checking in C++ code, it throws exception if bad types are given
  • In case of error it passes the error string containing both pam function and pam_strerror() results

Example

Simple usage

Default service_name for pam_start(2) is 'login'.

var pam = require('authenticate-pam');
pam.authenticate('myusername', 'mysecretpassword', function(err) {
    if(err) {
      console.log(err);
    }
    else {
      console.log("Authenticated!");
    }
  });

Usage with options:

Proper apps should provide their own service name. Sample services are located in /etc/pam.d. As an example lookup a service name file for sshd. To do proper network authentication you should also provide remoteHost key to the options argument. It will be passed to pam as PAM_RHOST (pam_set_item(2))

var pam = require('authenticate-pam');
pam.authenticate('rush', 'mysecretpassword', function(err) {
    if(err) {
      console.log(err);
    }
    else {
      console.log("Authenticated!");
    }
}, {serviceName: 'myapp', remoteHost: 'localhost'});

Install

First you need install the development version of PAM libraries for your distro.

Centos and RHEL: yum install pam-devel

Debian/Ubuntu: apt-get install libpam0g-dev

debian6/maverick/natty: apt-get install libreadline5-dev

oneiric (and any newer, eg. Debian 7 or Ubuntu 12.04): apt-get install libreadline-gplv2-dev

Then you can install the module: npm install authenticate-pam