From 86f4b75d0db3806188b2720776a9ce8b0db63d59 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 23 Nov 2018 02:25:38 +0100 Subject: [PATCH] WIP. --- all_new_2018/apt-mark/server | 2 +- all_new_2018/install_for_target.sh | 3 +++ .../linkable_etc_files/server/etc/iptables/rules.v4 | 3 ++- all_new_2018/setup_server.sh | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/all_new_2018/apt-mark/server b/all_new_2018/apt-mark/server index 8d332e0..8421675 100644 --- a/all_new_2018/apt-mark/server +++ b/all_new_2018/apt-mark/server @@ -5,4 +5,4 @@ readline-common # provides letsencrypt certbot # provides systemd scripts that configure iptables via /etc/iptables/* -iptables-persistent \ No newline at end of file +iptables-persistent diff --git a/all_new_2018/install_for_target.sh b/all_new_2018/install_for_target.sh index 7693a05..9d765aa 100755 --- a/all_new_2018/install_for_target.sh +++ b/all_new_2018/install_for_target.sh @@ -1,6 +1,8 @@ #!/bin/sh # Walks through the package names in the argument-selected files of # apt-mark/ and ensures the respective packages are installed. +# +# Ignores anything in an apt-mark/ file after the last newline. set -e config_tree_prefix="${HOME}/config/all_new_2018/apt-mark/" @@ -8,6 +10,7 @@ config_tree_prefix="${HOME}/config/all_new_2018/apt-mark/" for target in "$@"; do path="${config_tree_prefix}${target}" cat "${path}" | while read line; do + echo "$line" if [ ! $(echo "${line}" | cut -c1) = "#" ]; then apt-get -y install "${line}" fi diff --git a/all_new_2018/linkable_etc_files/server/etc/iptables/rules.v4 b/all_new_2018/linkable_etc_files/server/etc/iptables/rules.v4 index f568789..01dca75 100644 --- a/all_new_2018/linkable_etc_files/server/etc/iptables/rules.v4 +++ b/all_new_2018/linkable_etc_files/server/etc/iptables/rules.v4 @@ -8,4 +8,5 @@ -A INPUT -p tcp --dport 443 -j ACCEPT -A INPUT -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -COMMIT \ No newline at end of file +COMMIT +# iptables-restore seems to ignore COMMIT if no newline follows it \ No newline at end of file diff --git a/all_new_2018/setup_server.sh b/all_new_2018/setup_server.sh index c3d5ce5..ea3437a 100755 --- a/all_new_2018/setup_server.sh +++ b/all_new_2018/setup_server.sh @@ -5,7 +5,7 @@ set -e # Provide maximum input for set_hostname_and_fqdn.sh. if [ "$#" -ne 2 ]; then - echo "Need exactly two arguments (hostname, FQDN)." + echo 'Need exactly two arguments (hostname, FQDN).' false fi hostname="$1" @@ -21,8 +21,8 @@ fqdn="$2" # Some debconf selections we don't want to get asked during coming # install actions. -debconf-set-selections <<< "iptables-persistent iptables-persistent/autosave_v4 boolean false" -debconf-set-selections <<< "iptables-persistent iptables-persistent/autosave_v6 boolean false" +echo 'iptables-persistent iptables-persistent/autosave_v4 boolean false' | debconf-set-selections +echo 'iptables-persistent iptables-persistent/autosave_v6 boolean false' | debconf-set-selections # Ensure package installation state as defined by what packages are # defined as required by Debian policy and by settings in ./apt-mark/. -- 2.30.2