blob: 952d4fe632d7eeaa0020d6a38f418a66fa541c91 (
plain) (
tree)
|
|
# Functions for cleaning some stuff after script run
clean_logfiles() {
# delete only files, not directories
find /var/log -type f -delete
ERR=$?
[ $ERR -eq 0 ] && echo " ok." || echo " error cleaning log files."
}
clean_authorized_hosts() {
[ -f /root/.ssh/authorized_keys ] && rm -f /root/.ssh/authorized_keys
ERR=$?
[ $ERR -eq 0 ] && echo " ok." || echo " error cleaning authorized keys file."
}
clean_idrsa() {
[ -f /root/.ssh/id_rsa ] && rm -f /root/.ssh/id_rsa # rsa will suffice for our git keys
ERR=$?
[ $ERR -eq 0 ] && echo " ok." || echo " error cleaning id_rsa identity file."
}
clean_install() {
GESERR=0
echo "#"
echo "# Now, let's clean some unnecessary or harmful entries, e.g. "
echo "# entries in authorized_hosts, .bash_history and files beneath /var/log."
echo "#"
echo -n "# cleaning authorized_hosts ..."
clean_authorized_hosts
echo -n "# cleaning id_rsa private key ..."
clean_idrsa
echo -n "# cleaning log files ..."
clean_logfiles
}
|