Package Exports
- verdaccio-htpasswd
- verdaccio-htpasswd/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (verdaccio-htpasswd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Verdaccio Module For User Auth Via Htpasswd
verdaccio-htpasswd is a default authentication plugin for the Verdaccio.
Plugin only valid for verdaccio v5.x
Install
As simple as running:
$ npm install -g verdaccio-htpasswdConfigure
auth:
htpasswd:
file: ./htpasswd
# Maximum amount of users allowed to register, defaults to "+infinity".
# You can set this to -1 to disable registration.
#max_users: 1000
# Hash algorithm, possible options are: "bcrypt", "md5", "sha1", "crypt".
# Default algorithm is crypt.
#algorithm: bcrypt
# Rounds number for "bcrypt", will be ignored for other algorithms.
# Setting this value higher will result in password verification taking longer.
#rounds: 10
# Log a warning if the password takes more then this duration in milliseconds to verify.
#slow_verify_ms: 200Bcrypt rounds
It is important to note that when using the default bcrypt algorithm and setting
the rounds configuration value to a higher number then the default of 10, that
verification of a user password can cause significantly increased CPU usage and
additional latency in processing requests.
If your Verdaccio instance handles a large number of authenticated requests using
username and password for authentication, the rounds configuration value may need
to be decreased to prevent excessive CPU usage and request latency.
Also note that setting the rounds configuration value to a value that is too small
increases the risk of successful brute force attack. Auth0 has a
blog article
that provides an overview of how bcrypt hashing works and some best practices.
Logging In
To log in using NPM, run:
npm adduser --registry https://your.registry.localGenerate htpasswd username/password combination
If you wish to handle access control using htpasswd file, you can generate username/password combination form here and add it to htpasswd file.
How does it work?
The htpasswd file contains rows corresponding to a pair of username and password
separated with a colon character. The password is encrypted using the UNIX system's
crypt method and may use MD5 or SHA1.