aboutsummaryrefslogtreecommitdiff
path: root/doc/man1/usergen.1
blob: 857d9df618d96406f8d853aa64ad80f2ca660cf3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.TH USERGEN 1 usergen

.SH NAME
usergen \- append a user into a slcl database

.SH SYNOPSIS
.B usergen
dir

.SH DESCRIPTION
.B usergen
performs the following steps:

.B 1.
Reads user credentials and quota from standard input.

.B 2.
Generates a JSON object with the read credentials and quota, as well as
a random salt and signing key.

.B 3.
Appends the newly generated JSON object into the
.B users
key in
.BR dir/db.json .

.B 4.
Creates a directory with the username in
.BR dir/user/ .

.SH OPTIONS
.B dir
defines the directory where
.B db.json
is located.

.SH NOTES
For security reasons, passwords are never stored in plaintext into
.BR dir/db.json .
Instead, a salted, multi-round hashed password is calculated and
stored. Then,
.B slcl(1)
performs the same operations to ensure both tokens match.

.SH EXAMPLES

Below, there is an example of a new user called
.B johndoe
with password
.B secret
and a specified quota of 512 MiB:

.PP
.EX
$ ./usergen ~/db
Username:
johndoe
Password:
secret
Quota, in MiB (leave empty for unlimited quota):
512
1000/1000
.EE

Then,
.B dir/db.json
should be updated to something similar to:

.PP
.EX
{
  "users": [
    {
      "name": "johndoe",
      "password": "4c48385ec2be4798dc772d3c8f5649d8411afbdfc4708ada79379e3562af5abb",
      "salt": "835324df29527731f3faad663c58c3b19a07c193e97dc77f33e10d3942cdc91c",
      "key": "d0ae360b9af1177ce73eef3f499eea2627cd61b69df79dcb7a5c70bc658a4e63",
      "quota": "512"
    }
  ]
}
.EE

.SH COPYRIGHT
Copyright (C) 2023 Xavier Del Campo Romero.
.P
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

.SH SEE ALSO

.B slcl(1)