Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

improved and fixed key rollover support and the README

Compare
Choose a tag to compare
@yahesh yahesh released this 16 Dec 09:29

This new version introduces a major change to the database as the primary key of the secrets table is extended with the keyid a fingerprint belongs to. This is necessary so that the database supports proper key rollovers without fingerprint collisions between keys. The following steps describe how to properly update an existing database:

  1. Download the public key of your instance:
wget -O "./secrets.pub" "https://example.com/pub?plain"
  1. Generate the hexadecimally encoded public key keyid:
openssl rsa -pubin -in "./secrets.pub" -pubout -outform DER 2>/dev/null |
openssl dgst -sha256 -binary |
xxd -p |
tr -d "\n" &&
echo
  1. Add the new keyid column to the existing database table:
ALTER TABLE secrets ADD COLUMN keyid VARCHAR(64) FIRST;
  1. Fill the database with the keyid from step 2:
# setting time=time prevents the timestamps from being updated
UPDATE secrets SET time=time, keyid='<PUBLIC KEY KEYID>';
  1. Change the primary key constraint of the existing database table:
ALTER TABLE secrets DROP PRIMARY KEY, ADD PRIMARY KEY (keyid, fingerprint);