htpasswd

command module
v0.0.0-...-a0cc59f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2019 License: MIT Imports: 11 Imported by: 0

README

htpasswd

htpasswd provides Go-specific implementation of Apache's original htpasswd utility. This includes an optimized version of the Apache-specific APR1 hashing algorithm, which can be used completely separately from the rest of the project.

This project was originally started due to ingress-nginx requiring users to create their own .htpasswd file by hand, and then manually adding it as a secret. I wanted a nice Terraform deployment in which I wouldn't have to manually run that, but instead would be able to generate / parse those files programatically, in Go.

This project does not have a stable release, however the subpackage apr1 is considered stable and tested, and unlikely to change.

Install

For using this package's subpackages, use the following.

go get -u github.com/johnaoss/htpasswd

For CLI usage, please use the following.

go get -u github.com/johnaoss/htpasswd
go install github.com/johnaoss/htpasswd

Usage

Currently only the flag combination -nb is supported, as such you can do the following:

# Example usage
$ htpasswd -nb user pass
# Example output:
user:$apr1$8Zh7TbIu$K0ksWxmHnnEP5oBLe/y0.0

Planned Features

This is planned to support all functionality that the original htpasswd utility does, including parsing and editing the actual .htpasswd files.

Currently only the additional hashing algorithm is introduced, pending my decision on how to properly strucutre this application.

License

This project is MIT Licensed, with more information available in the proper LICENSE.md file.

Documentation

Overview

htpasswd - Manage user files for basic authentication

Description:

htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users. If htpasswd cannot access a file, such as not being able to write to the output file or not being able to read the file in order to update it, it returns an error status and makes no changes.

Resources available from the Apache HTTP server can be restricted to just the users listed in the files created by htpasswd. This program can only manage usernames and passwords stored in a flat-file. It can encrypt and display password information for use in other types of data stores, though. To use a DBM database see dbmmanage or htdbm.

htpasswd encrypts passwords using either bcrypt, a version of MD5 modified for Apache, SHA1, or the system's crypt() routine. Files managed by htpasswd may contain a mixture of different encoding types of passwords; some user records may have bcrypt or MD5-encrypted passwords while others in the same file may have passwords encrypted with crypt(). This manual page only lists the command line arguments. For details of the directives necessary to configure user authentication in httpd see the Apache manual, which is part of the Apache distribution or can be found at http://httpd.apache.org/.

See Also:

man(1), man-pages(7)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL