Let's Authenticate Certificate Authority
A certificate authority for the Let's Authenticate system. From the paper
Let’s Authenticate: Automated Certificates for User Authentication,
presented at NDSS 2022.
Running the CA
go run main.go
Command line flags include:
- configDir [string] : configuration directory, default
'lets-auth-ca-development'
- logLevel [integer] : level of logging, default 1
- logPath [string] : path to logging output file, empty string is stdout/stderr,
default is blank
- signRoot : re-sign the root certificate, default false
Log levels include:
- -1: trace
- 0: debug
- 1: info
- 2: warn
- 3: error
- 4: fatal
- 5: panic
Configuration file format
Configuration files have the following format:
- name: [string]
- database config: [string]
- RP display name: [string]
- RP ID: [string]
- RP origin: [string]
- public key: [string]
- private key: [string]
- root certificate: [string]
The database configuration string is formatted as:
[username]:[password]@tcp([IP]:[port])/[database]?charset=utf8mb4
You will need to self-sign a root certificate, as shown below.
Storing configuration files
Configuration files are stored in the configuration directory with the name
config.yml
. For example:
- development-config
- production-config
Setting up a development environment
- Set up the database
- Create a configuration directory
- Generate keys and the root certificate
- Create a configuration file
- Deploy the CA
Set up the database
-
Install MariaDB.
brew install mariadb
-
Create a MySQL user
mysql> CREATE USER 'letsauth'@'localhost' IDENTIFIED BY 'letsauth';
-
Create the database
mysql> CREATE DATABASE lets_auth;
-
Grant the user privileges to just this new database.
mysql> GRANT ALL on lets_auth.* TO 'letsauth'@'localhost';
Create a configuration directory
Create a configuration directory in lets-auth-ca-development
.
Generate keys and the root certificate
In the configuration directory, run the following:
openssl genrsa -out dev-private-key.pem 3072
openssl rsa -in dev-private-key.pem -pubout -out dev-public-key.pem
Setup a configuration file, as shown below. Then:
go run main.go -root
Create a configuration file
In lets-auth-ca-development/config.yml
, create a configuration file. Here is a
sample file:
name: "development"
database config: "auth:auth@tcp(127.0.0.1:3306)/lets_auth?charset=utf8mb4"
RP display name: "Let's Authenticate"
RP ID: "localhost"
RP origin: "http://localhost:3060"
public key: "dev-public-key.pem"
private key: "dev-private-key.pem"
root certificate: "dev-cert.pem"
Deploy the CA
-
Clone the repository into your home directory on the production server.
-
Run go build
to build the code. You may need to
install Go first.
-
Set up the database, as above, but with a strong password for the letsauth
user.
-
Create a production configuration in a directory called
lets-auth-ca-production
.
-
Create a file in /etc/systemd/system/letsauthca.go
with the following
contents:
[Unit]
Description=Let's Authenticate CA
ConditionPathExists=/home/zappala/lets-auth-ca
After=network.target
[Service]
Type=simple
User=zappala
Group=zappala
WorkingDirectory=/home/zappala/lets-auth-ca
ExecStart=/home/zappala/lets-auth-ca/lets-auth-ca --configDir lets-auth-ca-prod\
uction
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=letsauthca
[Install]
WantedBy=multi-user.target
-
Set up and run the daemon:
sudo systemctl daemon-reload
sudo systemctl enable letsauthca
sudo systemctl start letsauthca