1a903f5e2SGeorge Keishing*** Settings *** 2a903f5e2SGeorge KeishingDocumentation Test BMC SSH security. 3a903f5e2SGeorge Keishing 4a903f5e2SGeorge KeishingResource ../lib/resource.robot 5a903f5e2SGeorge KeishingResource ../lib/openbmc_ffdc_methods.robot 6a903f5e2SGeorge Keishing 7a903f5e2SGeorge Keishing*** Variables *** 8a903f5e2SGeorge Keishing 9a903f5e2SGeorge Keishing@{allowed_shell_rcs} ${255} 10a903f5e2SGeorge Keishing${ignore_err} ${0} 11a903f5e2SGeorge Keishing 12a903f5e2SGeorge Keishing# Left anchor for this regex is either a space or a comma. 13a903f5e2SGeorge Keishing${left_anchor} [ ,] 14a903f5e2SGeorge Keishing# Right anchor for this regex is either a comma or end-of-line. 15a903f5e2SGeorge Keishing${right_anchor} (,|$) 16a903f5e2SGeorge Keishing 17a903f5e2SGeorge Keishing${weak_key_regex} ${left_anchor}(group1_sha1|DES-CBC3|CBC mode|group1|SHA1)${right_anchor} 18a903f5e2SGeorge Keishing${mac_key_regex} ${left_anchor}(MD5|96-bit MAC algorithms)${right_anchor} 19a903f5e2SGeorge Keishing 20a903f5e2SGeorge Keishing*** Test Cases *** 21a903f5e2SGeorge Keishing 22a903f5e2SGeorge KeishingVerify BMC SSH Weak Cipher And Algorithm 23a903f5e2SGeorge Keishing [Documentation] Connect to BMC and verify no weak cipher and algorithm is 24a903f5e2SGeorge Keishing ... supported. 25a903f5e2SGeorge Keishing [Tags] Verify_BMC_SSH_Weak_Cipher_And_Algorithm 26a903f5e2SGeorge Keishing 27a903f5e2SGeorge Keishing # The following is a sample of output from ssh -vv: 28a903f5e2SGeorge Keishing # This test requires OpenSSH and depends on output format of ssh -vv. 29a903f5e2SGeorge Keishing # debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256, 30a903f5e2SGeorge Keishing # ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256, 31a903f5e2SGeorge Keishing # diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256, 32a903f5e2SGeorge Keishing # diffie-hellman-group14-sha1 33a903f5e2SGeorge Keishing # debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa 34a903f5e2SGeorge Keishing # debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr, 35a903f5e2SGeorge Keishing # aes128-gcm@openssh.com,aes256-gcm@openssh.com 36a903f5e2SGeorge Keishing # debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr, 37a903f5e2SGeorge Keishing # aes128-gcm@openssh.com,aes256-gcm@openssh.com 38a903f5e2SGeorge Keishing # debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com, 39*1483ce0eSJoy Onyerikwu # hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com, 40*1483ce0eSJoy Onyerikwu # umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 41a903f5e2SGeorge Keishing # debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com, 42*1483ce0eSJoy Onyerikwu # hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com, 43*1483ce0eSJoy Onyerikwu # umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 44a903f5e2SGeorge Keishing 45a903f5e2SGeorge Keishing # Example of weak algorithms to check: 46a903f5e2SGeorge Keishing # - encryption: triple-DES ("DES-CBC3"). 47a903f5e2SGeorge Keishing # - encryption: CBC mode 48a903f5e2SGeorge Keishing # - MAC: MD5 and 96-bit MAC algorithms 49a903f5e2SGeorge Keishing # - KEX: diffie-hellman-group1(any) , (any) SHA1 50a903f5e2SGeorge Keishing 51a903f5e2SGeorge Keishing Printn 52a903f5e2SGeorge Keishing ${ssh_cmd_buf}= Catenate ssh -o NumberOfPasswordPrompts=0 UserKnownHostsFile=/dev/null 53a903f5e2SGeorge Keishing ... StrictHostKeyChecking=no -vv ${OPENBMC_HOST} 2>&1 54a903f5e2SGeorge Keishing Shell Cmd ! ${ssh_cmd_buf} | egrep -- "${weak_key_regex}" 55a903f5e2SGeorge Keishing Shell Cmd ! ${ssh_cmd_buf} | egrep -- "${mac_key_regex}" 56