특정 Host에서만 RootLogin 허용
Goal
* chefリポジトリサーバを作成し、knife soloで実行できるようにしたい
* chef soloの実行ユーザは各サーバのrootユーザとしたい
* 各サーバのrootログインをchefリポジトリサーバのみに絞りたい
* 前提として、VPN環境は持っておらず、さくらVPSやAmazon EC2など様々なサービスでサーバを運用していて、さらに様々な場所でwifiを切り替えてそれらサーバを管理している
Plan
* chefリポジトリサーバにnomaduserを作成
(自分自身以外すべてのサーバにrootログインできる権限を持つ最強ユーザ.遊牧民のようにいろんなサーバを渡り歩くことを仕事とするのでnomadと名づけた.)
* nomaduserのpublic keyを全サーバのrootユーザに配り、sshd_config設定でchefリポジトリのIPアドレスのみPermitRootLoginを許可する
* これで、通常ユーザは通常通りssh鍵認証でログイン可能になり、なんらかの理由で何者かがnomaduserのprivate keyを手に入れても、chefリポジトリサーバ上からしかsshすることはできない
* chefリポジトリサーバのnomaduserは厳重管理する必要がある
* この方法でchefリポジトリサーバを踏み台サーバとすることもできるはず
Manual
sshd_config
PermitRootLogin no
PasswordAuthentication no
## ...
# Permit root ssh login for only chef admin servers
Match Address <chefリポジトリサーバIPアドレス(ssh接続元)>
PermitRootLogin yes
/etc/init.d/sshd restart
※ Match 명령으로 예외를 만들 수 있는 항목 일람
h tp // w w. 음, r. 오 rg / ~ 에 s 케 / 드 c / 오페 sh / j 만 / shd_ コンフ ぃ g. HTML
모든 설정 항목에 매치 명령이 적용되는 것은 아닙니다.使用できる項目は、AcceptEnv ,AllowAgentForwarding ,AllowGroups ,AllowTcpForwarding ,AllowUsers ,AuthenticationMethods ,AuthorizedKeysCommand ,AuthorizedKeysCommandUser ,AuthorizedKeysFile ,AuthorizedPrincipalsFile ,Banner ,ChrootDirectory ,DenyGroups ,DenyUsers ,ForceCommand ,GatewayPorts ,GSSAPIAuthentication ,HostbasedAuthentication ,HostbasedUsesNameFromPacketOnly ,KbdInteractiveAuthentication ,KerberosAuthentication ,MaxAuthTries ,MaxSessions ,PasswordAuthentication ,PermitEmptyPasswords ,PermitOpen ,PermitRootLogin ,PermitTTY ,PermitTunnel ,PubkeyAuthentication ,RekeyLimit ,RhostsRSAAuthentication ,RSAAuthentication ,X11DisplayOffset ,X
공개 키 공유
## root user of chef target server
echo "<public key of nomaduser>" >> ~/.ssh/authorized_keys
Alternatives
발판 서버를 만들면 iptables, hosts.allow/hosts.deny 등으로 ACL을 걸 수도 있습니다
sshd_config의 "PermitRootLogin forced-commands-only"라고 하면, 리모트 커멘드 실행 모드로만 root ssh 가능하게 되는 것 같지만, 이것이라면 knife solo는 실행할 수 없었다
Reference
이 문제에 관하여(특정 Host에서만 RootLogin 허용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/metheglin/items/7f1176b3c82b095c2e75
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
* chefリポジトリサーバを作成し、knife soloで実行できるようにしたい
* chef soloの実行ユーザは各サーバのrootユーザとしたい
* 各サーバのrootログインをchefリポジトリサーバのみに絞りたい
* 前提として、VPN環境は持っておらず、さくらVPSやAmazon EC2など様々なサービスでサーバを運用していて、さらに様々な場所でwifiを切り替えてそれらサーバを管理している
* chefリポジトリサーバにnomaduserを作成
(自分自身以外すべてのサーバにrootログインできる権限を持つ最強ユーザ.遊牧民のようにいろんなサーバを渡り歩くことを仕事とするのでnomadと名づけた.)
* nomaduserのpublic keyを全サーバのrootユーザに配り、sshd_config設定でchefリポジトリのIPアドレスのみPermitRootLoginを許可する
* これで、通常ユーザは通常通りssh鍵認証でログイン可能になり、なんらかの理由で何者かがnomaduserのprivate keyを手に入れても、chefリポジトリサーバ上からしかsshすることはできない
* chefリポジトリサーバのnomaduserは厳重管理する必要がある
* この方法でchefリポジトリサーバを踏み台サーバとすることもできるはず
Manual
sshd_config
PermitRootLogin no
PasswordAuthentication no
## ...
# Permit root ssh login for only chef admin servers
Match Address <chefリポジトリサーバIPアドレス(ssh接続元)>
PermitRootLogin yes
/etc/init.d/sshd restart
※ Match 명령으로 예외를 만들 수 있는 항목 일람
h tp // w w. 음, r. 오 rg / ~ 에 s 케 / 드 c / 오페 sh / j 만 / shd_ コンフ ぃ g. HTML
모든 설정 항목에 매치 명령이 적용되는 것은 아닙니다.使用できる項目は、AcceptEnv ,AllowAgentForwarding ,AllowGroups ,AllowTcpForwarding ,AllowUsers ,AuthenticationMethods ,AuthorizedKeysCommand ,AuthorizedKeysCommandUser ,AuthorizedKeysFile ,AuthorizedPrincipalsFile ,Banner ,ChrootDirectory ,DenyGroups ,DenyUsers ,ForceCommand ,GatewayPorts ,GSSAPIAuthentication ,HostbasedAuthentication ,HostbasedUsesNameFromPacketOnly ,KbdInteractiveAuthentication ,KerberosAuthentication ,MaxAuthTries ,MaxSessions ,PasswordAuthentication ,PermitEmptyPasswords ,PermitOpen ,PermitRootLogin ,PermitTTY ,PermitTunnel ,PubkeyAuthentication ,RekeyLimit ,RhostsRSAAuthentication ,RSAAuthentication ,X11DisplayOffset ,X
공개 키 공유
## root user of chef target server
echo "<public key of nomaduser>" >> ~/.ssh/authorized_keys
Alternatives
발판 서버를 만들면 iptables, hosts.allow/hosts.deny 등으로 ACL을 걸 수도 있습니다
sshd_config의 "PermitRootLogin forced-commands-only"라고 하면, 리모트 커멘드 실행 모드로만 root ssh 가능하게 되는 것 같지만, 이것이라면 knife solo는 실행할 수 없었다
Reference
이 문제에 관하여(특정 Host에서만 RootLogin 허용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/metheglin/items/7f1176b3c82b095c2e75
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
PermitRootLogin no
PasswordAuthentication no
## ...
# Permit root ssh login for only chef admin servers
Match Address <chefリポジトリサーバIPアドレス(ssh接続元)>
PermitRootLogin yes
/etc/init.d/sshd restart
## root user of chef target server
echo "<public key of nomaduser>" >> ~/.ssh/authorized_keys
발판 서버를 만들면 iptables, hosts.allow/hosts.deny 등으로 ACL을 걸 수도 있습니다
sshd_config의 "PermitRootLogin forced-commands-only"라고 하면, 리모트 커멘드 실행 모드로만 root ssh 가능하게 되는 것 같지만, 이것이라면 knife solo는 실행할 수 없었다
Reference
이 문제에 관하여(특정 Host에서만 RootLogin 허용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/metheglin/items/7f1176b3c82b095c2e75텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)