Last active
February 6, 2024 22:35
-
-
Save jcppkkk/ba195725a2532bce3740315c637b7414 to your computer and use it in GitHub Desktop.
Revisions
-
jcppkkk revised this gist
Mar 2, 2023 . 1 changed file with 12 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,19 +6,17 @@ if [ `id -u` -ne 0 ]; then exit 1 fi set -v # Install vmware guest tool apt-get update apt-get install -y open-vm-tools apt-get clean # Stop services for cleanup service rsyslog stop # Clear audit logs if [ -f /var/log/audit/audit.log ]; then cat /dev/null > /var/log/audit/audit.log fi @@ -29,19 +27,19 @@ if [ -f /var/log/lastlog ]; then cat /dev/null > /var/log/lastlog fi # Cleanup persistent udev rules if [ -f /etc/udev/rules.d/70-persistent-net.rules ]; then rm /etc/udev/rules.d/70-persistent-net.rules fi # Cleanup /tmp directories rm -rf /tmp/* rm -rf /var/tmp/* # Cleanup current ssh keys rm -f /etc/ssh/ssh_host_* # regenerate ssh keys on next boot cat <<EOL | sudo tee /etc/rc.local #!/bin/sh -e # @@ -60,12 +58,9 @@ test -f /etc/ssh/ssh_host_dsa_key || dpkg-reconfigure openssh-server exit 0 EOL # Reset hostname cat /dev/null > /etc/hostname # Cleanup shell history history -c history -w -
jcppkkk created this gist
Jul 31, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ #!/bin/bash id if [ `id -u` -ne 0 ]; then echo Need sudo exit 1 fi set -v #add VMware package keys wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub -O - | apt-key add - #update apt-cache apt-get update #install packages apt-get install -y open-vm-tools #Stop services for cleanup service rsyslog stop #clear audit logs if [ -f /var/log/audit/audit.log ]; then cat /dev/null > /var/log/audit/audit.log fi if [ -f /var/log/wtmp ]; then cat /dev/null > /var/log/wtmp fi if [ -f /var/log/lastlog ]; then cat /dev/null > /var/log/lastlog fi #cleanup persistent udev rules if [ -f /etc/udev/rules.d/70-persistent-net.rules ]; then rm /etc/udev/rules.d/70-persistent-net.rules fi #cleanup /tmp directories rm -rf /tmp/* rm -rf /var/tmp/* #cleanup current ssh keys rm -f /etc/ssh/ssh_host_* #add check for ssh keys on reboot...regenerate if neccessary cat <<EOL | sudo tee /etc/rc.local #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. test -f /etc/ssh/ssh_host_dsa_key || dpkg-reconfigure openssh-server exit 0 EOL #reset hostname cat /dev/null > /etc/hostname #cleanup apt apt-get clean #cleanup shell history history -c history -w