HEX
Server: Apache
System: Linux andromeda.lojoweb.com 4.18.0-372.26.1.el8_6.x86_64 #1 SMP Tue Sep 13 06:07:14 EDT 2022 x86_64
User: nakedfoamlojoweb (1056)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //var/lib/cloud/scripts/per-once/cpanel_init.sh
#!/bin/bash

#Clean cpanel history
rm -rf /var/cpanel/user_notifications/root/history/*
rm -rf /var/cpanel/userhomes/cpanel/mail/new/*

#Delete DNS Zone of packer install
/scripts/killdns packer.cpanel.ovh

#Reset /etc/wwwacct.conf
sed -i '/^ADDR/d' /etc/wwwacct.conf
sed -i '/^NS/d' /etc/wwwacct.conf
sed -i '/^HOST/d' /etc/wwwacct.conf
echo "ADDR $(hostname -I|awk '{print $1}')" >> /etc/wwwacct.conf
echo "HOST $(hostname -f)" >> /etc/wwwacct.conf
echo "NS $(hostname -f)" >> /etc/wwwacct.conf
echo "NS2 cdns.ovh.net" >> /etc/wwwacct.conf

#Clean up /etc/hosts
sed -i '/packer/d' /etc/hosts

#Update cpanel
/usr/local/cpanel/scripts/upcp

#Run cpanel NAT
/scripts/build_cpnat

#Generate url and print in console-log
url=$(whmlogin)
echo -e '\n\n\nOVH_OUTPUT:[{"type":"cpanel","url":"'"$url"'"}]\n\n\n' >> /dev/ttyS0