REST API for managing clients and keys in Maskinporten and synchronization with AWS SSM.
In these examples, we use the default python3
distribution on your platform.
If you need a specific version of python you need to run the command for that
specific version. Ie. for 3.8 run python3.9 -m venv .venv
instead to get a
virtualenv for that version.
You can either install globally. This might require you to run as root (use sudo).
python3 -m pip install tox black pip-tools
Or, you can install for just your user. This is recommended as it does not
require root/sudo, but it does require ~/.local/bin
to be added to PATH
in
your .bashrc
or similar file for your shell. Eg:
PATH=${HOME}/.local/bin:${PATH}
.
python3 -m pip install --user tox black pip-tools
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
make init
Tests are run using tox: make test
For tests and linting we use pytest, flake8 and black.
Deploy to both dev and prod is automatic via GitHub Actions on push to main. You
can alternatively deploy from local machine with: make deploy
or make deploy-prod
.
Utility scripts live in the top level scripts
directory.
This script encodes a PKCS #12 certificate file into (possible multiple) Base64 files where each file is at most 8192 bytes long. This is useful when preparing a certificate file for storage in AWS SSM, as SSM parameters can't be longer than 8192 bytes. Each part is stored in its own SSM parameter and they're later stitched together again by this API.
Example usage:
./p12tob64 my-certificate.p12