Tools/Linux_reinstall/Ubuntu/CloudInit/ipv6_static_interfaces.cfg
2023-09-30 06:29:11 +09:00

76 lines
2.1 KiB
INI

#cloud-config
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
# configure cloud-init for NoCloud
datasource_list: [ NoCloud, None ]
# configure repository
system_info:
package_mirrors:
- arches: [i386, amd64]
failsafe:
primary: http://targetLinuxMirror/ubuntu
security: http://security.ubuntu.com/ubuntu
- arches: [arm64, armel, armhf]
failsafe:
primary: http://targetLinuxMirror/ubuntu-ports
security: http://targetLinuxMirror/ubuntu-ports
# configure hostname
hostname: HostName
# configure localization
locale: en_US.UTF-8
# configure timezone
timezone: TimeZone
# configure root user
users:
- name: root
lock_passwd: false
shell: /bin/bash
chpasswd:
expire: false
list: |
root:tmpWORD
users:
- name: root
password: tmpWORD
type: text
# configure network
network:
version: 2
ethernets:
networkAdapter:
dhcp6: false
addresses: [ip6Addr/ip6Mask]
routes:
- to: default
via: ip6Gate
on-link: true
nameservers:
addresses: [ip6DNS1, ip6DNS2]
# later commands
runcmd:
- sed -ri 's/^#?Port.*/Port sshPORT/g' /etc/ssh/sshd_config
- update-rc.d ssh enable
- ssh-keygen -A
- /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
- apt install dnsutils fail2ban file lrzsz net-tools vim wget -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
- mv /etc/netplan/50-cloud-init.yaml /etc/netplan/20-netcfg.yaml
- netplan apply
- sed -i '/^\[Definition\]/a allowipv6 = auto' /etc/fail2ban/fail2ban.conf
- sed -ri 's/^backend = auto/backend = systemd/g' /etc/fail2ban/jail.conf
- update-rc.d fail2ban enable
- /etc/init.d/fail2ban restart
- rm -rf /etc/cloud/cloud.cfg.d/99-fake_cloud.cfg
- touch /etc/cloud/cloud-init.disabled