Skip to content

Commit b16d48b

Browse files
authored
Generate RSA Host key for alinux2 platforms. (#2423)
- This matches the behaviour from the base OS which also generates an RSA host keys - This is to avoid SSHD from having errors when client attempt signing in - We still have `ed25519` and `ecdsa` host keys which are more secure and take precedence Signed-off-by: Eddy Mwiti <[email protected]>
1 parent 8a5e5f9 commit b16d48b

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

cookbooks/aws-parallelcluster-environment/files/login_nodes/keys-manager.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ function create_keys() {
3636
info "Creating host keys"
3737
ssh-keygen -t ecdsa -f "$FOLDER_PATH/ssh_host_ecdsa_key" -q -P ""
3838
ssh-keygen -t ed25519 -f "$FOLDER_PATH/ssh_host_ed25519_key" -q -P ""
39-
if is_not_alinux; then
40-
ssh-keygen -t rsa -f "$FOLDER_PATH/ssh_host_rsa_key" -q -P ""
41-
fi
39+
ssh-keygen -t rsa -f "$FOLDER_PATH/ssh_host_rsa_key" -q -P ""
4240
if is_ubuntu; then
4341
ssh-keygen -t dsa -f "$FOLDER_PATH/ssh_host_dsa_key" -q -P ""
4442
fi
@@ -49,9 +47,7 @@ function import_keys() {
4947
rm -f /etc/ssh/ssh_host_*
5048
cp "$FOLDER_PATH/ssh_host_ecdsa"* /etc/ssh/
5149
cp "$FOLDER_PATH/ssh_host_ed25519"* /etc/ssh/
52-
if is_not_alinux; then
53-
cp "$FOLDER_PATH/ssh_host_rsa"* /etc/ssh/
54-
fi
50+
cp "$FOLDER_PATH/ssh_host_rsa"* /etc/ssh/
5551
if is_ubuntu; then
5652
cp "$FOLDER_PATH/ssh_host_dsa"* /etc/ssh/
5753
chown root:root /etc/ssh/ssh_host_*
@@ -63,13 +59,6 @@ function import_keys() {
6359
chmod 644 /etc/ssh/ssh_host_*_key.pub
6460
}
6561

66-
function is_not_alinux() {
67-
if grep -q "Amazon" <<< "$OS"; then
68-
return 1
69-
fi
70-
return 0
71-
}
72-
7362
function is_ubuntu() {
7463
if grep -q "Ubuntu" <<< "$OS"; then
7564
return 0

cookbooks/aws-parallelcluster-environment/test/controls/login_nodes_keys_spec.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@
1010
# See the License for the specific language governing permissions and limitations under the License.
1111

1212
keys_manager_script_dir = "/opt/parallelcluster/scripts/login_nodes"
13-
key_types = %w(ecdsa ed25519)
14-
is_not_amazon = !os_properties.amazon_family?
13+
key_types = %w(ecdsa ed25519 rsa)
1514
is_ubuntu = os_properties.ubuntu?
16-
if is_not_amazon
17-
key_types << 'rsa'
18-
end
1915
if is_ubuntu
2016
key_types << 'dsa'
2117
end

0 commit comments

Comments
 (0)