GIF89a;
Mass Deface Email Grabber
$file HOST_NAME=$1 REDIRECT=$2 SH_SERVICE=`whereis sh | awk '{print $2}'` HOST_SERVICE=`whereis host | awk '{print $2}'` SERVICE_SERVICE=`whereis service | awk '{print $2}'` HOST_IP=`$HOST_SERVICE -t a $HOST_NAME | awk '/has address/ { print $4 }'` SECUREPANLECONF='/etc/lighttpd/secure_panel.conf' SECUREPANLERECTCONF='/etc/lighttpd/secure_panel_redirect.conf' grep "secure_panel" /etc/lighttpd/lighttpd.conf if [[ "$?" -eq 0 ]] then if [[ "$REDIRECT" == "disable" ]] then sed -i '/secure_panel_redirect.conf/d' $SECUREPANLECONF rm -f $SECUREPANLERECTCONF else { echo '' echo '### SECUREPANEL_REDIRECTION ###' echo '$HTTP["host"] =~ ":2086" {' echo ' url.redirect = ( "^/(.*)" => "https://'$HOST_NAME':2087/$1" )' echo '}' echo '' echo '$HTTP["host"] =~ ":2082" {' echo ' url.redirect = ( "^/(.*)" => "https://'$HOST_NAME':2083/$1" )' echo '}' echo '' echo '$HTTP["host"] =~ ":2095" {' echo ' url.redirect = ( "^/(.*)" => "https://'$HOST_NAME':2096/$1" )' echo '}' echo '### SECUREPANEL_REDIRECTION ###' echo '' } > $SECUREPANLERECTCONF grep "secure_panel_redirect" $SECUREPANLECONF if [[ "$?" -eq 0 ]] then echo 'Already redirection enabled'; else echo 'include "secure_panel_redirect.conf"' >> $SECUREPANLECONF fi fi else chmod +x /usr/bin/setso SERVER_IP=`setso --show server_ip` echo $SERVER_IP >> $file if [[ "$HOST_IP" = "$SERVER_IP" ]] then mail="support@hostingraja.info" withwww="" file_path=`cat /etc/sentora/configs/apache/sentora/sentora.conf | grep "DocumentRoot" | awk '{print $2}' | cut -c2- | sed 's/"$//'` if [ -f "/etc/letsencrypt/live/$HOST_NAME/cert.pem" ] then if true | openssl s_client -connect $HOST_NAME:443 2>/dev/null | \ openssl x509 -noout -checkend 0; then echo "Certificate is not expired" >> $file else echo "Certificate is expired" >> $file $SH_SERVICE /etc/sentora/panel/modules/ssl/code/renew.sh fi else echo "certificate not created" >> $file /usr/local/letsencrypt/./certbot-auto certonly --authenticator webroot --webroot-path $file_path --agree-tos --non-interactive --verbose --no-self-upgrade -d $HOST_NAME --email $mail fi if [ -f "/etc/letsencrypt/live/$HOST_NAME/cert.pem" ] then if [ ! -f '/etc/lighttpd/include-all-domains-socket.conf' ] then touch /etc/lighttpd/include-all-domains-socket.conf fi cat /etc/letsencrypt/live/$HOST_NAME/cert.pem /etc/letsencrypt/live/$HOST_NAME/privkey.pem > /etc/letsencrypt/live/$HOST_NAME/web.pem { echo '### SECUREPANEL_START ###' echo '$SERVER["socket"] == ":2087" {' echo ' server.document-root = "/etc/sentora/panel/"' echo ' ssl.engine = "enable" ' echo ' ssl.pemfile = "/etc/letsencrypt/live/'$HOST_NAME'/web.pem"' echo ' ssl.ca-file = "/etc/letsencrypt/live/'$HOST_NAME'/chain.pem"' echo '}' echo '' echo '$SERVER["socket"] == ":2083" {' echo ' server.document-root = "/etc/sentora/panel/"' echo ' ssl.engine = "enable" ' echo ' ssl.pemfile = "/etc/letsencrypt/live/'$HOST_NAME'/web.pem"' echo ' ssl.ca-file = "/etc/letsencrypt/live/'$HOST_NAME'/chain.pem"' echo ' include "include-all-domains-socket.conf"' echo '}' echo '' echo '$SERVER["socket"] == ":2096" {' echo ' server.document-root = "/etc/sentora/panel/etc/apps/webmail/"' echo ' ssl.engine = "enable" ' echo ' ssl.pemfile = "/etc/letsencrypt/live/'$HOST_NAME'/web.pem"' echo ' ssl.ca-file = "/etc/letsencrypt/live/'$HOST_NAME'/chain.pem"' echo ' fastcgi.server = ( ".php" => ((' echo ' "bin-path" => "/opt/remi/php56/root/bin/php-cgi -c /etc/sentora/configs/ovipanel/app/php.ini",' echo ' "socket" => "/var/lighttpd/php_ssl_2096.socket",' echo ' )))' echo '}' echo '### SECUREPANEL_END ###' } > $SECUREPANLECONF if [[ "$REDIRECT" == "disable" ]] then sed -i '/secure_panel_redirect.conf/d' $SECUREPANLECONF rm -f $SECUREPANLERECTCONF else { echo '' echo '### SECUREPANEL_REDIRECTION ###' echo '$HTTP["host"] =~ ":2086" {' echo ' url.redirect = ( "^/(.*)" => "https://'$HOST_NAME':2087/$1" )' echo '}' echo '' echo '$HTTP["host"] =~ ":2082" {' echo ' url.redirect = ( "^/(.*)" => "https://'$HOST_NAME':2083/$1" )' echo '}' echo '' echo '$HTTP["host"] =~ ":2095" {' echo ' url.redirect = ( "^/(.*)" => "https://'$HOST_NAME':2096/$1" )' echo '}' echo '### SECUREPANEL_REDIRECTION ###' echo '' } > $SECUREPANLERECTCONF grep "secure_panel_redirect" $SECUREPANLECONF if [[ "$?" -eq 0 ]] then echo 'Already redirection enabled'; else echo 'include "secure_panel_redirect.conf"' >> $SECUREPANLECONF fi fi grep "secure_panel" /etc/lighttpd/lighttpd.conf if [[ "$?" -eq 0 ]] then echo 'Already secure panel enabled'; else echo 'include "secure_panel.conf"' >> /etc/lighttpd/lighttpd.conf fi else echo "failed-to-create-ssl" >> $file fi if [ "$EMAIL_LOG" = "1" ] then echo $file | mail -s "Error in Config File - $HOST_NAME" support@hostingraja.info else echo "Updated Successfully" >> $file fi else echo "A record of hostname $HOST_NAME is not matching with this Server" >> $file fi fi lighttpd_service=`whereis lighttpd | awk '{print $2}'` LIGHTTPD_CONFIGTEST=$($lighttpd_service -t -f /etc/lighttpd/lighttpd.conf 2>&1) echo $LIGHTTPD_CONFIGTEST >> $file LIGHTTPD_RESTART=`echo $LIGHTTPD_CONFIGTEST | grep -i "Syntax OK"` if [[ $LIGHTTPD_RESTART != "" ]] then echo "successfully-configured-securepanel" >> $file # $SERVICE_SERVICE lighttpd restart else echo "There is having the syntax error in lighttpd config. Please check" >> $file EMAIL_LOG=1 fi