# SOHO LAN gateway w/ masquerading firewall on LIME2 box # Targets: Debian 9 (Stretch) or newer # Depends: boxer-data (>= 10.5.14) classes: - Console.setup - Console.filemanager - Admin.etc.functions - Admin - Admin.apt.auto - Admin.apt.auto.upgrade - Service.ssh - Service.dhcp.isc.server.authoritative - Service.dhcp.client - Service.mail.mta.dma - Service.scheduler.systemd - Hardware.motherboard.olimex.lime2 - Hardware.harden - Framework.localization.limit - Framework.pkg.apt.autoremove-suggests - Framework.pkg.apt.avoid-removals - Framework.pkg.apt.aptitude.advance-on-action - Framework.pkg.apt.aptitude.list-suite - Framework.pkg.apt.proxy.reset - Framework.pkg.apt.source.reset parameters: bug: - 483754 doc: gateway: pkg: - include bandwidth-saving remote shell service MoSH - Include traffic shaping service wondershaper tweak: - reset root account rcfiles from skeleton - limit video buffers (freeing memory for general use) - use HDMI (not serial port) as initial boot console - avoid bufferbloat - adapt default settings for console file manager Midnight Commander - set wireless regulatory domain to Denmark - (re)set ethernet devices to use dhcp, and routing - (re)set first ethernet device to use dhcp, routing, mDNS, and masquerading - enable Domain name (DNS) service systemd-resolved - use Cloudflare (not Google) fallback DNS resolvers - enable multicast DNS - enable Network Time (NTP) service systemd-timesyncd - use static IPs as fallback with NTP to avoid DNSSEC deadlock pkg: - iproute2 - iw - wpasupplicant - modemmanager - mosh - iftop - locales - sudo - whiptail - debian-security-support - procps - wondershaper pkg-avoid: - xauth tweak: - > files=".bash_logout .bashrc .profile";\ for file in $files; do \ cp -f "/target/etc/skel/$file" "/target/root/$file";\ done;\ echo '' >> /target/root/.profile;\ echo 'mesg n || true' >> /target/root/.profile - > _setappendvar /target/etc/default/flash-kernel \ LINUX_KERNEL_CMDLINE_DEFAULTS \ '"sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16"' - > file=/target/etc/flash-kernel/bootscript/bootscr.sunxi;\ _backup "$file";\ sed -i -r -e '2asetenv console tty0\''n' "$file" - > _setappendvar /target/etc/sysctl.d/local-bufferbloat.conf \ net.core.default_qdisc fq_codel - > file=/target/etc/mc/mc.ini;\ _backup "$file";\ echo '[Midnight-Commander]' > "$file";\ echo 'auto_save_setup=false' >> "$file";\ echo 'use_internal_view=true' >> "$file";\ echo 'use_internal_edit=true' >> "$file";\ echo 'num_history_items_recorded=200' >> "$file";\ echo 'editor_option_save_mode=false' >> "$file";\ echo 'editor_show_right_margin=false' >> "$file";\ echo 'skin=dark' >> "$file";\ echo '' >> "$file";\ echo '[Panels]' >> "$file";\ echo 'navigate_with_arrows=true' >> "$file";\ echo '' >> "$file";\ echo '[Layout]' >> "$file";\ echo 'message_visible=false' >> "$file";\ echo 'menubar_visible=false' >> "$file" - > _setappendvar /target/etc/default/crda \ REGDOMAIN DK - > _uuid(){ set -e;\ tmpfile=$(mktemp);\ (umask 077; fallocate --length 40kib "$tmpfile");\ PATH="/usr/sbin:/sbin:$PATH" mkswap "$tmpfile" | grep -Po '\bUUID=\K\S+';\ rm -f "$tmpfile"; } - > file=/target/etc/systemd/network/90-dhcp.network;\ _backup "$file";\ echo '[Match]' > "$file";\ echo 'Name=eth* en* wl*' >> "$file";\ echo '' >> "$file";\ echo '[Network]' >> "$file";\ echo 'DHCP=yes' >> "$file";\ echo 'IPForward=yes' >> "$file" - > file=/target/etc/systemd/network/10-eth0.network;\ _backup "$file";\ echo '[Match]' > "$file";\ echo 'Name=eth0' >> "$file";\ echo '' >> "$file";\ echo '[Network]' >> "$file";\ echo 'DHCP=yes' >> "$file";\ echo 'MulticastDNS=yes' >> "$file";\ echo 'LinkLocalAddressing=yes' >> "$file";\ echo 'IPForward=yes' >> "$file";\ echo 'IPMasquerade=yes' >> "$file" - systemctl enable systemd-networkd - > dir=/target/etc/systemd/resolved.conf.d;\ mkdir -p "$dir";\ file="$dir/local.conf";\ echo '[Resolve]' > "$file";\ echo 'FallbackDNS=1.1.1.1 1.0.0.1 2606:4700:4700::1111,2606:4700:4700::1001' >> "$file";\ echo 'MulticastDNS=yes' >> "$file" - systemctl enable systemd-resolved - > ln -sfT ../run/systemd/resolve/stub-resolv.conf \ /target/etc/resolv.conf - > dir=/target/etc/systemd/timesyncd.conf.d;\ mkdir -p "$dir";\ file="$dir/local.conf";\ echo '[Time]' > "$file";\ echo '# include static IPs (once expanded from former) to avoid DNSSEC deadlock' >> "$file";\ echo 'FallbackNTP=2.debian.pool.ntp.org 195.137.195.251 158.248.189.11 193.104.228.123 195.137.195.252 2001:ac8:37::40 2001:67c:28c8:12::123 2a00:1b70:1200:1::123 2001:67c:564::12' >> "$file" - systemctl enable systemd-timesyncd