Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
KunSir991 committed Nov 13, 2024
1 parent dc17a42 commit dbc07f4
Showing 1 changed file with 93 additions and 93 deletions.
186 changes: 93 additions & 93 deletions .computenest/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,96 +129,96 @@ ImageBuilder:
function clean_log(){
rm -fv /usr/local/aegis/aegis_update/data/data.[0-9]
rm -fv /usr/local/aegis/aegis_client/aegis_*/data/data.[0-9]
rm -fv /usr/local/aegis/globalcfg/domaincfg.ini
rm -fv /opt/aegis/globalcfg/domaincfg.ini
rm -rf /var/log/cron
rm -rf /var/log/cloud-init.log
rm -f /var/log/anaconda.*
rm -f /var/log/sa/*
rm -rf /var/log/conman*
[ -f /var/log/messages ] && > /var/log/messages
rm -f /var/log/*.[0-9]*
rm -rfv /var/lib/apt/lists/*
rm -rfv /var/log/installer/syslog
rm -rfv /var/log/journal/*
rm -rfv /var/log/installer/cdebconf/questions.dat
rm -rfv /var/cache/yum/*
rm -rfv /var/cache/dnf/*
rm -rfv /var/lib/yum/history/*
rm -rfv /var/lib/dnf/history*
rm -rfv /var/lib/dhclient/*
rm -rfv /var/lib/dhcp/*
rm -rfv /var/lib/aliyun_init/*
rm -rfv /var/lib/cloud
rm -rfv /etc/ssh/sshd_config.d/50-cloud-init.conf
if [ -d /usr/local/share/aliyun-assist/*/log/ ];then
rm -rfv /usr/local/share/aliyun-assist/*/log/*
fi
rm -rf /usr/local/share/aliyun-assist/plugin
rm -rf /var/log/ecsgo.log*
rm -rf /tmp/*
rm -f /root/{.bash_history,.viminfo,*.cfg,*.log*}
rm -rf /root/script
for i in $(find /var/log/ -type f); do > $i; done
sed -i "/iZ*Z/d" /etc/hosts
sed -i "/AliYun/d" /etc/hosts
# for ubuntu22/24 use cloud-init autoinstall remained hostnaem Aliyun
sed -i "/Aliyun/d" /etc/hosts
sed -i "/debug/d" /etc/hosts
# Clean up useless nameservers to prevent cloudinit local domain name resolution timeout
sed -i "/nameserver/d" $(realpath /etc/resolv.conf)
rm -rfv /tmp/*
[ -d /etc/NetworkManager/system-connections ] && rm -fv /etc/NetworkManager/system-connections/*.nmconnection
if [[ ! -L /etc/udev/rules.d/70-persistent-net.rules ]];then
rm -rfv /etc/udev/rules.d/70-persistent-net.rules
fi
sync
sync
sync
}

function clean_source_cache(){
if [ `which zypper` ]; then
zypper clean; rm -fv /etc/zypp/repos.d/CUSTOM*
elif [ `which apt-get` ]; then
apt-get -q clean; apt-get -q autoclean; apt-get -q -y autoremove;
elif [ `which yum` ]; then
yum clean all;
elif [ `which pkg` ]; then
pkg autoremove
fi
}

function clean_root_passwd(){
passwd -l root
sed -i '/PasswordAuthentication/d' /etc/ssh/sshd_config
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config
sed -i -e 's/root:[^:]*:/root:*:/g' /etc/shadow

rm -f /root/.ssh/known_hosts
rm -f /etc/ssh/ssh_host_*
}


function clean_cmd_history(){
for user in $(cut -f1 -d: /etc/passwd); do
if [ -f /home/$user/.bash_history ]; then
> /home/$user/.bash_history
fi
done
> /root/.bash_history
}


clean_source_cache
clean_log
clean_root_passwd
clean_cmd_history
rm -fv /usr/local/aegis/aegis_update/data/data.[0-9]
rm -fv /usr/local/aegis/aegis_client/aegis_*/data/data.[0-9]
rm -fv /usr/local/aegis/globalcfg/domaincfg.ini
rm -fv /opt/aegis/globalcfg/domaincfg.ini
rm -rf /var/log/cron
rm -rf /var/log/cloud-init.log
rm -f /var/log/anaconda.*
rm -f /var/log/sa/*
rm -rf /var/log/conman*
[ -f /var/log/messages ] && > /var/log/messages
rm -f /var/log/*.[0-9]*
rm -rfv /var/lib/apt/lists/*
rm -rfv /var/log/installer/syslog
rm -rfv /var/log/journal/*
rm -rfv /var/log/installer/cdebconf/questions.dat
rm -rfv /var/cache/yum/*
rm -rfv /var/cache/dnf/*
rm -rfv /var/lib/yum/history/*
rm -rfv /var/lib/dnf/history*
rm -rfv /var/lib/dhclient/*
rm -rfv /var/lib/dhcp/*
rm -rfv /var/lib/aliyun_init/*
rm -rfv /var/lib/cloud
rm -rfv /etc/ssh/sshd_config.d/50-cloud-init.conf
if [ -d /usr/local/share/aliyun-assist/*/log/ ];then
rm -rfv /usr/local/share/aliyun-assist/*/log/*
fi
rm -rf /usr/local/share/aliyun-assist/plugin
rm -rf /var/log/ecsgo.log*
rm -rf /tmp/*
rm -f /root/{.bash_history,.viminfo,*.cfg,*.log*}
rm -rf /root/script
for i in $(find /var/log/ -type f); do > $i; done
sed -i "/iZ*Z/d" /etc/hosts
sed -i "/AliYun/d" /etc/hosts
# for ubuntu22/24 use cloud-init autoinstall remained hostnaem Aliyun
sed -i "/Aliyun/d" /etc/hosts
sed -i "/debug/d" /etc/hosts
# Clean up useless nameservers to prevent cloudinit local domain name resolution timeout
sed -i "/nameserver/d" $(realpath /etc/resolv.conf)
rm -rfv /tmp/*
[ -d /etc/NetworkManager/system-connections ] && rm -fv /etc/NetworkManager/system-connections/*.nmconnection
if [[ ! -L /etc/udev/rules.d/70-persistent-net.rules ]];then
rm -rfv /etc/udev/rules.d/70-persistent-net.rules
fi
sync
sync
sync
}
function clean_source_cache(){
if [ `which zypper` ]; then
zypper clean; rm -fv /etc/zypp/repos.d/CUSTOM*
elif [ `which apt-get` ]; then
apt-get -q clean; apt-get -q autoclean; apt-get -q -y autoremove;
elif [ `which yum` ]; then
yum clean all;
elif [ `which pkg` ]; then
pkg autoremove
fi
}
function clean_root_passwd(){
passwd -l root
sed -i '/PasswordAuthentication/d' /etc/ssh/sshd_config
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config
sed -i -e 's/root:[^:]*:/root:*:/g' /etc/shadow
rm -f /root/.ssh/known_hosts
rm -f /etc/ssh/ssh_host_*
}
function clean_cmd_history(){
for user in $(cut -f1 -d: /etc/passwd); do
if [ -f /home/$user/.bash_history ]; then
> /home/$user/.bash_history
fi
done
> /root/.bash_history
}
clean_source_cache
clean_log
clean_root_passwd
clean_cmd_history

0 comments on commit dbc07f4

Please sign in to comment.