Commit Graph

26 Commits (master)

Author SHA1 Message Date
Dustin 38d3c29d57 rpm: Drop systemd sub-package
dustin/sshca-cli/pipeline/head This commit looks good Details
The _sshca-cli-systemd_ package was intended for machines to
automatically get signed SSH host certificates on first boot.  Having
the systemd unit files in an RPM package allowed them to be installed by
Anaconda, without needing custom post-install scripts or Ansible.
Unfortunately, various issues prevented this from actually working as
intended most of the time, and with the new webhook-based automatic
provisioning process, it's not really necessary.  I'm thus removing the
sub-package that contained the unit files and moving them to the Ansible
configuration policy.
2025-09-13 21:13:25 -05:00
Dustin 1c36e749c0 ci: Stop building container images
These images were only useful on Fedora CoreOS.  Now that we have no
more machines running that OS, we do not need to spend time building the
images.
2025-09-13 21:11:38 -05:00
Dustin fb7ef1d2c3 ci: Pin to dedicated nodes
Now that there are several production workloads on the Raspberry Pi
cluster, we don't want intense jobs like this running on them.  To
ensure this job runs on a dedicated node, we need to use a label
expression that matches the appropriate nodes.
2025-09-13 21:11:34 -05:00
Dustin 730448c79d ci: Build for Fedora 42, drop Fedora 39
dustin/sshca-cli/pipeline/head This commit looks good Details
2025-04-24 08:01:33 -05:00
Dustin c8139d75dc ci: prepare: Install GDB
dustin/sshca-cli/pipeline/head This commit looks good Details
The RPM build tools in Fedora 41 apparently require `gdb` but don't
declare that:

> find-debuginfo: starting
> Extracting debug info from 1 files
> gdb-add-index: Failed to find a useable GDB binary
2024-11-06 19:46:13 -06:00
Dustin 63edc180d5 ci: prepare: Fix syntax for dnf5 in Fedora 41
dustin/sshca-cli/pipeline/head There was a failure building this commit Details
Apparently, `dnf5` differs from `dnf` in that it does not ignore the
trailing `--` argument:

> Unknown argument "--" for command "install". Add "--help" for more
> information about the arguments.
2024-11-06 19:22:36 -06:00
Dustin a98ecc5cac ci: Build for Fedora 41, drop Fedora 38
dustin/sshca-cli/pipeline/head There was a failure building this commit Details
2024-11-03 11:22:01 -06:00
Dustin 842c5f9ec8 ci: Build for Fedora 40
dustin/sshca-cli/pipeline/head This commit looks good Details
2024-05-26 10:31:44 -05:00
Dustin 22c2473e3e meta: Fix openidconnect TLS feature deps
dustin/sshca-cli/pipeline/head This commit looks good Details
Since the *openidconnect* dependency was added before the
`native-tls`/`rustls` features, it was hard coded to use native TLS.
This needs to be conditional based on the application's selected TLS
feature.
2024-01-31 19:03:48 -06:00
Dustin 23c57305bc Merge branch 'feature/user-certs'
dustin/sshca-cli/pipeline/head There was a failure building this commit Details
2024-01-31 17:54:28 -06:00
Dustin d443542ee0 user/login: Add cert to SSH agent
dustin/sshca-cli/pipeline/pr-master There was a failure building this commit Details
dustin/sshca-cli/pipeline/head This commit looks good Details
An SSH certificate is useless on its own, as without the private key,
clients cannot sign servers' authentication requests.  Since `sshca-cli
user login` creates a new key pair each time it is run, the private key
needs to be kept at least as long as the certificate is valid.  To that
end, the command will now add both to the user's SSH agent.  It
communicates with the agent via the UNIX stream socket specified by the
`SSH_AUTH_SOCK` environment variable.

Although there is a Rust crate, [ssh-agent-client-rs][0] that implements
the client side of the SSH agent protocol, it does not support adding
certificates to the agent.  In fact, that functionality is not even
documented in the IETF draft specification for the protocol.  Thus, I
had to figure it out by reading the code of the OpenSSH `ssh-add` tool,
and observing the messages passed between it and `ssh-agent`.

[0]: https://crates.io/crates/ssh-agent-client-rs
2024-01-31 17:41:58 -06:00
Dustin 123ca813a7 user/login: Request signed cert from SSHCA
The `sshca-cli user login` command now requests a signed certificate
from the SSHCA server.  Given a valid OpenID Connect identity token and
an SSH public key, the server will return a signed certificate, valid
for a predetermined (usually short) period of time.  The principals
listed in the certificate are derived from the ID token.
2024-01-31 17:40:14 -06:00
Dustin 9679c78419 ci: Build container image
dustin/sshca-cli/pipeline/pr-master Build started... Details
dustin/sshca-cli/pipeline/head This commit looks good Details
In addition to building an RPM package for regular Fedora machines, we
now build a container image containing a statically-linked `sshca-cli`
executable.
2024-01-18 09:43:36 -06:00
Dustin 2b87aca9f1 Add rustls feature
The `rustls` feature will enable building with [rustls] instead of
OpenSSL.  This will make it so the `sshca-cli` binary can be statically
linked, and thus distributable as a single file.

[rustls]: https://github.com/rustls/rustls
2024-01-17 21:24:21 -06:00
Dustin a754e47b0d ci: Request 1.5 CPUs for each container
dustin/sshca-cli/pipeline/head This commit looks good Details
The cloud aarch64 build machine does not have enough resources to build
multiple versions at once.  Requesting multiple CPUs ensures that only
one build pod is scheduled at a time.  Since the node has 2 CPUs and
240m CPUs are taken by Longhorn, if we request 1500m CPUs, builds will
run sequentially.
2023-12-29 12:36:34 -06:00
Dustin 7f51ae919f ci: build for Fedora 39
Fedora 39 is out, so we need builds of *sshca-cli* for it.
2023-12-29 12:36:34 -06:00
Dustin 3b55f7418e user: Add sshca user login command
The `sshca user login` command will eventually provide the command-line
interface for obtaining user SSH certificates.  It initiates the OAuth2
login process, retreiving an OpenID Connect Identity Token from the
OpenID Server.  This token will be submitted to the SSHCA server to
authorize a request to sign a certificate.  For now, though, the token
is printed to standard output, e.g. to be used in a `curl` request.
2023-11-21 20:13:17 -06:00
Dustin c26d67a25b main: Factor out get_sshca_server_url function
The `get_sshca_server_url` function encapsulates the logic of
identifying the URL of the SSHCA server.  For now, it only considers the
`SSHCA_SERVER` environment variable, but eventually, it will also
support other configuration methods like a configuration file.  Moving
this to a separate function will allow other areas of the code to share
the same logic.
2023-11-20 18:23:35 -06:00
Dustin 1d0e558163 Add SSHCA_CLI_DEBUG_TEST_MACHINE_ID env var
When running a debug build, the `sshca host sign` command will now check
the `SSHCA_CLI_DEBUG_TEST_MACHINE_ID` environment variable for the value
to use as the machine ID.  This is useful during development and
testing, where the real machine ID is inaccessible or otherwise
unavailable.

The `SSHCA_CLI_DEBUG_TEST_MACHINE_ID` environment variable is *NOT* used
at all in release builds.
2023-11-16 20:12:38 -06:00
Dustin 041788e818 ci: Import ci pipeline from original repo
dustin/sshca-cli/pipeline/head This commit looks good Details
When this repository was split from the original *dustin/sshca*
repository, the CI pipeline was not imported.  It wouldn't have mattered
if it had been, since it wouldn't have worked, anyway, given the path
changes.
2023-11-13 20:32:03 -06:00
Dustin 8d146cdb62 meta: Add .editorconfig 2023-11-13 19:42:53 -06:00
Dustin 630aa4dcee cli: Bump to v0.1.1 2023-11-12 18:23:18 -06:00
Dustin d8126a6dcb cli: Trim trailing null from RPi serial
The `/sys/firmware/devicetree/base/serial-number` pseudo-file has a
trailing null byte, which causes `Uuid::parse_srr` to fail.  This makes
it impossible to authenticate Raspberry Pi devices to the server.  The
trailing byte needs to be removed before attempting to parse the serial
number into a UUID to avoid this problem.
2023-11-12 10:44:48 -06:00
Dustin 5ab5c3e98d rpm: Add systemd service/target/timer units
The *ssh-host-cert-sign@.service* unit does what it says on the tin:
requests a signed host certificate from an SSHCA server.  It is a
template unit, whose instances correspond to SSH key types (RSA, ECDSA,
and Ed25519).  The *ssh-host-certs.target* unit depends on the three
instances of the template unit, so they can all be activated together.
This target is only activated on the first boot of the system, to
initially request the certificates.

The *ssh-host-certs-renew.timer* unit periodically renews the SSH hosts
certificates.  Its corresponding target unit depends on the three
instances of *ssh-host-cert-sign@.service*, so each certificate will be
renewed independently.
2023-11-06 18:34:20 -06:00
Dustin f6abf699e8 rpm: Add sshca-cli RPM spec
The *sshca-cli* RPM package can be used to install the SSHCA CLI client
on Fedora (and other RPM-based distributions).  The `.spec` file was
originally generated using [rust2rpm], but several manual modifications
were required.  Notably, the script does not generate `BuildRequres`
tags when run in "vendored" mode (i.e. third-party crate sources are
included in the source RPM package instead of packaged as separate
RPMS).
2023-11-06 18:11:19 -06:00
Dustin b203bbd87c cli: Begin CLI client
The CLI tool will be the primary method for interacting with the SSH CA
service.  For now, it supports a single operation: `sshca-cli host
sign`, which requests a certificate to be signed by the CA service.`
2023-11-05 10:31:58 -06:00