{"id":973,"date":"2024-09-06T14:39:49","date_gmt":"2024-09-06T12:39:49","guid":{"rendered":"https:\/\/www.cipv6.de\/worp\/?p=973"},"modified":"2024-12-16T10:26:57","modified_gmt":"2024-12-16T09:26:57","slug":"manual-steps-for-certificate-based-ssh-communication","status":"publish","type":"post","link":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/","title":{"rendered":"Lab setup: Secure your SSH communication with certificates"},"content":{"rendered":"\n<p class=\"has-medium-font-size\">When you Ssh the first time to a host the screen shows something like:<\/p>\n\n\n\n<pre class=\"wp-block-code has-cyan-bluish-gray-color has-black-background-color has-text-color has-background has-link-color wp-elements-f54468b557775002f0b754f15f54e901\"><code class=\"\">ssh test@10.50.100.110\nThe authenticity of host '10.50.100.110 (10.50.100.110)' can't be established.\nED25519 key fingerprint is SHA256:jCJ0TIJkKnjgu3RTv5eGER7p4IN5Tb\/JpTEVJNMfpMs.\nThis key is not known by any other names\nAre you sure you want to continue connecting (yes\/no\/[fingerprint])?<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">Be honest: Do you just accept the shown Fingerprint of the remote host or do you really doublecheck the presented fingerprint before you accept  ?<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><em>My guess: Most of the time the presented fingerprint gets accepted without any additional check. <\/em><\/p>\n\n\n\n<p class=\"has-medium-font-size\">This procedure is called <strong>TOFU<\/strong> (<strong>T<\/strong>rust<strong> O<\/strong>n<strong> F<\/strong>irst<strong> U<\/strong>se).<br><strong>TOFU<\/strong> assumes that the first time you connect to a server, the server\u2019s key is trustworthy. However, this can leave you vulnerable to man-in-the-middle attacks if an attacker intercepts the initial connection. The attacker grabs your user\/password credentials and can get access.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Here are some implementations who are using TOFU:<\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>Android Enterprise Networks<\/strong>: Android supports TOFU for enterprise networks by allowing devices to trust an enterprise network by installing the root CA used by the server and setting its domain name in a saved network.<\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>Signal<\/strong>: In Signal, endpoints initially trust the identifier blindly and display non-blocking warnings when it changes.&nbsp;Users can verify the identifier by scanning a QR code or exchanging a Safety Number, which then changes the nature of identifier change warnings from non-blocking to blocking.<\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>WhatsApp<\/strong>: WhatsApp clients initially trust the identifier blindly and, by default, do not display warnings when the identifier changes.&nbsp;Users can enable non-blocking warnings by accessing the key fingerprint (called Security Code) and verifying it.<\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>XMPP Client Conversations<\/strong>: This client uses Blind Trust Before Verification, where all identifiers are blindly trusted until the user authenticates endpoints by scanning a QR code.&nbsp;Once verified, the client displays a shield symbol for authenticated messages.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong><em>By using certificates for SSH authentication, you can eliminate the risks associated with<\/em><\/strong> <strong>TOFU<\/strong>. Key approval (and distribution)\u00a0is no more necessary with certificate-based Ssh.<br><br>Certificates provide a more robust and secure method of verifying identities, ensuring that both the client and server can trust each other without relying on the initial Ssh-connection\u2019s integrity.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"> This lab-setup is based on the open-source version of <a href=\"https:\/\/smallstep.com\/certificates\/\">Smallstep<\/a>, a powerful tool that simplifies the process of managing and issuing certificates.<br>Want to test cert-based ssh without smallstep ? go ahead, here are some getting started urls:<br>&#8211;<a href=\"https:\/\/goteleport.com\/blog\/how-to-configure-ssh-certificate-based-authentication\/\">https:\/\/goteleport.com\/blog\/how-to-configure-ssh-certificate-based-authentication\/<\/a><br>&#8211;<a href=\"https:\/\/blog.habets.se\/2011\/07\/OpenSSH-certificates.html\">https:\/\/blog.habets.se\/2011\/07\/OpenSSH-certificates.html<\/a><br>&#8211;<a href=\"https:\/\/www.sweharris.org\/post\/2016-10-30-ssh-certs\/\">https:\/\/www.sweharris.org\/post\/2016-10-30-ssh-certs\/<\/a><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Before we dive into the lab, let\u2019s first take a look at some key pros and cons related to this topic.<br><br><strong><em>Advantages when using certificate-based ssh:<\/em><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Enhanced Security<\/strong>: Certificates provide a higher level of security compared to traditional SSH keys. They are issued by a trusted Certificate Authority (CA), which ensures that both the client and server are who they claim to be.<\/li>\n\n\n\n<li><strong>Elimination of TOFU Risks<\/strong>: By using certificates, you eliminate the Trust On First Use (TOFU) risks associated with traditional SSH key exchanges. This reduces the chances of man-in-the-middle attacks during the initial connection.<\/li>\n\n\n\n<li><strong>Simplified Key Management<\/strong>: Certificates simplify the management of SSH keys. They can be easily issued, renewed, and revoked by the CA, making it easier to manage credentials in large environments.<\/li>\n\n\n\n<li><strong>Scalability<\/strong>: Certificate-based authentication scales well in large environments. Automated tools can be used to handle the issuance, renewal, and revocation of certificates, making it easier to manage a large number of users and systems. <\/li>\n\n\n\n<li><strong>Improved Compliance<\/strong>: Using certificates can help meet regulatory and compliance requirements for secure communications. This provides an added layer of assurance for your organization.<\/li>\n\n\n\n<li><strong>Revocation Capability<\/strong>: If a certificate is compromised, it can be revoked by the CA, rendering it invalid. This provides a way to quickly respond to security incidents and prevent unauthorized access.<\/li>\n\n\n\n<li><strong>Expiration and Renewal<\/strong>: Certificates have a defined validity period, which means they need to be renewed periodically. This ensures that outdated or potentially compromised credentials are regularly updated.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size\"><br><strong><em>Dis<\/em><\/strong><em>advantages<\/em><strong><em> when using certificate-based ssh:<\/em><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Initial Setup Time<\/strong>: The initial setup of a certificate authority (CA) and the issuance of certificates can be time-consuming. This includes configuring the CA, generating certificates, and distributing them to clients and servers.<\/li>\n\n\n\n<li><strong>Complexity<\/strong>: Setting up and managing a certificate-based SSH infrastructure can be more complex compared to traditional key-based authentication. It requires a good understanding of Public Key Infrastructure (PKI) and certificate management.<\/li>\n\n\n\n<li><strong>Compatibility<\/strong>: Not all systems and applications may support certificate-based SSH authentication out of the box. Additional configuration or software may be required to enable this feature.<\/li>\n\n\n\n<li><strong>Maintenance<\/strong>: Regular maintenance is required to keep the certificate infrastructure secure. This includes renewing certificates before they expire, revoking compromised certificates, and ensuring the CA remains secure.<\/li>\n\n\n\n<li><strong>Dependency on CA<\/strong>: The security of the entire system relies on the integrity and security of the CA. If the CA is compromised, the entire certificate-based authentication system can be at risk.<\/li>\n<\/ul>\n\n\n\n<p>OK. Ready to go ? <br><br>This is the lab setup:<br><\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Hostname<\/strong><\/th><th><strong>Mac-address<\/strong><\/th><th><strong>IP-address<\/strong><\/th><\/tr><\/thead><tbody><tr><td>step <\/td><td>00:0c:29:fd:94:15 <\/td><td>10.50.100.110<\/td><\/tr><tr><td>clientstep1<\/td><td>00:0c:29:3d:c8:a5 <\/td><td>10.50.100.111<\/td><\/tr><tr><td>clientstep2<\/td><td>00:0c:29:41:a1:5c <\/td><td>10.50.100.112<\/td><\/tr><tr><td>rogueclient<\/td><td>00:0c:af:ee:af:fe <\/td><td><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">Setup <a href=\"https:\/\/smallstep.com\/docs\/step-ca\/\">step-ca Server<\/a> on host step<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"># install needed packages\nwget https:\/\/dl.smallstep.com\/cli\/docs-cli-install\/latest\/step-cli_amd64.rpm\nrpm -i step-cli_amd64.rpm\nwget https:\/\/dl.smallstep.com\/certificates\/docs-ca-install\/latest\/step-ca_amd64.rpm\nsudo rpm -i step-ca_amd64.rpm\n\n#check version(s)\n[root@step step]# step version\nSmallstep CLI\/0.27.2 (linux\/amd64)\nRelease Date: 2024-07-18T18:15:09Z\n\n[root@step step]# step-ca version\nSmallstep CA\/0.27.2 (linux\/amd64)\nRelease Date: 2024-07-18T21:29:11Z\n[root@step step]#\n\n#setup step ca\n[root@step step]# step ca init -ssh\nUse the arrow keys to navigate: \u2193 \u2191 \u2192 \u2190\n? What deployment type would you like to configure?:\n  \u25b8 Standalone - step-ca instance you run yourself\n    Linked - standalone, plus cloud configuration, reporting &amp; alerting\n    Hosted - fully-managed step-ca cloud instance run for you by smallstep\n\u2714 Deployment Type: Standalone\nWhat would you like to name your new PKI?\n\u2714 (e.g. Smallstep): step\nWhat DNS names or IP addresses will clients use to reach your CA?\n\u2714 (e.g. ca.example.com[,10.1.2.3,etc.]): step,10.50.100.110\nWhat IP and port will your new CA bind to? (:443 will bind to 0.0.0.0:443)\n\u2714 (e.g. :443 or 127.0.0.1:443): :443\u2588\nWhat would you like to name the CA's first provisioner?\n\u2714 (e.g. you@smallstep.com): ugu5ma@step\nChoose a password for your CA keys and first provisioner.\n\u2714 [leave empty and we'll generate one]:\n\nGenerating root certificate... done!\nGenerating intermediate certificate... done!\nGenerating user and host SSH certificate signing keys... done!\n\n\u2714 Root certificate: \/root\/.step\/certs\/root_ca.crt\n\u2714 Root private key: \/root\/.step\/secrets\/root_ca_key\n\u2714 Root fingerprint: fb31925c37a688d0821420eb25e5f1e6c03ca0c7d51e48516b14bdc13ff5ccdd\n\u2714 Intermediate certificate: \/root\/.step\/certs\/intermediate_ca.crt\n\u2714 Intermediate private key: \/root\/.step\/secrets\/intermediate_ca_key\n\u2714 SSH user public key: \/root\/.step\/certs\/ssh_user_ca_key.pub\n\u2714 SSH user private key: \/root\/.step\/secrets\/ssh_user_ca_key\n\u2714 SSH host public key: \/root\/.step\/certs\/ssh_host_ca_key.pub\n\u2714 SSH host private key: \/root\/.step\/secrets\/ssh_host_ca_key\n\u2714 Database folder: \/root\/.step\/db\n\u2714 Templates folder: \/root\/.step\/templates\n\u2714 Default configuration: \/root\/.step\/config\/defaults.json\n\u2714 Certificate Authority configuration: \/root\/.step\/config\/ca.json\n\nYour PKI is ready to go. To generate certificates for individual services see 'step help ca'.\n\nFEEDBACK \ud83d\ude0d \ud83c\udf7b\n  The step utility is not instrumented for usage statistics. It does not phone\n  home. But your feedback is extremely valuable. Any information you can provide\n  regarding how you\u2019re using `step` helps. Please send us a sentence or two,\n  good or bad at feedback@smallstep.com or join GitHub Discussions\n  https:\/\/github.com\/smallstep\/certificates\/discussions and our Discord\n  https:\/\/u.step.sm\/discord.\n[root@step step]#\n\n#run your ssh-ca\n[root@step step]# step-ca $(step path)\/config\/ca.json\nbadger 2024\/09\/06 10:50:53 INFO: All 1 tables opened in 1ms\nbadger 2024\/09\/06 10:50:53 INFO: Replaying file id: 0 at offset: 7306\nbadger 2024\/09\/06 10:50:53 INFO: Replay took: 9.758\u00b5s\nPlease enter the password to decrypt \/root\/.step\/secrets\/intermediate_ca_key:\nPlease enter the password to decrypt \/root\/.step\/secrets\/ssh_host_ca_key:\nPlease enter the password to decrypt \/root\/.step\/secrets\/ssh_user_ca_key:\n2024\/09\/06 10:51:00 Building new tls configuration using step-ca x509 Signer Interface\n2024\/09\/06 10:51:00 Starting Smallstep CA\/0.27.2 (linux\/amd64)\n2024\/09\/06 10:51:00 Documentation: https:\/\/u.step.sm\/docs\/ca\n2024\/09\/06 10:51:00 Community Discord: https:\/\/u.step.sm\/discord\n2024\/09\/06 10:51:00 Config file: \/root\/.step\/config\/ca.json\n2024\/09\/06 10:51:00 The primary server URL is https:\/\/step:443\n2024\/09\/06 10:51:00 Root certificates are available at https:\/\/step:443\/roots.pem\n2024\/09\/06 10:51:00 Additional configured hostnames: 10.50.100.110\n2024\/09\/06 10:51:00 X.509 Root Fingerprint: fb31925c37a688d0821420eb25e5f1e6c03ca0c7d51e48516b14bdc13ff5ccdd\n2024\/09\/06 10:51:00 SSH Host CA Key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKliAvQoL0eRNGMXMUFSSOBzo8fjzsnb1ztakctwFJUnsgzSCCWhXDky5B59CQcw\/m8fb\/0DDWv0Vyw7YYRkLJM=\n2024\/09\/06 10:51:00 SSH User CA Key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAWRNNWJj9uhoM5PZ4rkQP0yzeW9F2+73UqCmQSAdDcukUzHmMlVet5yDpbOqfkjAVwokW68cS9OfzEXetd41y0=\n2024\/09\/06 10:51:00 Serving HTTPS on 10.50.100.110:443 ...\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">we need later the shown fingerprint, this is a good time to copy the string (fb319&#8230;.cdd). <br><\/li>\n\n\n\n<li class=\"has-medium-font-size\">Setup <strong>clientstep1<\/strong> as ssh-daemon who only accept ssh-certificates of our new ssh ca:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">wget https:\/\/dl.smallstep.com\/cli\/docs-cli-install\/latest\/step-cli_amd64.rpm\nrpm -i step-cli_amd64.rpm\n[root@clientstep1 ugu5ma]# step version\nSmallstep CLI\/0.27.2 (linux\/amd64)\nRelease Date: 2024-07-18T18:15:09Z\n[root@clientstep1 ugu5ma]#\n\n*** To configure step to access your CA from a new host, run step ca bootstrap --ca-url [CA URL] --fingerprint [CA fingerprint] :\n[root@clientstep1 ugu5ma]# step ca bootstrap --ca-url https:\/\/10.50.100.110:443 --fingerprint fb31925c37a688d0821420eb25e5f1e6c03ca0c7d51e48516b14bdc13ff5ccdd\nThe root certificate has been saved in \/root\/.step\/certs\/root_ca.crt.\nThe authority configuration has been saved in \/root\/.step\/config\/defaults.json.\n#### trust your SSH user CA \n[root@clientstep1 ugu5ma]# step ssh config --roots &gt; \/path\/to\/ssh_user_key.pub\nbash: \/path\/to\/ssh_user_key.pub: No such file or directory\n[root@clientstep1 ugu5ma]# step certificate install $(step path)\/certs\/root_ca.crt\nCertificate \/root\/.step\/certs\/root_ca.crt has been installed.\nX.509v3 Root CA Certificate (ECDSA P-256) [Serial: 1777...5197]\n  Subject:     step Root CA\n  Issuer:      step Root CA\n  Valid from:  2024-09-06T08:40:14Z\n          to:  2034-09-04T08:40:14Z\n#### let's sign a host-certificate for:\n##### principal1      = clientstep1\n##### principal2      = clientstep1.fritz.box\n##### certificate-id  = ubuarmlts \n[root@clientstep1 ugu5ma]# sudo -E step ssh certificate ubuarmlts \/etc\/ssh\/ssh_host_ecdsa_key.pub --host --sign --principal clientstep1  --principal clientstep1.fritz.box\nUse the arrow keys to navigate: \u2193 \u2191 \u2192 \u2190\nWhat provisioner key do you want to use?\n  \u25b8 ugu5ma@step (JWK) [kid: DFYsQuqHCCpjx2uXeDYiZEI0V8aH2tAcK54qGPyHbzA]\n    sshpop (SSHPOP)\nPlease enter the password to decrypt the provisioner key:\n\u2714 CA: https:\/\/10.50.100.110:443\n\u2714 Certificate: \/etc\/ssh\/ssh_host_ecdsa_key-cert.pub\n#### \n#### run the following command and add the following to your SSHD configuration (vi \/etc\/ssh\/sshd_config)\n####\n[root@clientstep1 ssh]# step ssh config --roots &gt; \/etc\/ssh\/ssh_user_key.pub\n####&nbsp;add the following to SSHD config(vi \/etc\/ssh\/sshd_config)\n# This is our host private key and certificate:\nHostKey \/etc\/ssh\/ssh_host_ecdsa_key\nHostCertificate \/etc\/ssh\/ssh_host_ecdsa_key-cert.pub\n*** Configure SSH clients to trust your host CA\n** To view the host key, run: step ssh config --host --roots\n\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">Setup <strong>clientstep2<\/strong> as cert-based ssh-client <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">#\n#&gt;&gt;&gt;bootstrap the host as shown on stepclient1&lt;&lt;&lt;\n#\n#Let's create an SSH user certificate for user ugu5ma\n[ugu5ma@clientstep2 ~]$ cd \/home\/ugu5ma\/.ssh\n[ugu5ma@clientstep2 ~]$ step ssh certificate ugu5ma@step id_ecdsa\nUse the arrow keys to navigate: \u2193 \u2191 \u2192 \u2190\nWhat provisioner key do you want to use?\n  \u25b8 ugu5ma@step (JWK) [kid: DFYsQuqHCCpjx2uXeDYiZEI0V8aH2tAcK54qGPyHbzA]\n    sshpop (SSHPOP)\n\u2714 Provisioner: ugu5ma@step (JWK) [kid: DFYsQuqHCCpjx2uXeDYiZEI0V8aH2tAcK54qGPyHbzA]\nPlease enter the password to decrypt the provisioner key:\n\u2714 CA: https:\/\/10.50.100.110:443\nPlease enter the password to encrypt the private key: \u2588\n\u2714 Private Key: id_ecdsa\n\u2714 Public Key: id_ecdsa.pub\n\u2714 Certificate: id_ecdsa-cert.pub\n\n### Trust your ssh-CA, run command:\n[ugu5ma@clientstep2 .ssh]$ step ssh config --host --roots\necdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKliAvQoL0eRNGMXMUFSSOBzo8fjzsnb1ztakctwFJUnsgzSCCWhXDky5B59CQcw\/m8fb\/0DDWv0Vyw7YYRkLJM=\n\n### add the output to .ssh\/known_hosts (vi \/home\/ugu5ma\/.ssh\/known_hosts)\n@cert-authority * ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKliAvQoL0eRNGMXMUFSSOBzo8fjzsnb1ztakctwFJUnsgzSCCWhXDky5B59CQcw\/m8fb\/0DDWv0Vyw7YYRkLJM=\n\n### verify\n\n[ugu5ma@clientstep2 .ssh]$ cat \/home\/ugu5ma\/.ssh\/known_hosts\n@cert-authority * ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKliAvQoL0eRNGMXMUFSSOBzo8fjzsnb1ztakctwFJUnsgzSCCWhXDky5B59CQcw\/m8fb\/0DDWv0Vyw7YYRkLJM=\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>next we try to connect from <strong>clientstep2<\/strong> to <strong>clientstep1<\/strong>:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">### let's ssh to clientstep1 and verify the communication:\n\n[ugu5ma@clientstep2 .ssh]$ ssh ugu5ma@clientstep1 -vv\nOpenSSH_8.7p1, OpenSSL 3.0.7 1 Nov 2022\n#\n# uninteresting output deleted...\n#\ndebug2: resolving \"clientstep1.fritz.box\" port 22\ndebug1: Connecting to clientstep1.fritz.box [10.50.100.111] port 22.\ndebug1: Connection established.\ndebug1: Local version string SSH-2.0-OpenSSH_8.7\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_8.7\ndebug1: compat_banner: match: OpenSSH_8.7 pat OpenSSH* compat 0x04000000\ndebug2: fd 3 setting O_NONBLOCK\ndebug1: Authenticating to clientstep1.fritz.box:22 as 'ugu5ma'\ndebug1: Server host certificate: ecdsa-sha2-nistp256-cert-v01@openssh.com SHA256:5OW2e\/VviIjRptZ9L5exCm6xW3jwUI2BEM9Zx8MAb0A, serial 5287235044766806569 ID \"ubuarmlts\" CA ecdsa-sha2-nistp256 SHA256:jC3GukYmJNtdbqDF0J17DiFU98TW2\/TlFNyQ2XG58PE valid from 2024-09-06T11:11:00 to 2024-10-06T11:12:00\ndebug2: Server host certificate hostname: clientstep1\ndebug2: Server host certificate hostname: clientstep1.fritz.box\ndebug1: Host 'clientstep1.fritz.box' is known and matches the ECDSA-CERT host certificate.\ndebug1: Found CA key in \/home\/ugu5ma\/.ssh\/known_hosts:1\ndebug1: Will attempt key: \/home\/ugu5ma\/.ssh\/id_ecdsa ECDSA-CERT SHA256:wBhbhAOlVpUXCKsuuAvN8+LV6ZLZuMpsv7GPySw3874 agent\ndebug2: pubkey_prepare: done\ndebug2: service_accept: ssh-userauth\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug1: Server accepts key: \/home\/ugu5ma\/.ssh\/id_ecdsa ECDSA-CERT SHA256:wBhbhAOlVpUXCKsuuAvN8+LV6ZLZuMpsv7GPySw3874 agent\ndebug2: sign_and_send_pubkey: using private key \"\/home\/ugu5ma\/.ssh\/id_ecdsa\" from agent for certificate\nAuthenticated to clientstep1 ([10.50.100.111]:22) using \"publickey\".\n[ugu5ma@clientstep1 ~]$<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Looks good! No TOFU as well \ud83d\ude42<\/li>\n\n\n\n<li>Lets try as next an ssh attempt from rogueclient without certificates:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ugu5ma@rogueclient:ssh ugu5ma@10.50.100.111 -vv\ndebug1: SSH2_MSG_KEX_ECDH_REPLY received\ndebug1: Server host certificate: ecdsa-sha2-nistp256-cert-v01@openssh.com SHA256:5OW2e\/VviIjRptZ9L5exCm6xW3jwUI2BEM9Zx8MAb0A, serial 5287235044766806569 ID \"ubuarmlts\" CA ecdsa-sha2-nistp256 SHA256:jC3GukYmJNtdbqDF0J17DiFU98TW2\/TlFNyQ2XG58PE valid from 2024-09-06T11:11:00 to 2024-10-06T11:12:00\ndebug2: Server host certificate hostname: clientstep1\ndebug2: Server host certificate hostname: clientstep1.fritz.box\ndebug1: Next authentication method: publickey\ndebug1: Trying private key: \/home\/ugu5ma\/.ssh\/id_rsa\ndebug1: Trying private key: \/home\/ugu5ma\/.ssh\/id_ecdsa\ndebug1: Trying private key: \/home\/ugu5ma\/.ssh\/id_ecdsa_sk\ndebug1: Trying private key: \/home\/ugu5ma\/.ssh\/id_ed25519\ndebug1: Trying private key: \/home\/ugu5ma\/.ssh\/id_ed25519_sk\ndebug1: Trying private key: \/home\/ugu5ma\/.ssh\/id_xmss\ndebug1: Trying private key: \/home\/ugu5ma\/.ssh\/id_dsa\ndebug2: we did not send a packet, disable method\ndebug1: No more authentication methods to try.\nugu5ma@10.50.100.111: Permission denied (publickey).<\/code><\/pre>\n\n\n\n<p>any ssh-attempt from rogueclient is denied because the client is not equipped with a valid ssh-certificate (best practice setting of &#8220;<strong><em>PasswordAuthentication no<\/em><\/strong>&#8221; and &#8220;<strong><em>PubkeyAuthentication yes<\/em><\/strong>&#8220;in sshd_config on <strong>clientstep1<\/strong> must be enabled to avoid circumventing the security framework. ).<br><\/p>\n\n\n\n<p class=\"has-large-font-size\">Is the shown setup suitable for productive use ? <strong>NO!<\/strong><br>Smallstep has a nice <a href=\"https:\/\/smallstep.com\/docs\/step-ca\/certificate-authority-server-production\/\">overview<\/a> what topics needs to be considered before going live.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><br>This page is just for setting up a small dev-lab to get handy with ssh-certificates.<br>As always, take backups and redundant console-access before changing anything \ud83d\ude42<\/p>\n\n\n\n<p><br><strong><em>Troubleshooting-commands<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">###check ssh host-certificate on clientstep1\n[root@clientstep1 ssh]# cat \/etc\/ssh\/ssh_host_ecdsa_key-cert.pub | step ssh inspect\n-:\n        Type: ecdsa-sha2-nistp256-cert-v01@openssh.com host certificate\n        Public key: ECDSA-CERT SHA256:5OW2e\/VviIjRptZ9L5exCm6xW3jwUI2BEM9Zx8MAb0A\n        Signing CA: ECDSA SHA256:jC3GukYmJNtdbqDF0J17DiFU98TW2\/TlFNyQ2XG58PE (using ecdsa-sha2-nistp256)\n        Key ID: \"ubuarmlts\"\n        Serial: 5287235044766806569\n        Valid: from 2024-09-06T11:11:00 to 2024-10-06T11:12:00\n        Principals:\n                clientstep1\n                clientstep1.fritz.box\n        Critical Options: (none)\n        Extensions: (none)\n        Signature:\n                00:00:00:20:33:ac:f7:8e:4d:4c:60:26:5f:5e:83:18:\n                a0:ef:25:3c:4f:49:3d:56:1d:c8:96:b0:3e:63:ee:1d:\n                c5:27:8b:5e:00:00:00:21:00:d5:07:b2:13:ea:07:2d:\n                57:4c:95:15:aa:5f:0c:95:71:f5:ec:11:86:a7:d9:f3:\n                95:b3:12:d6:2a:15:39:03:07\n[root@clientstep1 ssh]#\n\n###check ssh user-certificate on clientstep2\n[ugu5ma@clientstep2 .ssh]$ cat \/home\/ugu5ma\/.ssh\/id_ecdsa-cert.pub | step ssh inspect\n-:\n        Type: ecdsa-sha2-nistp256-cert-v01@openssh.com user certificate\n        Public key: ECDSA-CERT SHA256:wBhbhAOlVpUXCKsuuAvN8+LV6ZLZuMpsv7GPySw3874\n        Signing CA: ECDSA SHA256:H+rgQ6gIM10MCNti1+tJs7H3nUCzrPQ3P5nCH2BqTJ8 (using ecdsa-sha2-nistp256)\n        Key ID: \"ugu5ma@step\"\n        Serial: 4249190036314894073\n        Valid: from 2024-09-06T11:33:43 to 2024-09-07T03:34:43\n        Principals:\n                ugu5ma\n                ugu5ma@step\n        Critical Options: (none)\n        Extensions:\n                permit-port-forwarding\n                permit-pty\n                permit-user-rc\n                permit-X11-forwarding\n                permit-agent-forwarding\n        Signature:\n                00:00:00:21:00:99:07:e1:37:9f:2c:99:28:e1:b3:65:\n                e9:8b:a6:4f:f0:d1:93:66:1f:f1:2d:fe:fa:21:ad:55:\n                15:8b:54:69:fd:00:00:00:20:25:69:6b:00:99:e1:6a:\n                6d:b4:04:af:02:9b:18:ae:0a:85:84:b8:fa:c1:f5:1c:\n                d8:82:cc:f1:e9:07:81:90:38\n[ugu5ma@clientstep2 .ssh]$<\/code><\/pre>\n\n\n\n<p>You see the lifetime of the user-certificate ? It is valid for 16 hours.<br>You can tweak the cert-lifetime during the creation with the parameter <code><em>not-before<\/em><\/code>&nbsp;and&nbsp;<code><em>not-after<\/em><\/code>, example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\"># This certificate will be valid starting 10 minutes from now, until 10 days from now:\n[ugu5ma@clientstep2 .ssh]$ step ssh certificate ugu5ma@step id_ecdsa --not-before=10m --not-after=240h\n###check \n[ugu5ma@clientstep2 .ssh]$ cat \/home\/ugu5ma\/.ssh\/id_ecdsa-cert.pub | step ssh inspect\n-:\n        Type: ecdsa-sha2-nistp256-cert-v01@openssh.com user certificate\n        Public key: ECDSA-CERT SHA256:GOvbmiBstPbiiov0kNF4fApyjeSUhdnvm2xS5QolBFg\n        Signing CA: ECDSA SHA256:H+rgQ6gIM10MCNti1+tJs7H3nUCzrPQ3P5nCH2BqTJ8 (using ecdsa-sha2-nistp256)\n        Key ID: \"ugu5ma@step\"\n        Serial: 1320427072549296678\n        Valid: from 2024-09-06T14:20:58 to 2024-09-16T14:10:58\n        Principals:\n                ugu5ma\n                ugu5ma@step\n        Critical Options: (none)\n<\/code><\/pre>\n\n\n\n<p>The maxUserSSHCertDuration is per default set to 24hours. If you want to extent the User-cert lifetime you have to adjust this parameter (<strong><em>vi  $(step path)\/config\/ca.json<\/em><\/strong>)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">\"authority\": {\n\t\t\"provisioners\": [\n\t\t\t{\n\t\t\t\t\"type\": \"JWK\",\n\t\t\t\t\"name\": \"ugu5ma@step\",\n\t\t\t\t\"key\": {\n\t\t\t\t\t\"use\": \"sig\",\n\t\t\t\t\t\"kty\": \"EC\",\n\t\t\t\t\t\"kid\": \"DFYsQuqHCCpjx2uXeDYiZEI0V8aH2tAcK54qGPyHbzA\",\n\t\t\t\t\t\"crv\": \"P-256\",\n\t\t\t\t\t\"alg\": \"ES256\",\n\t\t\t\t\t\"x\": \"2rF1jfj1sdsSD2yCNLZgDzixPCGVKPP40TJHVHtlpdc\",\n\t\t\t\t\t\"y\": \"_b5YAseg2MzHHOW1it3l0ueJxm0Wm7j-9h5JWk9ROg8\"\n\t\t\t\t},\n\t\t\t\t\"encryptedKey\": \"eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjdHkiOiJqd2sranNvbiIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjYwMDAwMCwicDJzIjoialBOcE53ellPM3RsODcwdUVRMjBMdyJ9.ss7QL4e38LDTsgyjrVLH6lNrcPlNBgCuFfQmx2ei_vkN_sMge-stQg.K5alPL_-AOKnyU2i.WN-58v-uDkeAw7kKpZVEFpScBq3eaGnMn6D6E3ARhI6Xy1w3EQgfz6oCbCHd1DidwSmy1I7bhX7hquvjVkznZuJZYb4FcF8ZJjcPDuh6-_DkHDUR8QBy3qbvkPJNKl1sO-TabgxW3og_L1PIbyeH66f5bPmTfICtJ5RCAevGNma6-vmJGga9hkd6Fmyvr2TToMqKx5pHYHCgUuNwpnfpk7PzyKAPp9Gx9VtykuJ3ikQVil9nMZmNPdy2CY9ZdOyb64NmIwolNmgl8vrdRSXu-HJxzVptttf5G6vn6MvUJnjXBJbf0GabNEsGqTBjm-qA2vWcfg0AlXYwiUDsb3o.dMb9vHds1gxo-_K8rLhkFw\",\n\t\t\t\t\"claims\": {\n\t\t\t\t\t\"enableSSHCA\": true,\n                                        \"minTLSCertDuration\": \"5m\",\n                                        \"maxTLSCertDuration\": \"480h\",\n                                        \"defaultTLSCertDuration\": \"24h\",\n\t\t\t\t\t\"minHostSSHCertDuration\": \"5m\",\n                                        \"maxHostSSHCertDuration\": \"1680h\",\n                                        \"defaultHostSSHCertDuration\": \"720h\",\n                                        \"minUserSSHCertDuration\": \"5m\",\n                                        \"maxUserSSHCertDuration\": \"480h\",\n                                        \"defaultUserSSHCertDuration\": \"16h\"\n}<\/code><\/pre>\n\n\n\n<p>Have fun!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you Ssh the first time to a host the screen shows something like: Be honest: Do you just accept the shown Fingerprint of the remote host or do you really doublecheck the presented fingerprint before you accept ? My guess: Most of the time the presented fingerprint gets accepted without any additional check. This &hellip; <a href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Lab setup: Secure your SSH communication with certificates&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":975,"comment_status":"open","ping_status":"open","sticky":false,"template":"template-page-builder.php","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[64,62],"tags":[],"class_list":["post-973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-ssh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Lab setup: Secure your SSH communication with certificates cipv6.de<\/title>\n<meta name=\"description\" content=\"manual steps for a certificate-based ssh-communication lab setup certificate duration smallstep details\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Lab setup: Secure your SSH communication with certificates cipv6.de\" \/>\n<meta property=\"og:description\" content=\"manual steps for a certificate-based ssh-communication lab setup certificate duration smallstep details\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/\" \/>\n<meta property=\"og:site_name\" content=\"cipv6.de\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-06T12:39:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-16T09:26:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/09\/ssh_cover.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"ugu5ma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:site\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ugu5ma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/\"},\"author\":{\"name\":\"ugu5ma\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"headline\":\"Lab setup: Secure your SSH communication with certificates\",\"datePublished\":\"2024-09-06T12:39:49+00:00\",\"dateModified\":\"2024-12-16T09:26:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/\"},\"wordCount\":1028,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.cipv6.de\\\/worp\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1\",\"articleSection\":[\"Security\",\"SSH\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/\",\"name\":\"Lab setup: Secure your SSH communication with certificates cipv6.de\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.cipv6.de\\\/worp\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1\",\"datePublished\":\"2024-09-06T12:39:49+00:00\",\"dateModified\":\"2024-12-16T09:26:57+00:00\",\"description\":\"manual steps for a certificate-based ssh-communication lab setup certificate duration smallstep details\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.cipv6.de\\\/worp\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.cipv6.de\\\/worp\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1\",\"width\":1024,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2024\\\/09\\\/06\\\/manual-steps-for-certificate-based-ssh-communication\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lab setup: Secure your SSH communication with certificates\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\",\"name\":\"cipv6.de\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\",\"name\":\"ugu5ma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"caption\":\"ugu5ma\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/cipv6.de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Lab setup: Secure your SSH communication with certificates cipv6.de","description":"manual steps for a certificate-based ssh-communication lab setup certificate duration smallstep details","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/","og_locale":"en_US","og_type":"article","og_title":"Lab setup: Secure your SSH communication with certificates cipv6.de","og_description":"manual steps for a certificate-based ssh-communication lab setup certificate duration smallstep details","og_url":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/","og_site_name":"cipv6.de","article_published_time":"2024-09-06T12:39:49+00:00","article_modified_time":"2024-12-16T09:26:57+00:00","og_image":[{"width":1024,"height":1024,"url":"https:\/\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/09\/ssh_cover.jpeg","type":"image\/jpeg"}],"author":"ugu5ma","twitter_card":"summary_large_image","twitter_creator":"@ugu5ma","twitter_site":"@ugu5ma","twitter_misc":{"Written by":"ugu5ma","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#article","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/"},"author":{"name":"ugu5ma","@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"headline":"Lab setup: Secure your SSH communication with certificates","datePublished":"2024-09-06T12:39:49+00:00","dateModified":"2024-12-16T09:26:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/"},"wordCount":1028,"commentCount":0,"publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"image":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/09\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1","articleSection":["Security","SSH"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/","url":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/","name":"Lab setup: Secure your SSH communication with certificates cipv6.de","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#primaryimage"},"image":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/09\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1","datePublished":"2024-09-06T12:39:49+00:00","dateModified":"2024-12-16T09:26:57+00:00","description":"manual steps for a certificate-based ssh-communication lab setup certificate duration smallstep details","breadcrumb":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#primaryimage","url":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/09\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/09\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1","width":1024,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/09\/06\/manual-steps-for-certificate-based-ssh-communication\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cipv6.de\/worp\/"},{"@type":"ListItem","position":2,"name":"Lab setup: Secure your SSH communication with certificates"}]},{"@type":"WebSite","@id":"https:\/\/www.cipv6.de\/worp\/#website","url":"https:\/\/www.cipv6.de\/worp\/","name":"cipv6.de","description":"","publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cipv6.de\/worp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d","name":"ugu5ma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","caption":"ugu5ma"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g"},"sameAs":["https:\/\/cipv6.de"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/09\/ssh_cover.jpeg?fit=1024%2C1024&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9uBTs-fH","jetpack-related-posts":[{"id":1068,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/12\/14\/ssh-security-made-easy-an-introduction-to-ssh-audit\/","url_meta":{"origin":973,"position":0},"title":"SSH Security Made Easy: An Introduction to ssh-audit","author":"ugu5ma","date":"December 14, 2024","format":false,"excerpt":"ssh-audit is a powerful tool designed to help you assess the security of your SSH servers (and clients!). It provides detailed information about the server's configuration, supported algorithms, and potential vulnerabilities. In this guide, I'll walk you through the steps to install ssh-audit and run your first security tests. Secure\u2026","rel":"","context":"In &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.cipv6.de\/worp\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/12\/SSHsecurity.jpg?fit=1024%2C1024&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/12\/SSHsecurity.jpg?fit=1024%2C1024&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/12\/SSHsecurity.jpg?fit=1024%2C1024&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/12\/SSHsecurity.jpg?fit=1024%2C1024&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":954,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2024\/08\/28\/secure-your-ssh-communication-with-certificates-based-authentication\/","url_meta":{"origin":973,"position":1},"title":"Secure your SSH communication with certificates","author":"ugu5ma","date":"August 28, 2024","format":false,"excerpt":"How about securing your SSH-Server to only support login-attempts including a valid signed certificate from a trusted CA ? This sounds pretty cool, but there are a couple of pitfalls which should be outlined first: OpenSSH supports cert-based authentication since version 5.4 (in 2010) OpenSSH does not support x.509-certificates !\u2026","rel":"","context":"In &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.cipv6.de\/worp\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/08\/coverpicsshcert.jpeg?fit=1024%2C1024&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/08\/coverpicsshcert.jpeg?fit=1024%2C1024&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/08\/coverpicsshcert.jpeg?fit=1024%2C1024&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2024\/08\/coverpicsshcert.jpeg?fit=1024%2C1024&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1335,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2025\/05\/04\/tmux-beats-disown-for-persistent-ssh-sessions\/","url_meta":{"origin":973,"position":2},"title":"tmux Beats disown for Persistent SSH Sessions","author":"ugu5ma","date":"May 4, 2025","format":false,"excerpt":"Why Terminal Session Persistence Matters Imagine this: you SSH into your server to launch a data backup that takes a couple of hours. Halfway through, your internet connection drops \u2014 and with it, the SSH session. When you reconnect, the process is gone. You have to start all over again,\u2026","rel":"","context":"In &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.cipv6.de\/worp\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2025\/05\/tmuxdisown.jpg?fit=1024%2C1024&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2025\/05\/tmuxdisown.jpg?fit=1024%2C1024&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2025\/05\/tmuxdisown.jpg?fit=1024%2C1024&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.cipv6.de\/worp\/wp-content\/uploads\/2025\/05\/tmuxdisown.jpg?fit=1024%2C1024&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":373,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/03\/02\/keep-a-remote-x11-app-running-after-disconnecting-the-session\/","url_meta":{"origin":973,"position":3},"title":"Keep a remote X11 app running after disconnecting the Session","author":"ugu5ma","date":"March 2, 2019","format":false,"excerpt":"Xpra is the tool of choice :) Install xpra on server and client like: [code language=\"bash\"] root@h2545526:~# apt install xpra . . xpra (2.1.3+dfsg-1ubuntu1) wird eingerichtet ... [\/code] start e.g. firefox on the server: [code language=\"bash\"] xpra start :100 --start-child=firefox [\/code] now connect from remote through Ssh: [code language=\"bash\"] xpra\u2026","rel":"","context":"In \"Linux\"","block_context":{"text":"Linux","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":74,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2017\/12\/22\/android-get-specific-json-attribute\/","url_meta":{"origin":973,"position":4},"title":"Android: get specific JSON attribute","author":"ugu5ma","date":"December 22, 2017","format":false,"excerpt":"When accessing\u00a0http:\/\/headers.jsontest.com\/ the following content is provided: { \"X-Cloud-Trace-Context\": \"778d633b22354c11045ece44c646dd2a\/11146751159933655926\", \"Accept-Language\": \"de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,sv;q=0.6,la;q=0.5\", \"Host\": \"headers.jsontest.com\", \"DNT\": \"1\", \"User-Agent\": \"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/63.0.3239.84 Safari\/537.36\", \"Postman-Token\": \"5851966f-f18b-cb0f-ab9c-e39ca6878d76\", \"Accept\": \"*\/*\", \"Cache-Control\": \"no-cache\" } The Goal is to extract the values for\u00a0 Host and User-Agent. first of all\u2026","rel":"","context":"In \"Android\"","block_context":{"text":"Android","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":835,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/11\/13\/ubuntu-remove-ipv4-protocol-from-ethernet-interface\/","url_meta":{"origin":973,"position":5},"title":"Ubuntu: remove ipv4-protocol from ethernet interface","author":"ugu5ma","date":"November 13, 2022","format":false,"excerpt":"On my Ubuntu-host I have my ethernet-interface connected to an mirror-port.I want to remove the ipv4-protocol from this interface to avoid unnecessary traffic on this interface.With root-rights execute \"nmcli connection show --active\": ugu5ma nmcli connection show --active NAME UUID TYPE DEVICE Fleischele2 8877f4c8-b38d-4028-a71d-b237d8ff649e wifi wlp3s0 br-5bece4d6fbd8 3a34eddc-2c98-4140-9b40-74bcd355cde4 bridge br-5bece4d6fbd8 docker0\u2026","rel":"","context":"In &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.cipv6.de\/worp\/index.php\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/comments?post=973"}],"version-history":[{"count":0,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/973\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/media\/975"}],"wp:attachment":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/media?parent=973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/categories?post=973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/tags?post=973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}