diff --git a/bootstrap.sh b/bootstrap.sh index 49bdfef..5768c3a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -6,10 +6,12 @@ # By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2021/11/04 10:58:16 by gbaconni #+# #+# # -# Updated: 2021/11/04 12:26:06 by gbaconni ### lausanne.ch # +# Updated: 2021/11/04 13:24:40 by gbaconni ### lausanne.ch # # # # **************************************************************************** # +PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ft_apt () { user=${1-marvin} @@ -72,18 +74,26 @@ ft_rc_local () ft_ufw () { user=${1-marvin} + port=${2-4242} ft_rc_local cp /etc/rc.local /etc/rc.local.orig echo '#!/bin/sh' > /etc/rc.local echo '/usr/sbin/ufw enable' >> /etc/rc.local - echo '/usr/sbin/ufw allow ssh' >> /etc/rc.local - echo '/usr/sbin/ufw allow proto tcp from any to any port 4242' >> /etc/rc.local - echo 'mv -f /etc/rc.local /etc/rc.local.baco' >> /etc/rc.local + echo '/usr/sbin/ufw allow proto tcp from any to any port '${port} >> /etc/rc.local echo 'mv -f /etc/rc.local.orig /etc/rc.local' >> /etc/rc.local echo 'test -x /etc/rc.local && /etc/rc.local' >> /etc/rc.local echo 'exit 0' >> /etc/rc.local } +ft_monitoring () +{ + user=${1-marvin} + curl -sLo /usr/local/bin/monitoring.sh 'https://42url.com/tDJM3BPO' + chmod 0755 /usr/local/bin/monitoring.sh + echo "*/10 * * * * root /usr/local/bin/monitoring.sh 2>/dev/null | fold -w 80 | wall -n" > /etc/cron.d/monitoring + echo "MONITORING=yes" > /etc/default/monitoring +} + main () { user=${1-marvin} @@ -95,6 +105,7 @@ main () ft_policy ${user} ft_sudo ${user} ft_ufw ${user} ${port} + ft_monitoring ${user} echo "That's all Folks!" return 0 } diff --git a/preseed.cfg b/preseed.cfg index 9ed7552..12ff65b 100644 --- a/preseed.cfg +++ b/preseed.cfg @@ -431,7 +431,7 @@ d-i apt-setup/security_host string security.debian.org tasksel tasksel/first multiselect minimal # Individual additional packages to install -d-i pkgsel/include string openssh-server sudo libpam-pwquality ufw vim curl wget bc +d-i pkgsel/include string openssh-server sudo libpam-pwquality ufw vim curl wget bc man # Whether to upgrade packages after debootstrap. # Allowed values: none, safe-upgrade, full-upgrade d-i pkgsel/upgrade select full-upgrade