authd/README.md

85 lines
2.2 KiB
Markdown
Raw Normal View History

2019-12-17 16:18:29 +01:00
# authd
2024-12-11 13:25:08 +01:00
`authd` is a (JWT) token-based authentication micro-service based on [libipc][libipc].
`authd` stores users (login, encrypted password), their profile (arbitrary data) and their *permissions*.
For example, `authd` is used by [dnsmanagerd][dnsmanagerd] to handle authentication and permissions.
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
No SQL, the entire database is stored in plain files, thanks to [the DODB database library][dodb].
The [netlibre service][netlibre] is the first to use `authd` in a real-life deployment.
2019-12-17 16:18:29 +01:00
## Build
2019-12-17 16:18:29 +01:00
`authd` is written in Crystal.
Youll need the following tools to build it: `crystal`, `shards` and `make`.
2019-12-17 16:18:29 +01:00
```
make
make install
2019-12-17 16:18:29 +01:00
```
## Run
2019-12-17 16:18:29 +01:00
```
$ authd --help
```
2024-12-11 13:25:08 +01:00
For a more extensive documentation, please read the manual for both [authd][authdmanual] and [authctl][authctlmanual].
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
See the [configuration example][configuration-example] to avoid long command-line parameters.
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
Also, extensive usage examples are available in the makefiles.
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
## Administration
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
```sh
# First user in the database is an administrator.
authctl bootstrap name email
```
2024-12-11 13:25:08 +01:00
```sh
# Add a user:
authctl user add login email
```
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
For a comprehensive list of available commands, please read the [authctl manual][authctlmanual].
2024-12-11 13:25:08 +01:00
## Real-life deployment
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
For a real-life deployment, you might want to enable registration.
In this case, you need to get a `mailer` application to send template emails.
See [an example of such application][mailer].
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
### Backup and migration
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
```sh
# Database backup.
tar cfz db.tar.gz ./db-authd
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
# Database migration.
tar xfz db.tar.gz
```
2019-12-17 16:18:29 +01:00
2024-12-11 13:25:08 +01:00
Wasn't that hard, isn't it?
2019-12-17 16:18:29 +01:00
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
2024-12-11 13:25:08 +01:00
# API and design choices
2024-12-11 13:25:08 +01:00
See [API.md][API] and [DESIGN-CHOICES.md][design].
[libipc]: https://git.baguette.netlib.re/Baguette/libipc
2024-12-11 13:29:45 +01:00
[dnsmanagerd]: https://git.baguette.netlib.re/Baguette/dnsmanager
2024-12-11 13:25:08 +01:00
[netlibre]: https://www.netlib.re
[configuration-example]: ./configuration-example.yml
[mailer]: https://git.baguette.netlib.re/Baguette/mailer
[authdmanual]: ./man/authd.1
[authctlmanual]: ./man/authctl.1
[dodb]: https://git.baguette.netlib.re/Baguette/dodb.cr
[API]: ./API.md
[design]: ./DESIGN-CHOICES.md