Skip to content

Commit

Permalink
Revert ssh CA config to unified user/host key, but keep the support f…
Browse files Browse the repository at this point in the history
…or split
  • Loading branch information
elonen committed Aug 17, 2024
1 parent b395939 commit 0db3be9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 45 deletions.
51 changes: 11 additions & 40 deletions hsm-conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ general:
nac: 3
gpg: 4
codesign: 5
ssh_user: 6
ssh_host: 7
password_derivation: 8
encryption: 9
ssh: 6
password_derivation: 7
encryption: 8

x509_defaults:
ca: true
Expand Down Expand Up @@ -129,7 +128,7 @@ admin:
user_keys:
- label: user_john.doe
id: 0xE001
domains: ['tls', 'nac', 'gpg', 'codesign', 'ssh_user', 'ssh_host', 'password_derivation', 'encryption']
domains: ['tls', 'nac', 'gpg', 'codesign', 'ssh', 'password_derivation', 'encryption']
capabilities:
- sign-ssh-certificate # For SSH certificate creation
- sign-hmac # For password derivation
Expand Down Expand Up @@ -579,59 +578,31 @@ codesign:
# OpenSSH certificates are in proprietary format, so these are not signed by the X.509 root CAs.
ssh:
default_user_ca: 0x0720
default_host_ca: 0x0721
default_host_ca: 0x0720 # You could separate these, but given the HSM, having to change one but not the other is unlikely
root_ca_keys:
-
label: ssh-rsa-user-ca-root-key
label: ssh-rsa-ca-root-key
id: 0x0710
domains: ['ssh_user']
domains: ['ssh']
algorithm: rsa4096
capabilities:
- sign-ssh-certificate
- sign-pss
- sign-pkcs
- exportable-under-wrap
-
label: ssh-ed25519-user-ca-root-key
label: ssh-ed25519-ca-root-key
id: 0x0720
domains: ['ssh_user']
domains: ['ssh']
algorithm: ed25519
capabilities:
- sign-ssh-certificate
- sign-eddsa
- exportable-under-wrap
-
label: ssh-ecp384-user-ca-root-key
label: ssh-ecp384-ca-root-key
id: 0x0730
domains: ['ssh_user']
algorithm: ecp384
capabilities:
- sign-ssh-certificate
- sign-ecdsa
- exportable-under-wrap
-
label: ssh-rsa-host-ca-root-key
id: 0x0711
domains: ['ssh_host']
algorithm: rsa4096
capabilities:
- sign-ssh-certificate
- sign-pss
- sign-pkcs
- exportable-under-wrap
-
label: ssh-ed25519-host-ca-root-key
id: 0x0721
domains: ['ssh_host']
algorithm: ed25519
capabilities:
- sign-ssh-certificate
- sign-eddsa
- exportable-under-wrap
-
label: ssh-ecp384-host-ca-root-key
id: 0x0731
domains: ['ssh_host']
domains: ['ssh']
algorithm: ecp384
capabilities:
- sign-ssh-certificate
Expand Down
5 changes: 2 additions & 3 deletions hsm_secrets/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,15 @@ def algorithm_from_name(algo: Union['AsymmetricAlgorithm', 'SymmetricAlgorithm',
HSMKeyID = Annotated[int, Field(strict=True, gt=0, lt=0xFFFF)]
HSMKeyLabel = Annotated[str, Field(max_length=40)]
HSMDomainNum = Annotated[int, Field(strict=True, gt=0, lt=17)]
HSMDomainName = Literal["all", "x509", "tls", "nac", "gpg", "codesign", "ssh_user", "ssh_host", "password_derivation", "encryption"]
HSMDomainName = Literal["all", "x509", "tls", "nac", "gpg", "codesign", "ssh", "password_derivation", "encryption"]

class HSMDomains(NoExtraBaseModel):
x509: HSMDomainNum
tls: HSMDomainNum
nac: HSMDomainNum
gpg: HSMDomainNum
codesign: HSMDomainNum
ssh_user: HSMDomainNum
ssh_host: HSMDomainNum
ssh: HSMDomainNum
password_derivation: HSMDomainNum
encryption: HSMDomainNum

Expand Down
4 changes: 2 additions & 2 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ EOF

local count=$(run_cmd -q hsm compare | grep -c '\[x\]')
assert_success
[ "$count" -eq 39 ] || { echo "Expected 39 objects, but found $count"; return 1; }
[ "$count" -eq 36 ] || { echo "Expected 36 objects, but found $count"; return 1; }

# Remove default admin key
run_cmd hsm default-admin-disable
assert_success
local count=$(run_cmd -q hsm compare | grep -c '\[x\]')
assert_success
[ "$count" -eq 38 ] || { echo "Expected 38 objects, but found $count"; return 1; }
[ "$count" -eq 35 ] || { echo "Expected 35 objects, but found $count"; return 1; }
}

test_tls_certificates() {
Expand Down

0 comments on commit 0db3be9

Please sign in to comment.