diff --git a/preseed/debian/jessie/preseed.cfg b/preseed/debian/jessie/preseed.cfg index 95f7980..0222826 100644 --- a/preseed/debian/jessie/preseed.cfg +++ b/preseed/debian/jessie/preseed.cfg @@ -358,5 +358,5 @@ in-target /bin/rmdir /mnt/free ; in-target /bin/sed -i '/lv_free/d' /etc/fstab ; in-target /bin/sed -i 's/without-password/yes/g' /etc/ssh/sshd_config ; \ in-target /usr/bin/tftp 129.20.203.27 -c get scripts/latecommand.tar.gz /tmp/latecommand.tar.gz ; \ in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ -in-target /bin/sh /tmp/latecommand/post.sh +in-target /bin/sh /tmp/latecommand/post.jessie.sh diff --git a/preseed/debian/jessie/preseed_cinnamon.cfg b/preseed/debian/jessie/preseed_cinnamon.cfg index e9d9a92..2b31ce2 100644 --- a/preseed/debian/jessie/preseed_cinnamon.cfg +++ b/preseed/debian/jessie/preseed_cinnamon.cfg @@ -349,5 +349,5 @@ in-target /bin/rmdir /mnt/free ; in-target /bin/sed -i '/lv_free/d' /etc/fstab ; in-target /bin/sed -i 's/without-password/yes/g' /etc/ssh/sshd_config ; \ in-target /usr/bin/tftp 129.20.203.27 -c get scripts/latecommand.tar.gz /tmp/latecommand.tar.gz ; \ in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ -in-target /bin/sh /tmp/latecommand/post.sh +in-target /bin/sh /tmp/latecommand/post.jessie.sh diff --git a/preseed/debian/jessie/preseed_gnome.cfg b/preseed/debian/jessie/preseed_gnome.cfg index cf552bf..9a0cc99 100644 --- a/preseed/debian/jessie/preseed_gnome.cfg +++ b/preseed/debian/jessie/preseed_gnome.cfg @@ -349,5 +349,5 @@ in-target /bin/rmdir /mnt/free ; in-target /bin/sed -i '/lv_free/d' /etc/fstab ; in-target /bin/sed -i 's/without-password/yes/g' /etc/ssh/sshd_config ; \ in-target /usr/bin/tftp 129.20.203.27 -c get scripts/latecommand.tar.gz /tmp/latecommand.tar.gz ; \ in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ -in-target /bin/sh /tmp/latecommand/post.sh +in-target /bin/sh /tmp/latecommand/post.jessie.sh diff --git a/preseed/debian/jessie/preseed_mate.cfg b/preseed/debian/jessie/preseed_mate.cfg index cc2de01..ff5ca47 100644 --- a/preseed/debian/jessie/preseed_mate.cfg +++ b/preseed/debian/jessie/preseed_mate.cfg @@ -349,5 +349,5 @@ in-target /bin/rmdir /mnt/free ; in-target /bin/sed -i '/lv_free/d' /etc/fstab ; in-target /bin/sed -i 's/without-password/yes/g' /etc/ssh/sshd_config ; \ in-target /usr/bin/tftp 129.20.203.27 -c get scripts/latecommand.tar.gz /tmp/latecommand.tar.gz ; \ in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ -in-target /bin/sh /tmp/latecommand/post.sh +in-target /bin/sh /tmp/latecommand/post.jessie.sh diff --git a/preseed/debian/wheezy/preseed.cfg b/preseed/debian/wheezy/preseed.cfg index b2e8d17..c82a9ee 100644 --- a/preseed/debian/wheezy/preseed.cfg +++ b/preseed/debian/wheezy/preseed.cfg @@ -355,5 +355,5 @@ in-target /bin/rmdir /mnt/free ; in-target /bin/sed -i '/lv_free/d' /etc/fstab ; in-target /bin/sed -i 's/without-password/yes/g' /etc/ssh/sshd_config ; \ in-target /usr/bin/tftp 129.20.203.27 -c get scripts/latecommand.tar.gz /tmp/latecommand.tar.gz ; \ in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ -in-target /bin/sh /tmp/latecommand/post.sh +in-target /bin/sh /tmp/latecommand/post.jessie.sh diff --git a/preseed/debian/wheezy/preseed_cluster.cfg b/preseed/debian/wheezy/preseed_cluster.cfg index 6114d17..5683ee5 100644 --- a/preseed/debian/wheezy/preseed_cluster.cfg +++ b/preseed/debian/wheezy/preseed_cluster.cfg @@ -336,5 +336,5 @@ in-target /bin/rmdir /mnt/workl ; in-target /bin/sed -i '/lv_workl/d' /etc/fstab in-target /bin/sed -i 's/without-password/yes/g' /etc/ssh/sshd_config ; \ in-target /usr/bin/tftp 129.20.203.27 -c get scripts/latecommand.tar.gz /tmp/latecommand.tar.gz ; \ in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ -in-target /bin/sh /tmp/latecommand/post.sh +in-target /bin/sh /tmp/latecommand/post.jessie.sh diff --git a/preseed/debian/wheezy/preseed_gnome.cfg b/preseed/debian/wheezy/preseed_gnome.cfg index 51e6453..3749a1e 100644 --- a/preseed/debian/wheezy/preseed_gnome.cfg +++ b/preseed/debian/wheezy/preseed_gnome.cfg @@ -346,5 +346,5 @@ in-target /bin/rmdir /mnt/free ; in-target /bin/sed -i '/lv_free/d' /etc/fstab ; in-target /bin/sed -i 's/without-password/yes/g' /etc/ssh/sshd_config ; \ in-target /usr/bin/tftp 129.20.203.27 -c get scripts/latecommand.tar.gz /tmp/latecommand.tar.gz ; \ in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ -in-target /bin/sh /tmp/latecommand/post.sh +in-target /bin/sh /tmp/latecommand/post.jessie.sh diff --git a/scripts/latecommand.tar.gz b/scripts/latecommand.tar.gz index 56b7630..91ad9dd 100644 Binary files a/scripts/latecommand.tar.gz and b/scripts/latecommand.tar.gz differ diff --git a/scripts/latecommand/logrotate.jessie/aptitude b/scripts/latecommand/logrotate.jessie/aptitude new file mode 100644 index 0000000..25cbff8 --- /dev/null +++ b/scripts/latecommand/logrotate.jessie/aptitude @@ -0,0 +1,8 @@ +/var/log/aptitude { + rotate 6 + weekly + compress + missingok + notifempty + olddir /var/log/old_logs +} diff --git a/scripts/latecommand/logrotate.jessie/dpkg b/scripts/latecommand/logrotate.jessie/dpkg new file mode 100644 index 0000000..933457d --- /dev/null +++ b/scripts/latecommand/logrotate.jessie/dpkg @@ -0,0 +1,22 @@ +/var/log/dpkg.log { + weekly + rotate 12 + compress + delaycompress + missingok + notifempty + create 644 root root + olddir /var/log/old_logs +} + +/var/log/alternatives.log { + weekly + rotate 12 + compress + delaycompress + missingok + notifempty + create 644 root root + olddir /var/log/old_logs +} + diff --git a/scripts/latecommand/logrotate.jessie/logrotate.conf b/scripts/latecommand/logrotate.jessie/logrotate.conf new file mode 100644 index 0000000..446156b --- /dev/null +++ b/scripts/latecommand/logrotate.jessie/logrotate.conf @@ -0,0 +1,43 @@ +# see "man logrotate" for details +# rotate log files weekly +weekly + +# keep 4 weeks worth of backlogs +rotate 4 + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +compress + +# compress only from the second log file +delaycompress + +# use date as a suffix of the rotated file +dateext + +# packages drop log rotation information into this directory +include /etc/logrotate.d + +# no packages own wtmp, or btmp -- we'll rotate them here +/var/log/wtmp { + missingok + notifempty + monthly + create 0664 root utmp + olddir /var/log/old_logs + rotate 3 +} + +/var/log/btmp { + missingok + notifempty + monthly + create 0664 root utmp + olddir /var/log/old_logs + rotate 3 +} + +# system-specific logs may be configured here +# See /etc/logrotate.d/rsyslog diff --git a/scripts/latecommand/logrotate.jessie/rsyslog b/scripts/latecommand/logrotate.jessie/rsyslog new file mode 100644 index 0000000..a1c5859 --- /dev/null +++ b/scripts/latecommand/logrotate.jessie/rsyslog @@ -0,0 +1,76 @@ +# Ensure to rotate all log files (old and new logpath from Rsyslog) + +/var/log/syslog/syslog +/var/log/syslog/syslog.log +/var/log/syslog/daemon.log +/var/log/syslog/local0.log +/var/log/syslog/local1.log +/var/log/syslog/local2.log +/var/log/syslog/local3.log +/var/log/syslog/local4.log +/var/log/syslog/local5.log +/var/log/syslog/local6.log +/var/log/syslog/local7.log +/var/log/syslog/uucp.log +/var/log/syslog +/var/log/syslog.log +/var/log/daemon.log +/var/log/local0.log +/var/log/local1.log +/var/log/local2.log +/var/log/local3.log +/var/log/local4.log +/var/log/local5.log +/var/log/local6.log +/var/log/local7.log +/var/log/uucp.log +{ + rotate 7 + daily + missingok + notifempty + compress + delaycompress + postrotate + invoke-rc.d rsyslog rotate > /dev/null + endscript +} + +/var/log/cron/cron.log +/var/log/cron/mark.log +/var/log/kernel/kern.log +/var/log/kernel/kernel.log +/var/log/lpr/lpr.log +/var/log/mail/*.log +/var/log/security/auth.log +/var/log/security/authpriv.log +/var/log/security/user.log +/var/log/messages/messages +/var/log/news/news.log +/var/log/cron.log +/var/log/mark.log +/var/log/kern.log +/var/log/kernel.log +/var/log/lpr.log +/var/log/mail.log +/var/log/mail.info +/var/log/mail.warn +/var/log/mail.err +/var/log/auth.log +/var/log/authpriv.log +/var/log/user.log +/var/log/messages +/var/log/debug +{ + rotate 4 + maxsize 250k + weekly + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + invoke-rc.d rsyslog rotate > /dev/null + endscript +} diff --git a/scripts/latecommand/post.jessie.sh b/scripts/latecommand/post.jessie.sh new file mode 100755 index 0000000..41fd0d3 --- /dev/null +++ b/scripts/latecommand/post.jessie.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +RSYSLOGD_CONF="$(dirname $0)/rsyslog.jessie/rsyslog.conf" +RSYSLOGD_FILE="/etc/rsyslog.conf" +RSYSLOGD_SYSLOG_CONF="$(dirname $0)/rsyslog.jessie/99syslog.conf" +RSYSLOGD_SYSLOG_FILE="/etc/rsyslog.d/99syslog.conf" + +LOGROTATE_CONF="$(dirname $0)/logrotate.jessie/logrotate.conf" +LOGROTATE_FILE="/etc/logrotate.conf" +LOGROTATE_SYSLOG_CONF="$(dirname $0)/logrotate.jessie/rsyslog" +LOGROTATE_SYSLOG_FILE="/etc/logrotate.d/rsyslog" +LOGROTATE_APTITUDE_CONF="$(dirname $0)/logrotate.jessie/aptitude" +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 tmux zsh + +# Remove NFS and rpcbind +aptitude -y remove nfs-common rpcbind + +### Tasksel {{{ + +if [ "$(dpkg -l task-french)" ]; then + # Move default wordlist to american before remove all packages + select-default-wordlist --set-default=american + aptitude -y remove tasksel tasksel-data task-english task-french task-ssh-server laptop-detect + + # Reinstall useful french doc and move back to french dict + aptitude -y install aspell-fr doc-debian-fr doc-linux-fr-text ifrench-gut manpages-fr manpages-fr-extra wfrench + select-default-wordlist --set-default=".*(F|f)rench.*" + +else + aptitude -y remove tasksel tasksel-data task-english task-ssh-server laptop-detect +fi + +### }}} + +# Ensure to reinstall openssh-server +aptitude -y install openssh-server openssh-sftp-server + +## }}} + +exit 0 diff --git a/scripts/latecommand/rsyslog.jessie/99syslog.conf b/scripts/latecommand/rsyslog.jessie/99syslog.conf new file mode 100644 index 0000000..6267bb0 --- /dev/null +++ b/scripts/latecommand/rsyslog.jessie/99syslog.conf @@ -0,0 +1,28 @@ +# Default rules for rsyslog. +# +# For more information see rsyslog.conf(5) and /etc/rsyslog.conf +#---------------------------------------------------------------------------- +# Fichier de configuration du daemon syslogd +#---------------------------------------------------------------------------- +kern.* /var/log/kernel/kernel.log +user.* /var/log/security/user.log +mail.* /var/log/mail/mail.log +daemon.* /var/log/syslog/daemon.log +auth.* /var/log/security/auth.log +lpr.* /var/log/lpr/lpr.log +news.* /var/log/news/news.log +uucp.* /var/log/syslog/uucp.log +cron.* /var/log/cron/cron.log +mark.* /var/log/cron/mark.log +local0.* /var/log/syslog/local0.log +local1.* /var/log/syslog/local1.log +local2.* /var/log/syslog/local2.log +local3.* /var/log/syslog/local3.log +local4.* /var/log/syslog/local4.log +local5.* /var/log/syslog/local5.log +local6.* /var/log/syslog/local6.log +local7.* /var/log/syslog/local7.log +syslog.* /var/log/syslog/syslog.log +authpriv.* /var/log/security/authpriv.log +*.=info;*.=notice /var/log/messages/messages + diff --git a/scripts/latecommand/rsyslog.jessie/rsyslog.conf b/scripts/latecommand/rsyslog.jessie/rsyslog.conf new file mode 100644 index 0000000..85967ca --- /dev/null +++ b/scripts/latecommand/rsyslog.jessie/rsyslog.conf @@ -0,0 +1,61 @@ +# /etc/rsyslog.conf Configuration file for rsyslog. +# More information http://wiki.rsyslog.com/index.php/ +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +$ModLoad imklog # provides kernel logging support +#$ModLoad immark # provides --MARK-- message capability + +$KLogPath /proc/kmsg + +# provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Filter duplicated messages +$RepeatedMsgReduction on + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + +############### +#### RULES #### +############### +# See /etc/rsyslog.d/99syslog.conf