aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-03-16 01:55:43 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-03-16 01:57:04 +0100
commitaefd6c6fdaff9dd43369a93d7c91246accf34164 (patch)
tree0b886322e01d626dd68aaf33f95d7bc5649ea6f9
parentf6fd20fdc4def2406614eebb958ef15f6085bb0e (diff)
downloadslcl-aefd6c6fdaff9dd43369a93d7c91246accf34164.tar.gz
Add man page for usergen(1)
-rw-r--r--doc/man1/slcl.13
-rw-r--r--doc/man1/usergen.192
2 files changed, 95 insertions, 0 deletions
diff --git a/doc/man1/slcl.1 b/doc/man1/slcl.1
index c050e01..3257f1c 100644
--- a/doc/man1/slcl.1
+++ b/doc/man1/slcl.1
@@ -122,3 +122,6 @@ Written by Xavier Del Campo Romero.
.SH TODO
Allow deleting files and directories from the web interface.
+
+.SH SEE ALSO
+.B usergen(1)
diff --git a/doc/man1/usergen.1 b/doc/man1/usergen.1
new file mode 100644
index 0000000..abe16f3
--- /dev/null
+++ b/doc/man1/usergen.1
@@ -0,0 +1,92 @@
+.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 LICENSE
+See the LICENSE file for further reference.
+
+.SH AUTHORS
+Written by Xavier Del Campo Romero.
+
+.SH SEE ALSO
+
+.B slcl(1)