sanderv32 / ngx_http_auth_yubikey_module

Yubikey basic authentication for NGINX
Other
36 stars 2 forks source link

Nginx module to use a Yubikey for simple http authentication

  Requirements

yubico-c-client (you can get it at https://github.com/Yubico/yubico-c-client) curl (use the version of your OS)

Compilation

When compiling from source build as usual adding the -add-module option:

./configure --add-module=$PATH_TO_MODULE

Configuration

The module has the following directives:

You have to obtain an Yubico API key at https://upgrade.yubico.com/getapikey to get this module working.

Examples

To protect everything under "/yubikey" you will add the following to the "nginx.conf" file:

location /yubikey {
    auth_yubikey "Restricted Zone";
    auth_yubikey_api_url "https://api.yubico.com/wsapi/2.0/verify?id=%d&otp=%s";
    auth_yubikey_client_id "1234";
    auth_yubikey_secret_key "1Ab+CdEfgHi/jkl2M3nOp4qrsT5=";
    auth_yubikey_file "/etc/yubikey.conf";
    auth_yubikey_ttl "43200";
}

In the file "/etc/yubikey.conf" put the username followed by a colon and after the colon just press your Yubikey once.

Example:

admin:ekuhubcruhrkrhkicucbevftickivilrfekvntkjbnvv