Skip to content
Commits on Source (3)
......@@ -35,6 +35,7 @@ repos:
rev: v0.6.0
hooks:
- id: shell-lint
exclude: \.bats$
- repo: https://github.com/shellcheck-py/shellcheck-py.git
rev: v0.7.1.1
......
......@@ -31,7 +31,7 @@ ssh-ca signuser username
```
To sign a host's public key (found under
hosts/\<hostname>/[ssh\_host](<>)\*.pub)
hosts/\<hostname>/[ssh_host](<>)\*.pub)
```shell
ssh-ca signhost hostname
......@@ -60,7 +60,7 @@ ssh-ca newuser username
HostCertificate /path/to/the/signed/public/key
```
1. Add a line to your known\_hosts file to authorize signed public keys
1. Add a line to your known_hosts file to authorize signed public keys
to a specific top level domain. For example if your domain is
example.com and the contents of `CA.pub` is:
......@@ -74,7 +74,7 @@ Then the line will be:
@cert-authority *.example.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2fAkeidfnPn712B4uW3XhKyFt9FcJtVwSPKDSCykULg3X5gVV/Xa1yb4ameY3ihXOqQOlG3YpYnOQ8KdM67WtnERVbTJIfieRjGzoURz9NquLFXSKsuQrXMWRNHqXAHw7VirPvKL4cSc4l00Az1HDnHhMIclPY8G+8SkRIRsTwwwa5QjGF2wuhC6j5UHJSaF7qLFw9FSaCsEJTkQxtCD4+Rd/dxv3kVWSkm5DbNG0z3QHyISW7XDvyXP+1ccSb5+IWC0yQCT4OJNFUMDb+SdD7AzDHfI9Z5zTp56uGV23lywWhSvv20UPA0SyXJNGPOw7uJ1ak8q4SBh60PtOENQf ssh-ca
```
\#. You can also add it system wide by adding the above line to
#. You can also add it system wide by adding the above line to
`/etc/ssh/ssh_known_hosts` and the following line to your
`ssh_config` file:
......@@ -82,7 +82,7 @@ Then the line will be:
GlobalKnownHostsFile /etc/ssh/ssh_known_hosts
```
1. For strict security, add the following line to you ssh\_config file:
1. For strict security, add the following line to you ssh_config file:
```
StrictHostKeyChecking yes
......
......@@ -15,31 +15,35 @@ teardown () {
echo "@cert-authority * $(cat CA.pub)" > known_hosts
# Generating sshd_config
echo "ListenAddress 127.0.0.1:22222" > sshd_config
echo "HostKey $PWD/hosts/localhost/ssh_host_rsa_key" >> sshd_config
echo "HostKey $PWD/hosts/localhost/ssh_host_dsa_key" >> sshd_config
echo "HostKey $PWD/hosts/localhost/ssh_host_ecdsa_key" >> sshd_config
echo "HostKey $PWD/hosts/localhost/ssh_host_ed25519_key" >> sshd_config
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_rsa_key-cert.pub" >> sshd_config
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_dsa_key-cert.pub" >> sshd_config
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_ecdsa_key-cert.pub" >> sshd_config
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_ed25519_key-cert.pub" >> sshd_config
echo "PidFile sshd.pid" >> sshd_config
echo "UsePrivilegeSeparation no" >> sshd_config
echo "MaxAuthTries 20" >> sshd_config
echo "TrustedUserCAKeys $PWD/CA.pub" >> sshd_config
{
echo "ListenAddress 127.0.0.1:22222"
echo "HostKey $PWD/hosts/localhost/ssh_host_rsa_key"
echo "HostKey $PWD/hosts/localhost/ssh_host_dsa_key"
echo "HostKey $PWD/hosts/localhost/ssh_host_ecdsa_key"
echo "HostKey $PWD/hosts/localhost/ssh_host_ed25519_key"
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_rsa_key-cert.pub"
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_dsa_key-cert.pub"
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_ecdsa_key-cert.pub"
echo "HostCertificate $$PWD/hosts/localhost/ssh_host_ed25519_key-cert.pub"
echo "PidFile sshd.pid"
echo "UsePrivilegeSeparation no"
echo "MaxAuthTries 20"
echo "TrustedUserCAKeys $PWD/CA.pub"
} > sshd_config
# Generating ssh_config
echo "Host test" > ssh_config
echo "HostName localhost" >> ssh_config
echo "Port 22222" >> ssh_config
echo "IdentityFile users/%u/id_rsa" >> ssh_config
echo "IdentityFile users/%u/id_dsa" >> ssh_config
echo "IdentityFile users/%u/id_ecdsa" >> ssh_config
echo "IdentityFile users/%u/id_ed25519" >> ssh_config
echo "UserKnownHostsFile known_hosts" >> ssh_config
echo "StrictHostKeyChecking yes" >> ssh_config
echo "BatchMode yes" >> ssh_config
{
echo "Host test"
echo "HostName localhost"
echo "Port 22222"
echo "IdentityFile users/%u/id_rsa"
echo "IdentityFile users/%u/id_dsa"
echo "IdentityFile users/%u/id_ecdsa"
echo "IdentityFile users/%u/id_ed25519"
echo "UserKnownHostsFile known_hosts"
echo "StrictHostKeyChecking yes"
echo "BatchMode yes"
} > ssh_config
# Launching test sshd
$(PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin which sshd) -f sshd_config
......