Skip to content

Commit

Permalink
[Azure]Fix RHEL-10 ssh host key permission
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxin Sun <[email protected]>
  • Loading branch information
yuxisun1217 committed Jul 31, 2024
1 parent 4eb7fba commit 20a0bf0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions os_tests/libs/utils_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,8 @@ def is_azure(test_instance, action=None):
azure: return True
other: return False
'''
output = run_cmd(test_instance, "[[ -f /usr/sbin/route ]] || sudo yum install -y net-tools")
output = run_cmd(test_instance, "/usr/sbin/route -n")
output = run_cmd(test_instance, "[[ -f /usr/sbin/route ]] || sudo yum install -y net-tools", expect_ret=0)
output = run_cmd(test_instance, "/usr/sbin/route -n", expect_ret=0)
if 'not found' in output:
return False
if '168.63.129.16' in output:
Expand Down
4 changes: 2 additions & 2 deletions os_tests/tests/test_azure_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,15 @@ def test_check_product_id(self):

def test_check_rhui_cert(self):
'''
Verify /etc/pki/rhui/product/content.crt exists
Verify /etc/pki/rhui/product/content-base.crt exists
Check end time
'''
# product_id = utils_lib.get_product_id(self)
# if float(product_id) < float('8'):
# cmd = 'sudo rpm -q redhat-release-server'
# else:
# cmd = 'sudo rpm -q redhat-release'
cmd = "timestamp=$(sudo rct cat-cert /etc/pki/rhui/product/content.crt|grep 'End Date'|awk '{print $3}');date -d $timestamp +%s"
cmd = "timestamp=$(sudo rct cat-cert /etc/pki/rhui/product/content-base.crt|grep 'End Date'|awk '{print $3}');date -d $timestamp +%s"
end_date = utils_lib.run_cmd(self,cmd, msg='get rhui cert end date')
cmd = 'sudo date +%s'
now_date = utils_lib.run_cmd(self,cmd, msg='get now date')
Expand Down
7 changes: 5 additions & 2 deletions os_tests/tests/test_azure_upgrade_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,12 @@ def test_check_hostkey_permission(self):
bz: 2013644
Verify /etc/ssh/ssh_host_xxx_key permission are 640, group is ssh_keys.
'''
expected = "-rw-r-----.rootssh_keys"
if self.rhel_x_version >= 10:
expected = "-rw-------.rootroot"
else:
expected = "-rw-r-----.rootssh_keys"
cmd = "ls -l /etc/ssh/{ssh_host_ecdsa_key,ssh_host_ed25519_key,ssh_host_rsa_key}|awk '{print $1$3$4}'|uniq"
utils_lib.run_cmd(self, cmd, expect_output=expected, msg="Verify /etc/ssh/ssh_host_xxx_key permission is 640, group is ssh_keys")
utils_lib.run_cmd(self, cmd, expect_output=expected, msg="Verify /etc/ssh/ssh_host_xxx_key permission and group")

def test_check_dev_disk_azure(self):
'''
Expand Down

0 comments on commit 20a0bf0

Please sign in to comment.