Shellpki is a very tiny and easy PKI in command lines.
Go to file
2018-12-26 14:17:45 +01:00
.gitignore Add .swp file to gitignore 2018-10-24 15:20:29 +02:00
cn-filter.sh Use logger for cn-filter 2018-03-01 16:24:27 +01:00
LICENSE Shellpki is now MIT licensed 2018-12-26 14:17:45 +01:00
ocspd.service Add a delay for auto restart in systemd service 2018-06-27 19:04:59 +02:00
openssl.cnf Add an OCSPD responder 2018-06-27 13:48:12 +02:00
README.md Shellpki is now MIT licensed 2018-12-26 14:17:45 +01:00
shellpki.sh Fix sh compatibility (shellcheck warning) 2018-12-12 18:11:11 +01:00
Vagrantfile Add a Vagrantfile for testing 2018-04-11 14:32:45 +02:00

shellpki

This script is a wrapper around openssl to manage a small PKI.

Install

Debian

useradd shellpki --system -M --home-dir /etc/shellpki --shell /usr/sbin/nologin
mkdir /etc/shellpki
install -m 0640 openssl.cnf /etc/shellpki/
install -m 0755 shellpki.sh /usr/local/sbin/shellpki
chown -R shellpki: /etc/shellpki
# 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

OpenVPN

If you want auto-generation of OpenVPN config file in /etc/shellpki/openvpn, you need to create a template file in /etc/shellpki/ovpn.conf, eg. :

client
dev tun
tls-client
proto udp

remote ovpn.example.com 1194

persist-key
persist-tun

cipher AES-256-CBC

Usage

Usage: ./shellpki.sh <subcommand> [options] [CommonName]

Initialize PKI (create CA key and self-signed cert) :

    ./shellpki.sh init <commonName_for_CA>

Create a client cert with key and CSR directly generated on server
(use -p for set a password on client key) :

    ./shellpki.sh create [-p] <commonName>

Create a client cert from a CSR (doesn't need key) :

    ./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

License

Shellpki is an Evolix project and is licensed under MIT, see the LICENSE file for details.