2021-11-04 13:24:48

This commit is contained in:
gbaconni
2021-11-04 13:24:48 +01:00
parent d223338761
commit 834fd69dfc
2 changed files with 16 additions and 5 deletions

View File

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

View File

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