Browse Source

new: [host] several small adjustments

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
pull/1/head
Valentin Lab 4 years ago
parent
commit
6d3e7ce648
  1. 2
      precise/host/hooks/install.d/40-btrfs.sh
  2. 2
      precise/host/hooks/install.d/60-docker.sh
  3. 1
      precise/host/hooks/install.d/61-mirror-dir.sh
  4. 23
      precise/host/hooks/install.d/75-fail2ban.sh
  5. 2
      precise/host/hooks/install.d/80-dns-waterfall.sh
  6. 31
      precise/host/hooks/install.d/95-checks.sh
  7. 4
      precise/host/hooks/install.d/96-backup-lxc.sh

2
precise/host/hooks/install.d/40-btrfs.sh

@ -54,7 +54,7 @@ if [ "$UPDATE_BTRFS_TOOLS" ]; then
zlib1g-dev python3-dev python3-setuptools libacl1-dev e2fslibs-dev \ zlib1g-dev python3-dev python3-setuptools libacl1-dev e2fslibs-dev \
libblkid-dev liblzo2-dev libzstd-dev </dev/null && libblkid-dev liblzo2-dev libzstd-dev </dev/null &&
./autogen.sh && ./autogen.sh &&
./configure --prefix=/opt/apps/btrfs-tools &&
./configure --prefix=/opt/apps/btrfs-tools --disable-zoned &&
make && make &&
make install && make install &&
ln -sf /opt/apps/btrfs-tools/bin/* /usr/local/bin/ ln -sf /opt/apps/btrfs-tools/bin/* /usr/local/bin/

2
precise/host/hooks/install.d/60-docker.sh

@ -21,7 +21,7 @@ if [ -n "$just_installed" ]; then
grep "$docker_version" | grep "$docker_version" |
head -n 1 | xargs echo)" head -n 1 | xargs echo)"
## DOWNGRADE to 17.xx because 18.xx do not support registry v1 ## DOWNGRADE to 17.xx because 18.xx do not support registry v1
apt-get install -y docker-ce="$version"
apt-get install -y --allow-downgrades docker-ce="$version"
need_restart=true need_restart=true
fi fi

1
precise/host/hooks/install.d/61-mirror-dir.sh

@ -0,0 +1 @@
../../../../rsync-backup/hooks/install.d/60-install.sh

23
precise/host/hooks/install.d/75-fail2ban.sh

@ -0,0 +1,23 @@
#!/bin/bash
## Depends lxc-scripts installed
##
## Install
##
apt-get install -y fail2ban </dev/null
sed -ri 's/^(bantime\s+=\s+.*)$/bantime = 1w/g' /etc/fail2ban/jail.conf
sed -ri 's/^(findtime\s+=\s+.*)$/findtime = 26w/g' /etc/fail2ban/jail.conf
##
## Test
##
# fail2ban-client status
# fail2ban-client status sshd

2
precise/host/hooks/install.d/80-dns-waterfall.sh

@ -53,8 +53,8 @@ chown bind:bind /var/log/named
service lxc restart service lxc restart
service lxc-net restart ## had to 'brctl delbr lxcbr0' myself service lxc-net restart ## had to 'brctl delbr lxcbr0' myself
/etc/init.d/bind9 start
/etc/init.d/dnsmasq start /etc/init.d/dnsmasq start
/etc/init.d/bind9 start
cp /etc/resolv.conf{,.orig} cp /etc/resolv.conf{,.orig}
cat <<EOF > /etc/resolv.conf cat <<EOF > /etc/resolv.conf

31
precise/host/hooks/install.d/95-checks.sh

@ -2,16 +2,39 @@
## REQUIRES: 0k-manage mail ## REQUIRES: 0k-manage mail
ln -sf /opt/apps/0k-manage/src/etc/cron.hourly/check-* /etc/cron.hourly/
[ -n "${BACKUP_SERVER}" ] || {
echo "Error: you must set \$BACKUP_SERVER prior to running this script." >&2
exit 1
}
if ! [ -e "/etc/default/alerting" ]; then
if [ -z "$DEFAULT_ALERTING_EMAILS" ]; then
echo "You must define \$DEFAULT_ALERTING_EMAILS before launching this script." >&2
exit 1
fi
cat <<EOF > /etc/default/alerting
MAIL_DESTS=(
$(
for email in $DEFAULT_ALERTING_EMAILS; do
echo " $email"
done
)
)
EOF
fi
ln -sf /opt/apps/0k-charms/rsync-backup/resources/bin/mirror-dir-check /usr/local/sbin/
ln -sfv /opt/apps/0k-manage/src/etc/cron.hourly/check-* /etc/cron.hourly/
if ! [ -e /usr/local/sbin/mirror-dir ]; then
ln -sfv /opt/apps/0k-charms/rsync-backup/resources/bin/mirror-dir /usr/local/sbin/
fi
mailname=$(cat /etc/mailname)
mailname=${mailname%.localdomain}
cat <<EOF > /etc/cron.d/mirror-dir-check cat <<EOF > /etc/cron.d/mirror-dir-check
SHELL=/bin/bash SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
35 * * * * root mirror-dir-check -d "core-06.0k.io:10023" -n '12 hours' | logger -t mirror-dir-check
35 * * * * root mirror-dir check -d "$BACKUP_SERVER:10023" -n '12 hours' | logger -t mirror-dir-check
EOF EOF

4
precise/host/hooks/install.d/96-backup-lxc.sh

@ -6,8 +6,8 @@
## Backup lxc ## Backup lxc
## ##
ln -sf /opt/apps/lxc-scripts/etc/cron.hourly/* /etc/cron.hourly/
ln -sf /opt/apps/lxc-scripts/etc/cron.daily/* /etc/cron.daily/
ln -sfv /opt/apps/lxc-scripts/etc/cron.hourly/* /etc/cron.hourly/
ln -sfv /opt/apps/lxc-scripts/etc/cron.daily/* /etc/cron.daily/
if ! grep ^BACKUP_LXC_PATH= /etc/default/lxc >/dev/null 2>&1; then if ! grep ^BACKUP_LXC_PATH= /etc/default/lxc >/dev/null 2>&1; then

Loading…
Cancel
Save