shellpki/README.md

67 lines
1.4 KiB
Markdown
Raw Normal View History

2017-05-21 05:36:47 +02:00
# shellpki
2018-01-17 12:21:39 +01:00
This script is a wrapper around openssl to manage a small PKI.
2017-05-21 05:36:47 +02:00
2018-01-17 12:21:39 +01:00
## Install
2017-05-21 05:36:47 +02:00
### Debian
2018-01-17 12:21:39 +01:00
~~~
useradd shellpki --system -M --home-dir /etc/shellpki --shell /usr/sbin/nologin
mkdir /etc/shellpki
2018-01-17 12:21:39 +01:00
install -m 0640 openssl.cnf /etc/shellpki/
install -m 0755 shellpki.sh /usr/local/sbin/shellpki
chown -R shellpki: /etc/shellpki
2018-01-17 12:21:39 +01:00
~~~
2017-05-21 05:36:47 +02:00
2018-01-31 15:15:47 +01:00
~~~
# visudo -f /etc/sudoers.d/shellpki
%shellpki ALL = (root) /usr/local/sbin/shellpki
~~~
### OpenBSD
~~~
useradd -r 1..1000 -d /etc/shellpki -s /sbin/nologin _shellpki
mkdir /etc/shellpki
install -m 0640 openssl.cnf /etc/shellpki/
install -m 0755 shellpki.sh /usr/local/sbin/shellpki
chown -R _shellpki:_shellpki /etc/shellpki
~~~
~~~
# visudo -f /etc/sudoers
%_shellpki ALL = (root) /usr/local/sbin/shellpki
~~~
2018-01-17 12:21:39 +01:00
## Usage
2017-05-21 05:36:47 +02:00
2018-01-17 12:21:39 +01:00
~~~
2018-01-23 16:52:42 +01:00
Usage: ./shellpki.sh <subcommand> [options] [CommonName]
2017-05-21 05:36:47 +02:00
2018-01-23 16:52:42 +01:00
Initialize PKI (create CA key and self-signed cert) :
2017-05-21 05:36:47 +02:00
./shellpki.sh init <commonName_for_CA>
2017-05-21 05:36:47 +02:00
2018-01-23 16:52:42 +01:00
Create a client cert with key and CSR directly generated on server
(use -p for set a password on client key) :
2018-01-17 12:21:39 +01:00
2018-01-23 16:52:42 +01:00
./shellpki.sh create [-p] <commonName>
2018-01-17 12:21:39 +01:00
2018-01-23 16:52:42 +01:00
Create a client cert from a CSR (doesn't need key) :
2018-01-17 12:21:39 +01:00
2018-01-23 16:52:42 +01:00
./shellpki.sh create -f <path>
Revoke a client cert with is commonName (CN) :
./shellpki.sh revoke <commonName>
List all actually valid commonName (CN) :
./shellpki.sh list
2018-01-17 12:21:39 +01:00
~~~
2018-01-17 12:32:21 +01:00
## License
Shellpki are in GPLv2+, see [LICENSE](LICENSE).