From 93994bd392400df4e602d8294c73f989690eeca8 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 09:24:14 +0000 Subject: Apply patch ci-ssh-exit-with-non-zero-status-on-disabled-user-472.patch patch_name: ci-ssh-exit-with-non-zero-status-on-disabled-user-472.patch present_in_specfile: true location_in_specfile: 18 --- diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py index bcb23a5..8ff61a2 100644 --- a/cloudinit/ssh_util.py +++ b/cloudinit/ssh_util.py @@ -40,11 +40,13 @@ VALID_KEY_TYPES = ( "ssh-rsa-cert-v01@openssh.com", ) +_DISABLE_USER_SSH_EXIT = 142 DISABLE_USER_OPTS = ( "no-port-forwarding,no-agent-forwarding," "no-X11-forwarding,command=\"echo \'Please login as the user \\\"$USER\\\"" - " rather than the user \\\"$DISABLE_USER\\\".\';echo;sleep 10\"") + " rather than the user \\\"$DISABLE_USER\\\".\';echo;sleep 10;" + "exit " + str(_DISABLE_USER_SSH_EXIT) + "\"") class AuthKeyLine(object): diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt index 0e82b83..f00db68 100644 --- a/doc/examples/cloud-config.txt +++ b/doc/examples/cloud-config.txt @@ -235,7 +235,7 @@ disable_root: false # The string '$USER' will be replaced with the username of the default user. # The string '$DISABLE_USER' will be replaced with the username to disable. # -# disable_root_opts: no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"$USER\" rather than the user \"$DISABLE_USER\".';echo;sleep 10" +# disable_root_opts: no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"$USER\" rather than the user \"$DISABLE_USER\".';echo;sleep 10;exit 142" # disable ssh access for non-root-users # To disable ssh access for non-root users, ssh_redirect_user: true can be