2023-06-08 04:50:33 +08:00
|
|
|
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
|
|
|
|
|
|
|
|
# configure repository
|
|
|
|
system_info:
|
|
|
|
package_mirrors:
|
|
|
|
- arches: [i386, amd64]
|
|
|
|
failsafe:
|
|
|
|
primary: http://targetLinuxMirror/ubuntu
|
|
|
|
security: http://security.ubuntu.com/ubuntu
|
|
|
|
- arches: [armhf, armel, default]
|
|
|
|
failsafe:
|
|
|
|
primary: http://targetLinuxMirror/ubuntu-ports
|
|
|
|
security: http://targetLinuxMirror/ubuntu-ports
|
|
|
|
|
|
|
|
# configure hostname
|
|
|
|
hostname: HostName
|
|
|
|
|
|
|
|
# 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:
|
2023-06-08 11:08:14 +08:00
|
|
|
version: 2
|
|
|
|
ethernets:
|
|
|
|
eth0:
|
|
|
|
dhcp4: false
|
2023-06-08 11:46:18 +08:00
|
|
|
addresses: [IPv4/ipPrefix]
|
2023-06-08 19:06:39 +08:00
|
|
|
routes:
|
|
|
|
- to: default
|
|
|
|
via: GATE
|
2023-06-08 11:08:14 +08:00
|
|
|
nameservers:
|
|
|
|
addresses: [ipDNS1, ipDNS2]
|
2023-06-08 04:50:33 +08:00
|
|
|
|
|
|
|
# later commands
|
|
|
|
runcmd:
|
|
|
|
- sed -ri 's/^#?Port.*/Port sshPORT/g' /etc/ssh/sshd_config
|
|
|
|
- sed -ri 's/^#?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
|
|
|
- sed -ri 's/^#?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
|
|
|
- update-rc.d ssh enable
|
|
|
|
- /etc/init.d/ssh restart
|
2023-06-14 03:26:49 +08:00
|
|
|
- timedatectl set-timezone TimeZone
|
2023-06-08 04:50:33 +08:00
|
|
|
- apt update
|
2023-06-08 15:45:07 +08:00
|
|
|
- apt install curl dnsutils efibootmgr fail2ban figlet file lrzsz jq lsof lsb-release net-tools python3 subnetcalc telnet traceroute unzip vim wget xz-utils -y
|
2023-06-08 04:50:33 +08:00
|
|
|
- rm -rf /etc/cloud/cloud.cfg.d/99-fake_cloud.cfg
|
2023-06-08 17:21:10 +08:00
|
|
|
- mv /etc/netplan/50-cloud-init.yaml /etc/netplan/20-netcfg.yaml
|
|
|
|
- netplan apply
|
2023-06-08 19:54:13 +08:00
|
|
|
- touch /etc/cloud/cloud-init.disabled
|
2023-06-08 04:50:33 +08:00
|
|
|
|
|
|
|
# configure cloud-init for NoCloud
|
|
|
|
datasource_list: [ NoCloud, None ]
|