mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-20 23:46:23 +01:00
24915fd4bc
* update helper scripts to latest versions * added missed command for initialisation variables from Makefile * deployment/marketplace/vultr/helper-scripts/vultr-helper.sh: update helper script to latest version * fixed typo for using VM_VERSION variable * added an example of specifying the VM_VERSION and tokens for API's * set packer logging to STDOUT by default
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Ensure /tmp exists and has the proper permissions before
|
|
# checking for security updates
|
|
# https://github.com/digitalocean/marketplace-partners/issues/94
|
|
if [[ ! -d /tmp ]]; then
|
|
mkdir /tmp
|
|
fi
|
|
chmod 1777 /tmp
|
|
|
|
apt-get -y update
|
|
apt-get -y upgrade
|
|
rm -rf /tmp/* /var/tmp/*
|
|
history -c
|
|
cat /dev/null > /root/.bash_history
|
|
unset HISTFILE
|
|
apt-get -y autoremove
|
|
apt-get -y autoclean
|
|
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \;
|
|
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
|
|
rm -rf /var/lib/cloud/instances/*
|
|
rm -f /root/.ssh/authorized_keys /etc/ssh/*key*
|
|
touch /etc/ssh/revoked_keys
|
|
chmod 600 /etc/ssh/revoked_keys
|
|
sudo apt-get purge droplet-agent -y
|
|
history -c
|
|
cat /dev/null > /root/.bash_history
|
|
unset HISTFILE
|
|
|
|
# Securely erase the unused portion of the filesystem
|
|
GREEN='\033[0;32m'
|
|
NC='\033[0m'
|
|
printf "\n${GREEN}Writing zeros to the remaining disk space to securely
|
|
erase the unused portion of the file system.
|
|
Depending on your disk size this may take several minutes.
|
|
The secure erase will complete successfully when you see:${NC}
|
|
dd: writing to '/zerofile': No space left on device\n
|
|
Beginning secure erase now\n"
|
|
|
|
dd if=/dev/zero of=/zerofile &
|
|
PID=$!
|
|
while [ -d /proc/$PID ]
|
|
do
|
|
printf "."
|
|
sleep 5
|
|
done
|
|
sync; rm /zerofile; sync
|
|
cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp
|