Update ipv4_static_interfaces.cfg

This commit is contained in:
Molly Lau 2023-08-27 16:49:59 +09:00 committed by GitHub
parent 20a279ba3f
commit fa42adaef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,6 +60,13 @@ network:
addresses: [ipDNS1, ipDNS2]
# later commands
# Replace ssh port, permit root user login by password, enable sshd service.
# Disable kernel need to restart: https://askubuntu.com/questions/1349884/how-to-disable-pending-kernel-upgrade-message
# Disable and remove snap permanently: https://sysin.org/blog/ubuntu-remove-snap/
# Install some common components.
# Rename netplan config file.
# Configure fail2ban.
# Delete cloud-init config file and disable it permanently after first execution.
runcmd:
- sed -ri 's/^#?Port.*/Port sshPORT/g' /etc/ssh/sshd_config
- sed -ri 's/^#?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
@ -68,7 +75,15 @@ runcmd:
- /etc/init.d/ssh restart
- sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf
- sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
- apt update
- snap remove lxd
- snap remove $(snap list | grep "core[0-9]" | head -n 1 | awk '{print $1}')
- snap remove snapd
- apt autoremove --purge snapd -y
- rm -rf /etc/apt/preferences.d/no-snapd.pref
- echo 'Package: snapd' > /etc/apt/preferences.d/no-snapd.pref
- echo 'Pin: release a=*' >> /etc/apt/preferences.d/no-snapd.pref
- echo 'Pin-Priority: -10' >> /etc/apt/preferences.d/no-snapd.pref
- apt update -y
- apt install dnsutils fail2ban file lrzsz net-tools traceroute unzip vim wget xz-utils -y
- sed -ri 's/set compatible/set nocompatible/g' /etc/vim/vimrc.tiny
- sed -ri '/set nocompatible/a\set backspace=2' /etc/vim/vimrc.tiny