This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

Introdution

This recipe can be used to generate files for basic authentication of HTTP users, to restrict the access to HTTP resoruces. The aim is to be fully compatible with the htpasswd program that come with the Apache httpd Server, and support all the password formats that it supports. This formats, with some minor diffenrences in the case of the plain method, are also supported by the auth_basic module of the nginx http server.

This recipe support crypt, md5 (APR md5 algorithm), plain and sha1 algorithms for storage passwords. The crypt algorithm is based on the system’s crypt() routine, so it inherits its limitations (see: man 5 crypt).

Note: The plaintext passowrds are only accepted by the Apache httpd server on Windows and Netware.

Caution: This recipe should not be used to update an existing htpasswd file, because it overwritte the htpasswd file in every update.

Example usage

The simplest way to use this recipe is to add a part in buildout.cfg like this:

[buildout]
parts = htpasswd

[htpasswd]
recipe = collective.recipe.htpasswd
output = ${buildout:directory}/etc/htpasswd
credentials =
    nueces:secret
    nutz:crackme

One example using the sha1 algorithm:

[buildout]
parts = htpasswd

[htpasswd]
recipe = collective.recipe.htpasswd
output = ${buildout:directory}/etc/htpasswd
algorithm = sha1
credentials =
    nueces:secret
    nutz:crackme

For use the md5 algorithm this recipe relies in the python-aprmd5 package, then to install it you must modify the buildout part to include the md5 extras_require setting and install the build depencies for the python-aprmd5 package. In Debian GNU/Linux the package is the libaprutil1-dev. It contain the develoment headers of the Apache Portable Runtime Utility Library.

After that modify the part in the buildout.cfg it must look like this:

[buildout]
parts = htpasswd

[htpasswd]
recipe = collective.recipe.htpasswd [md5]
output = ${buildout:directory}/etc/htpasswd
algorithm = md5
credentials =
    nueces:secret
    nutz:crackme

Note: For a bug in zc.buildout if you need to use this recipe with the md5 and the plain or crypt algorithms in two o more parts, you must declare first the one that use the md5 extras_require.

Supported options

  • output: Specify a path to the output file. The path will be created if it does not exist.
  • credentials: One set per line of credentials formed by username and password separated by a colon. e.g. <username>:<password>.
  • mode: Specified with octal numbers, as in the chmod program. e.g. 640. If it not set the file are created with the mask mode from the system enviroment.
  • algorithm: The supported options are crypt, md5, plain and sha1. Default to cypt.

Development

Contributors

Juan A. Diaz (nueces), Author

History

0.1a3 (2013-03-27)

  • Added support for the sha1 algorithm. [Juan A. Diaz (nueces)]

0.1a2 (2013-02-18)

  • Added support for the apr md5 algorithm. [Juan A. Diaz (nueces)]

0.1a1 (2013-01-30)

  • Created recipe with ZopeSkel
  • Initial alpha release. [Juan A. Diaz (nueces)]
Release History

Release History

0.1a3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1a3.dev0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1a2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1a1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
collective.recipe.htpasswd-0.1a3.zip (32.5 kB) Copy SHA256 Checksum SHA256 Source Mar 27, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting