Skip to main content
# SSH CA Client

Client for interacting with [SSH CA Server](https://github.com/commercehub-oss/ssh-ca-server).


## Installation instructions

1. Install ca-client
```
pip install ca-client
```

## Client Usage

ca-client is used to interact with the [SSH CA server]((https://github.com/commercehub-oss/ssh-ca-server)). The client uses HTTP auth to verify identity and provides facilities for listing roles, signing public keys and getting CA certificates.

After completing a signing request ca-client will load the signed certificate and private key into memory with ssh-agent. ssh-agent will sling certs at a remote host until a successful challenge response occurs granting access to the remote host. By default sshd will reject the client after 5 failed attempts. ca-client will not load a certificate with ssh-agent if it will exceed 5 active certificates. The private key and signed certificate must be loaded with ssh-agent and both count towards the limit of 5.

Certificates loaded with ssh-agent do not persist a reboot. Following a reboot you can reload using ssh-add or initiate a new signing request with ca-client.


The first time ca-client is executed you must provide the FQDN of the CA server and the default certificate authority to use when issueing a signing request.

```
$ ca-client

Failed to load configuration from /Users/username/.ca-client/config.json
Enter FQDN of CA Server: ca-server.mydomain.com
Enter name of default CA: nonproduction
Loading configuration from /Users/username/.ca-client/config.json
```

Client configuration example:
```
$ cat ~/.ca-client/config.json

{
"DEFAULT_CA": "nonproduction",
"BASE_URL": "https://ca-server.mydomain.com"
}
```

ca-client command line usage:
```
usage: ca-client [-h] [-s CA | -r | -c | -k CA]

Tool to sign your public SSH key

optional arguments:
-h, --help show this help message and exit
-s CA, --sign CA certificate signing request
-u USER, --user USER optional username for signing request
-r, --list-roles list my authorized roles
-c, --list-cas list available CAs
-k CA, --get-key CA list public key for CA
```

List your authorized roles:
```
$ ca-client -r

Role: ssh-admin-group
Description: Super Admin Role
Allowed Principals: admin
Allowed CAs: production,nonproduction
```

List available certificate authorities:
```
$ ca-client -c

CA name: nonproduction
Max duration: 30d

CA name: production
Max duration: 24h
```

Initiate signing request for the nonproduction certificate authority:
```
$ ca-client -s nonproduction
Please enter password for username:

/Users/username/.ssh/nonproduction_rsa-cert.pub updated

Identity added: /Users/username/.ssh/nonproduction_rsa (/Users/username/.ssh/nonproduction_rsa)
Certificate added: /Users/username/.ssh/nonproduction_rsa-cert.pub (username)
Identity loaded for current session but ssh-agent will not persist identities on reboot

If using bash you can add the following command to your .bash_profile
ssh-add /Users/username/.ssh/nonproduction_rsa
```

The ca-client will create a unique keypair for each of the requested certificate authorities within the users .ssh folder.

Example users .ssh folder after requesting certs from production and nonproduction certificate authority.
```
$ ls ~/.ssh

nonproduction_rsa nonproduction_rsa-cert.pub nonproduction_rsa.pub
production_rsa production_rsa-cert.pub production_rsa.pub
```

The below examples shows the result of a successfully signed SSH certificate:

```
$ ssh-keygen -L -f ~/.ssh/nonproduction_rsa-cert.pub

~/.ssh/nonproduction_rsa-cert.pub:
Type: ssh-rsa-cert-v01@openssh.com user certificate
Public key: RSA-CERT 3c:3d:47:...
Signing CA: RSA 2b:2a:23:...
Key ID: "username"
Serial: 12515602213705584981
Valid: from 2017-02-06T17:03:00 to 2017-03-08T17:04:44
Principals:
username
admin
Critical Options: (none)
Extensions:
permit-X11-forwarding
permit-agent-forwarding
permit-port-forwarding
permit-pty
permit-user-rc
```

Metadata

Release files for ca-client 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ca-client 0.1.0
File Size Uploaded Provenance Actions
ca-client-0.1.0.tar.gz 8.2 kB Without provenance Details for ca-client-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ca-client 0.1.0
File Interpreter ABI Platform Actions
ca_client-0.1.0-py3.3.egg Legacy Egg format - - Details for ca_client-0.1.0-py3.3.egg
ca_client-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for ca_client-0.1.0-py2.py3-none-any.whl

Total release size: 38.9 kB

Release files / ca-client-0.1.0.tar.gz

Download URL ca-client-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
28789cf612d4c64fdb371f8162352954d6c0bc34ae6333afbcb86cd21f050815
BLAKE2b-256 checksum
How to use checksums
5f2488b9b0202ca2aa375425d51f9f9554c31c167bf7f1a2b2c583da19834453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ca_client-0.1.0-py3.3.egg

Download URL ca_client-0.1.0-py3.3.egg
Size 18.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
32f1207468b92aea05f34d3358a9f7dfb5a2bef69e2bd5ce2e59b9a8e0b78a9e
BLAKE2b-256 checksum
How to use checksums
c06defbda8e9ce7e287fb540e69963a96065f5fb0b1b131cc53c8cfa75648faa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ca_client-0.1.0-py2.py3-none-any.whl

Download URL ca_client-0.1.0-py2.py3-none-any.whl
Size 12.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5cca86ad5fefaab6dc755304a049e5c46757d4bf5f82a45f754916b71982ffcc
BLAKE2b-256 checksum
How to use checksums
e5005fabb87b65225e0869d1e6211046326a301b620158debaf6324dc1547d14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ca-client 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page