HEX
Server: nginx/1.16.1
System: Linux ecs-04358622 4.19.90-2107.6.0.0100.oe1.bclinux.x86_64 #1 SMP Wed Dec 1 19:59:44 CST 2021 x86_64
User: nginx (994)
PHP: 8.0.0
Disabled: NONE
Upload Files
File: //opt/BCLinux/bse/secure_set/s11_sshCipher
#!/bin/sh

#=====================================================================
InsertSection "Set the ssh cipher..."

if [ $SET_SSH_CIPHER -eq 1 ]; then

    cp -np /etc/ssh/ssh_config  /etc/ssh/ssh_config_bak
    cp -np /etc/ssh/sshd_config  /etc/ssh/sshd_config_bak

    IS_EXIST=`egrep -v '^#|^$' /etc/ssh/sshd_config | grep Ciphers |wc -l`
    if [ "${IS_EXIST}" = "0" ] ; then
        echo $SSH_CIPHER_VALUE >> /etc/ssh/sshd_config
        echo $SSH_CIPHER_VALUE >> /etc/ssh/ssh_config
    fi

    IS_EXIST=`egrep -v '^#|^$' /etc/ssh/sshd_config | grep MACs |wc -l`
    if [ "${IS_EXIST}" = "0" ] ; then
        echo $SSH_MACS_VALUE >> /etc/ssh/sshd_config
        echo $SSH_MACS_VALUE >> /etc/ssh/ssh_config
    fi



    IS_EXIST=`egrep -v '^#|^$' /etc/ssh/sshd_config | grep Ciphers |wc -l`
    if [ "${IS_EXIST}" = "0" ] ; then
        logtext "set the ssh cipher failed, no cipher config options found"
        Display --indent 2 --text "- Set the ssh cipher... " --result FAILED --color RED
    else
        logtext "set the ssh cipher successfully, or its already has config options"
        Display --indent 2 --text "- Set the ssh cipher... " --result FINISHED --color GREEN
    fi

    IS_EXIST=`egrep -v '^#|^$' /etc/ssh/sshd_config | grep MACs |wc -l`
    if [ "${IS_EXIST}" = "0" ] ; then
        logtext "set the ssh MACs failed, no MACs config options found"
        Display --indent 2 --text "- Set the ssh MACs... " --result FAILED --color RED
    else
        logtext "set the ssh MACs successfully, or its already has config options"
        Display --indent 2 --text "- Set the ssh MACs... " --result FINISHED --color GREEN
    fi



    #logtext "restart the sshd service..."
    #systemctl restart sshd.service

else

    Display --indent 2 --text "- Skip set ssh cipher due to config file... " --result SKIPPING --color YELLOW

fi