]> err.no Git - yubikey-server-c/blob - README
Write a bit of documentation
[yubikey-server-c] / README
1 yubikey-server-c – yubikeyd
2 ===========================
3
4 This is a yubikey validation server, written in C.  It implements the
5 server part of the web API as specified at
6 http://yubico.com/developers/api/ and can be used from various
7 clients.
8
9 It also lacks any useful administration tools, you will have to use
10 psql or create something yourself.
11
12 A sample configuration file looks like:
13
14 pidfile=/var/run/yubikeyd.pid
15 user=yubikeyd
16 group=yubikeyd
17 dbdef=dbname=yubikey port=5433
18 port=8000
19
20 Getting started
21 ===============
22
23 yubikey-server-c stores raw bytes in some of the tables rather than a
24 Base64 or hex encoded representation. PostgreSQL has (at least) two
25 ways to insert this kind of data:
26
27 - Use decode('encoded_string_goes_here', 'encoding')
28
29 - Use quoted byte strings: E'\\000\\000\\000\\000\\000\\000'.  The
30   numbers are octal
31
32 To authenticate an OTP the Yubikey needs to exist in the database and
33 the client asking yubikey-server-c must be allowed access.  Each
34 client (typically each service) that authenticates needs its own
35 shared secret.  To set this up, do
36
37   INSERT INTO shared_secret (secret, active) VALUES
38     (decode('MQ6fOy1t/add/wisbu2O+LpPiMs=', 'base64'), 't');
39
40 The base64 string in the middle is the base64 encoded version of the
41 secret as we store the raw bytes in the database.  Depending on the
42 client, it might accept a base64 encoded version or it might want hex
43 or something else (in its configuration file).
44
45 For each yubikey, you need to insert a row into the yubikey table
46 like:
47
48 INSERT INTO yubikey
49   (active, public_id, secret_uid, secret_key, session_counter, session_use)
50   VALUES
51   ('t', 'tfheen', E'\\000\\000\\000\\000\\000\\000',
52    decode('baef43c254e9d2217912e80ed71a7b4a', 'hex'),
53    0, 0);
54
55 The public id is the fixed part of the yubikey OTP. It is generally
56 not the user name.  It is what you set using the -o fixed=ffffffff option
57 to ykpersonalize.  It is between 0 and 16 charcters long.
58
59 The secret uid is set using the -o uid=uuuuuu to ykpersonalize. It is
60 always six bytes (or 12 modhex characters).
61
62 The secret key is either randomly generated by ykpersonalize based on
63 a passphrase or it can be set using the -a option.
64
65 The session counter and session use generally start at 0 so they don't
66 need to be changed.
67
68 After this has been inserted, you should be able to authenticate using
69 ykclient like:
70
71 ykclient --url http://localhost:7443/verify?id=%%d&otp=%%s \
72          --apikey $shared_secret \
73          $id_of_client \
74          $otp