diff --git a/scripts/latecommand.tar.gz b/scripts/latecommand.tar.gz index 96032e9..dfff24d 100644 Binary files a/scripts/latecommand.tar.gz and b/scripts/latecommand.tar.gz differ diff --git a/scripts/latecommand/post.jessie.sh b/scripts/latecommand/post.jessie.sh index b8e5cae..18c6dad 100755 --- a/scripts/latecommand/post.jessie.sh +++ b/scripts/latecommand/post.jessie.sh @@ -14,44 +14,6 @@ LOGROTATE_APTITUDE_FILE="/etc/logrotate.d/aptitude" LOGROTATE_DPKG_CONF="$(dirname $0)/logrotate.jessie/dpkg" LOGROTATE_DPKG_FILE="/etc/logrotate.d/dpkg" -### Rsyslog ### - -# Install new Rsyslog configuration -if [ -f "${RSYSLOGD_FILE}" ]; then - cp "${RSYSLOGD_CONF}" "${RSYSLOGD_FILE}" -fi -cp "${RSYSLOGD_SYSLOG_CONF}" "${RSYSLOGD_SYSLOG_FILE}" - -# Remove old log files -## Kernel log files -rm -f /var/log/kern.log -## Authentication log files -rm -f /var/log/user.log /var/log/auth.log -## Mail log files -rm -f /var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn -## System log files -rm -f /var/log/daemon.log /var/log/syslog /var/log/messages - -# Restart Rsyslog service -/etc/init.d/rsyslog restart - -### Logrotate {{{ - -# Install new Logrotate configuration -if [ -f "${LOGROTATE_FILE}" ]; then - cp "${LOGROTATE_CONF}" "${LOGROTATE_FILE}" -fi -cp "${LOGROTATE_SYSLOG_CONF}" "${LOGROTATE_SYSLOG_FILE}" -cp "${LOGROTATE_APTITUDE_CONF}" "${LOGROTATE_APTITUDE_FILE}" -cp "${LOGROTATE_DPKG_CONF}" "${LOGROTATE_DPKG_FILE}" - -# Create an archive directory for some log files (aptitude, dpkg,…) -mkdir -p -- /var/log/old_logs - -# Create the log directory for journald (Systemd), need the configuration Storage=(auto|persistent) -mkdir -p -- /var/log/journal -### }}} - ## Packages {{{ # Ensure to have some basic packages apt -y install aptitude puppet tmux zsh @@ -81,4 +43,45 @@ aptitude -y install openssh-server openssh-sftp-server ## }}} +### Rsyslog {{{ + +# Install new Rsyslog configuration +if [ -f "${RSYSLOGD_FILE}" ]; then + cp "${RSYSLOGD_CONF}" "${RSYSLOGD_FILE}" +fi +cp "${RSYSLOGD_SYSLOG_CONF}" "${RSYSLOGD_SYSLOG_FILE}" + +# Remove old log files +## Kernel log files +rm -f /var/log/kern.log +## Authentication log files +rm -f /var/log/user.log /var/log/auth.log +## Mail log files +rm -f /var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn +## System log files +rm -f /var/log/daemon.log /var/log/syslog /var/log/messages + +# Restart Rsyslog service +/etc/init.d/rsyslog restart + +### }}} + +### Logrotate {{{ + +# Install new Logrotate configuration +if [ -f "${LOGROTATE_FILE}" ]; then + cp "${LOGROTATE_CONF}" "${LOGROTATE_FILE}" +fi +cp "${LOGROTATE_SYSLOG_CONF}" "${LOGROTATE_SYSLOG_FILE}" +cp "${LOGROTATE_APTITUDE_CONF}" "${LOGROTATE_APTITUDE_FILE}" +cp "${LOGROTATE_DPKG_CONF}" "${LOGROTATE_DPKG_FILE}" + +# Create an archive directory for some log files (aptitude, dpkg,…) +mkdir -p -- /var/log/old_logs + +# Create the log directory for journald (Systemd), need the configuration Storage=(auto|persistent) +mkdir -p -- /var/log/journal +### }}} + + exit 0 diff --git a/scripts/latecommand/post.sh b/scripts/latecommand/post.sh index 53cb50a..337118a 100755 --- a/scripts/latecommand/post.sh +++ b/scripts/latecommand/post.sh @@ -14,7 +14,22 @@ LOGROTATE_APTITUDE_FILE="/etc/logrotate.d/aptitude" LOGROTATE_DPKG_CONF="$(dirname $0)/logrotate/dpkg" LOGROTATE_DPKG_FILE="/etc/logrotate.d/dpkg" -### Rsyslog ### +## Packages {{{ +# Ensure to have some basic packages +apt -y install aptitude tmux zsh + +# Remove NFS and rpcbind +aptitude -y remove nfs-common rpcbind + +# Ensure to reinstall openssh-server +aptitude -y install openssh-server openssh-sftp-server + +# Ansible dependencies +aptitude -y install python-apt + +## }}} + +### Rsyslog {{{ # Install new Rsyslog configuration if [ -f "${RSYSLOGD_FILE}" ]; then @@ -25,6 +40,8 @@ cp "${RSYSLOGD_SYSLOG_CONF}" "${RSYSLOGD_SYSLOG_FILE}" # Restart Rsyslog service systemctl restart rsyslog +### }}} + ### Logrotate {{{ # Install new Logrotate configuration @@ -45,19 +62,4 @@ chown root:adm /var/log/auth /var/log/daemon /var/log/kern /var/log/messages.d / mkdir -p -- /var/log/journal ### }}} -## Packages {{{ -# Ensure to have some basic packages -apt -y install aptitude tmux zsh - -# Remove NFS and rpcbind -aptitude -y remove nfs-common rpcbind - -# Ensure to reinstall openssh-server -aptitude -y install openssh-server openssh-sftp-server - -# Ansible dependencies -aptitude -y install python-apt - -## }}} - exit 0