接続先Linux端末の設定
アクセス先のLinux端末には、「CA Server」が発行した証明書でログインできるように設定する必要があります。以下の手順に従って必要なモジュール(step-ca)のインストールを行って下さい。また、「step ca bootstrap」コマンドの実行時には、お知らせした「CA Server」の「fingerprintの値」を設定して下さい。
① 以下のURLからstep-cli_0.24.4_amd64.rpmパッケージをダウンロードします。
https://newreleases.io/project/github/smallstep/cli/release/v0.24.4
② Linux 端末に管理権限を持つユーザーでログインし、「step-ca」モジュールのインストールをします。
# rpm -ivh step-cli_0.24.4_amd64.rpm
# mkdir /etc/ssh/step-ca
# step ca bootstrap --ca-url <CA Serverのホスト名>:8445 --fingerprint <CA Serverのfingerprint>
# step ssh config --roots /etc/ssh/step-ca/ssh_user_ca_key.pub
③ 証明書を利用したssh接続の設定を行います。
# step ssh certificate --provisioner SeciossLinkJWK --host --insecure --no-password <Linux端末のホスト名>
ssh_host_ecdsa_key
✔ Provisioner: SeciossLinkJWK (JWK) [kid: 5ScrSZuz4AB3kXmP2vMOMGf36sZlVIvz4uCXNFCuckk]
Please enter the password to decrypt the provisioner key: <CA Serverのパスワード>
✔ CA: https://<CA Serverのホスト名>:8445
✔ Private Key: ssh_host_ecdsa_key
✔ Public Key: ssh_host_ecdsa_key.pub
✔ Certificate: ssh_host_ecdsa_key-cert.pub
④ /etc/ssh/sshd_configファイルに以下を追記してください。
TrustedUserCAKeys /etc/ssh/step-ca/ssh_user_ca_key.pub
⑤ 設定完了後、sshプロセスを再起動します。
# systemctl restart sshd
接続元Windows端末の設定
アクセス元端末がWindowsでアクセス先端末がLinuxの場合、Windows環境から証明書を利用してssh接続できるように設定する必要があります。以下の手順に従って必要なモジュール(step-windows)のインストールを行って下さい。また、「step ca bootstrap」コマンドの実行時には、お知らせした「CA Server」の「fingerprintの値」を設定して下さい。
① Windowsコマンドプロンプトを管理者権限で起動し、「step-windows」モジュールをインストールします。
C:¥curl.exe -LO https://dl.step.sm/gh-release/cli/docs-cli-install/v0.24.4/step_windows_0.24.4_amd64.zip
C:¥Expand-Archive -LiteralPath .¥step_windows_0.24.4_amd64.zip -DestinationPath C:¥
C:¥cd C:¥step_24.4¥bin
C:¥step_0.24.4¥binstep ca bootstrap --ca-url <CA Server のホスト名>:8445 --fingerprint <CA Server の fingerprint>
The root certificate has been saved in C:¥Users¥<ユーザー名>¥.step¥certs¥root_ca.crt.
The authority configuration has been saved in C:¥Users¥<ユーザー名>¥.step¥config¥defaults.json.
② Windowsの「システム環境変数の編集」を開き、環境変数にsshコマンドのpathの追加を行います。環境変数 一覧にある「Path」を開き、「C:¥step_0.24.4¥bin」を追加してください。
③ Windowsコマンドプロンプトを管理者権限で起動し、コマンドを実行してください。
C:¥ sc config ssh-agent start=auto
[SC] ChangeServiceConfig SUCCESS
C:¥ sc start ssh-agent
④ C:¥Users¥<ユーザー名>¥.step¥config¥defaults.json ファイルに下記 のscopeを追加して下さい。
{
"scope": "openid email profile",
"ca-url": "https://<CA Serverのホスト名>:8445",
"fingerprint": "<CA Serverのfingerprint>,
"root": "C:¥¥Users¥¥<ユーザー名>¥¥.step¥¥certs¥¥root_ca.crt",
"redirect-url": ""
⑤ C:¥Users¥<ユーザー名>¥.ssh¥config ファイルに下記の設定を追加して下さい。
Host *
ForwardAgent yes
Host
HostName
Port 22
User <接続先linux端末側のユーザーid ※このユーザーでログインします>
ProxyCommand step ssh proxycommand %r %h %p --provisioner "SeciossLink"