64 lines
2.0 KiB
Bash
Executable File
64 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
RSYSLOGD_CONF="$(dirname $0)/rsyslog/rsyslog.conf"
|
|
RSYSLOGD_FILE="/etc/rsyslog.conf"
|
|
RSYSLOGD_SYSLOG_CONF="$(dirname $0)/rsyslog/99syslog.conf"
|
|
RSYSLOGD_SYSLOG_FILE="/etc/rsyslog.d/99syslog.conf"
|
|
|
|
LOGROTATE_CONF="$(dirname $0)/logrotate/logrotate.conf"
|
|
LOGROTATE_FILE="/etc/logrotate.conf"
|
|
LOGROTATE_SYSLOG_CONF="$(dirname $0)/logrotate/rsyslog"
|
|
LOGROTATE_SYSLOG_FILE="/etc/logrotate.d/rsyslog"
|
|
LOGROTATE_APTITUDE_CONF="$(dirname $0)/logrotate/aptitude"
|
|
LOGROTATE_APTITUDE_FILE="/etc/logrotate.d/aptitude"
|
|
LOGROTATE_DPKG_CONF="$(dirname $0)/logrotate/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}"
|
|
|
|
# Restart Rsyslog service
|
|
systemctl restart rsyslog
|
|
|
|
### 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 /var/log/aptitude.d /var/log/dpkg /var/log/alternatives /var/log/syslog.d /var/log/cron /var/log/daemon /var/log/kern /var/log/lpr /var/log/mail /var/log/auth /var/log/messages.d
|
|
|
|
chmod 0750 /var/log/auth /var/log/daemon /var/log/kern /var/log/messages.d /var/log/syslog.d
|
|
chown root:adm /var/log/auth /var/log/daemon /var/log/kern /var/log/messages.d /var/log/syslog.d
|
|
|
|
# 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
|
|
|
|
# Ensure to reinstall openssh-server
|
|
aptitude -y install openssh-server openssh-sftp-server
|
|
|
|
# Ansible dependencies
|
|
aptitude -y install python-apt
|
|
|
|
## }}}
|
|
|
|
exit 0
|