Add a copy of post.sh to ensure Debian before Stretch keep launch a working post-install script (see #12).

This commit is contained in:
Jeremy Gardais 2017-09-05 14:54:46 +02:00
parent fa36c470ad
commit 8c64644a93
15 changed files with 329 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

Binary file not shown.

View File

@ -0,0 +1,8 @@
/var/log/aptitude {
rotate 6
weekly
compress
missingok
notifempty
olddir /var/log/old_logs
}

View File

@ -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
}

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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