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