From d8ee537f1528dfe3e37ad1afe2b9dd3dab81cbd0 Mon Sep 17 00:00:00 2001 From: UnicronNL Date: Tue, 21 May 2019 22:15:55 +0200 Subject: update cloud builds --- Makefile | 48 ++++++++++++++++++++++- scripts/build-oracle-image | 2 +- scripts/template.ovf | 28 +++++++------ tools/cloud-init/99-debug-user.chroot | 17 ++++++++ tools/cloud-init/99-disable-networking.chroot | 3 ++ tools/cloud-init/GCE/99-debug-user.chroot | 17 -------- tools/cloud-init/OCI/config.boot.default | 12 +++++- tools/cloud-init/PACKET/90_dpkg.cfg | 8 ++++ tools/cloud-init/PACKET/config.boot.default | 39 ++++++++++++++++++ tools/cloud-init/PACKET/config.boot.default-debug | 41 +++++++++++++++++++ tools/cloud-init/openstack/90_dpkg.cfg | 8 ++++ tools/cloud-init/openstack/config.boot.default | 40 +++++++++++++++++++ 12 files changed, 230 insertions(+), 33 deletions(-) create mode 100755 tools/cloud-init/99-debug-user.chroot create mode 100755 tools/cloud-init/99-disable-networking.chroot delete mode 100755 tools/cloud-init/GCE/99-debug-user.chroot create mode 100644 tools/cloud-init/PACKET/90_dpkg.cfg create mode 100644 tools/cloud-init/PACKET/config.boot.default create mode 100644 tools/cloud-init/PACKET/config.boot.default-debug create mode 100644 tools/cloud-init/openstack/90_dpkg.cfg create mode 100644 tools/cloud-init/openstack/config.boot.default diff --git a/Makefile b/Makefile index 3bfa9597..c42766a4 100644 --- a/Makefile +++ b/Makefile @@ -112,7 +112,7 @@ GCE-debug: clean prepare @set -e @echo "It's not like I'm building this specially for you or anything!" mkdir -p build/config/includes.chroot/etc/cloud/cloud.cfg.d - cp tools/cloud-init/GCE/99-debug-user.chroot build/config/hooks/live/ + cp tools/cloud-init/99-debug-user.chroot build/config/hooks/live/ cp tools/cloud-init/GCE/90_dpkg.cfg build/config/includes.chroot/etc/cloud/cloud.cfg.d/ cp tools/cloud-init/cloud-init.list.chroot build/config/package-lists/ cp -f tools/cloud-init/GCE/config.boot.default-debug build/config/includes.chroot/opt/vyatta/etc/config.boot.default @@ -133,6 +133,20 @@ AWS: clean prepare cd .. @scripts/copy-image +.PHONY: openstack +.ONESHELL: +openstack: clean prepare + @set -e + @echo "It's not like I'm building this specially for you or anything!" + mkdir -p build/config/includes.chroot/etc/cloud/cloud.cfg.d + cp tools/cloud-init/openstack/90_dpkg.cfg build/config/includes.chroot/etc/cloud/cloud.cfg.d/ + cp tools/cloud-init/cloud-init.list.chroot build/config/package-lists/ + cp -f tools/cloud-init/openstack/config.boot.default build/config/includes.chroot/opt/vyatta/etc/ + cd $(build_dir) + lb build 2>&1 | tee build.log + cd .. + @scripts/copy-image + .PHONY: oracle .ONESHELL: oracle: clean prepare @@ -141,9 +155,41 @@ oracle: clean prepare mkdir -p build/config/includes.chroot/etc/cloud/cloud.cfg.d cp tools/cloud-init/OCI/90_dpkg.cfg build/config/includes.chroot/etc/cloud/cloud.cfg.d/ cp tools/cloud-init/cloud-init.list.chroot build/config/package-lists/ + cp -f tools/cloud-init/OCI/config.boot.default build/config/includes.chroot/opt/vyatta/etc/ cd $(build_dir) @../scripts/build-oracle-image +.PHONY: PACKET +.ONESHELL: +PACKET: clean prepare + @set -e + @echo "It's not like I'm building this specially for you or anything!" + mkdir -p build/config/includes.chroot/etc/cloud/cloud.cfg.d + cp tools/cloud-init/99-disable-networking.chroot build/config/hooks/live/ + cp tools/cloud-init/PACKET/90_dpkg.cfg build/config/includes.chroot/etc/cloud/cloud.cfg.d/ + cp tools/cloud-init/cloud-init.list.chroot build/config/package-lists/ + cp -f tools/cloud-init/PACKET/config.boot.default build/config/includes.chroot/opt/vyatta/etc/ + cd $(build_dir) + lb build 2>&1 | tee build.log + cd .. + @scripts/copy-image + +.PHONY: PACKET-debug +.ONESHELL: +PACKET-debug: clean prepare + @set -e + @echo "It's not like I'm building this specially for you or anything!" + mkdir -p build/config/includes.chroot/etc/cloud/cloud.cfg.d + cp tools/cloud-init/99-debug-user.chroot build/config/hooks/live/ + cp tools/cloud-init/99-disable-networking.chroot build/config/hooks/live/ + cp tools/cloud-init/PACKET/90_dpkg.cfg build/config/includes.chroot/etc/cloud/cloud.cfg.d/ + cp tools/cloud-init/cloud-init.list.chroot build/config/package-lists/ + cp -f tools/cloud-init/PACKET/config.boot.default-debug build/config/includes.chroot/opt/vyatta/etc/config.boot.default + cd $(build_dir) + lb build 2>&1 | tee build.log + cd .. + @scripts/copy-image + .PHONY: clean .ONESHELL: clean: diff --git a/scripts/build-oracle-image b/scripts/build-oracle-image index 61f8ddee..e2066fc7 100755 --- a/scripts/build-oracle-image +++ b/scripts/build-oracle-image @@ -57,7 +57,7 @@ dateymd=$(date +%Y%m%d) PARTED=/sbin/parted OUTPUT=disk.raw OUTPUTQCOW2=VyOS-"$dateymd".qcow2 -IMAGE_SIZE=2 +IMAGE_SIZE=10 qemu-img create -f raw ${OUTPUT} ${IMAGE_SIZE}G ${PARTED} -s ${OUTPUT} mktable msdos diff --git a/scripts/template.ovf b/scripts/template.ovf index 87237bf7..88ea5562 100644 --- a/scripts/template.ovf +++ b/scripts/template.ovf @@ -1,5 +1,5 @@ - - + + @@ -39,22 +39,22 @@ VyOS is a Linux-based network operating system that provides software-based network routing, firewall, and VPN functionality. VyOS - VyOS maintainers and contributors + Sentrium S.L. {{version}} https://www.vyos.io https://sentrium.io/ Appliance user Settings - + - The password for the appliance 'vyos' account. Passwords must be at least 8 characters in length. + The password for the appliance 'vyos' account. Passwords must be at least 8 characters in length. - + - The public ssh key for the appliance 'vyos' account. + The public ssh key for the appliance 'vyos' account. Appliance IPv4 Network Settings - + The host name for this virtual machine. @@ -87,11 +87,11 @@ VyOS - - Guest Operating System - VyOS + + The operating system installed + Debian GNU/Linux 8 (64-bit) - + Virtual Hardware Requirements Virtual Hardware Family @@ -148,7 +148,7 @@ 0 - SCSI Controller 0 + SCSI Controller 0 - VMware Paravirtual SCSI 3 VirtualSCSI 6 @@ -195,6 +195,8 @@ vmxnet3 10 + + diff --git a/tools/cloud-init/99-debug-user.chroot b/tools/cloud-init/99-debug-user.chroot new file mode 100755 index 00000000..7b72f898 --- /dev/null +++ b/tools/cloud-init/99-debug-user.chroot @@ -0,0 +1,17 @@ +#!/bin/bash +# Script to add a user to Linux system +if [ $(id -u) -eq 0 ]; then + egrep "^debuguser" /etc/passwd >/dev/null + if [ $? -eq 0 ]; then + echo "$username exists!" + exit 1 + else + pass=$(perl -e 'print crypt($ARGV[0], "password")' dKD3UKamS3MQ) + useradd -m -p $pass debuguser + usermod -aG sudo debuguser + [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!" + fi +else + echo "Only root may add a user to the system" + exit 2 +fi diff --git a/tools/cloud-init/99-disable-networking.chroot b/tools/cloud-init/99-disable-networking.chroot new file mode 100755 index 00000000..e576c8a5 --- /dev/null +++ b/tools/cloud-init/99-disable-networking.chroot @@ -0,0 +1,3 @@ +#!/bin/bash +systemctl disable networking +/usr/sbin/update-rc.d -f networking remove diff --git a/tools/cloud-init/GCE/99-debug-user.chroot b/tools/cloud-init/GCE/99-debug-user.chroot deleted file mode 100755 index 7b72f898..00000000 --- a/tools/cloud-init/GCE/99-debug-user.chroot +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Script to add a user to Linux system -if [ $(id -u) -eq 0 ]; then - egrep "^debuguser" /etc/passwd >/dev/null - if [ $? -eq 0 ]; then - echo "$username exists!" - exit 1 - else - pass=$(perl -e 'print crypt($ARGV[0], "password")' dKD3UKamS3MQ) - useradd -m -p $pass debuguser - usermod -aG sudo debuguser - [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!" - fi -else - echo "Only root may add a user to the system" - exit 2 -fi diff --git a/tools/cloud-init/OCI/config.boot.default b/tools/cloud-init/OCI/config.boot.default index 296c690a..de724f0b 100644 --- a/tools/cloud-init/OCI/config.boot.default +++ b/tools/cloud-init/OCI/config.boot.default @@ -1,4 +1,14 @@ system { + host-name vyos + login { + user vyos { + authentication { + encrypted-password "*" + plaintext-password "" + } + level admin + } + } syslog { global { facility all { @@ -16,7 +26,7 @@ system { } console { device ttyS0 { - speed 115200 + speed 9600 } } config-management { diff --git a/tools/cloud-init/PACKET/90_dpkg.cfg b/tools/cloud-init/PACKET/90_dpkg.cfg new file mode 100644 index 00000000..4f7bbd8c --- /dev/null +++ b/tools/cloud-init/PACKET/90_dpkg.cfg @@ -0,0 +1,8 @@ +# to update this file, run dpkg-reconfigure cloud-init +datasource_list: [ Ec2 ] +datasource: + Ec2: + metadata_urls: ["https://metadata.packet.net"] + max_wait: 120 + timeout: 50 + strict_id: false diff --git a/tools/cloud-init/PACKET/config.boot.default b/tools/cloud-init/PACKET/config.boot.default new file mode 100644 index 00000000..cca5fcbc --- /dev/null +++ b/tools/cloud-init/PACKET/config.boot.default @@ -0,0 +1,39 @@ +system { + host-name vyos + login { + user vyos { + authentication { + plaintext-password "vyos" + } + level admin + } + } + syslog { + global { + facility all { + level info + } + facility protocols { + level debug + } + } + } + ntp { + server "0.pool.ntp.org" + server "1.pool.ntp.org" + server "2.pool.ntp.org" + } + console { + device ttyS1 { + speed 115200 + } + } + config-management { + commit-revisions 100 + } +} + +interfaces { + loopback lo { + } +} diff --git a/tools/cloud-init/PACKET/config.boot.default-debug b/tools/cloud-init/PACKET/config.boot.default-debug new file mode 100644 index 00000000..85e3a890 --- /dev/null +++ b/tools/cloud-init/PACKET/config.boot.default-debug @@ -0,0 +1,41 @@ +interfaces { + ethernet eth0 { + address dhcp + } +} +service { + ssh { + port 8022 + client-keepalive-interval 180 + } +} +system { + syslog { + global { + facility all { + level info + } + facility protocols { + level debug + } + } + } + ntp { + server "0.pool.ntp.org" + server "1.pool.ntp.org" + server "2.pool.ntp.org" + } + console { + device ttyS1 { + speed 115200 + } + } + config-management { + commit-revisions 100 + } +} + +interfaces { + loopback lo { + } +} diff --git a/tools/cloud-init/openstack/90_dpkg.cfg b/tools/cloud-init/openstack/90_dpkg.cfg new file mode 100644 index 00000000..a740b314 --- /dev/null +++ b/tools/cloud-init/openstack/90_dpkg.cfg @@ -0,0 +1,8 @@ +# to update this file, run dpkg-reconfigure cloud-init +datasource_list: [ NoCloud, ConfigDrive, OpenNebula, DigitalOcean, AltCloud, MAAS, OpenStack, CloudSigma, SmartOS, None ] +disable_ec2_metadata: true +datasource: + OpenStack: + max_wait: 6 + timeout: 3 + retries: 2 diff --git a/tools/cloud-init/openstack/config.boot.default b/tools/cloud-init/openstack/config.boot.default new file mode 100644 index 00000000..de724f0b --- /dev/null +++ b/tools/cloud-init/openstack/config.boot.default @@ -0,0 +1,40 @@ +system { + host-name vyos + login { + user vyos { + authentication { + encrypted-password "*" + plaintext-password "" + } + level admin + } + } + syslog { + global { + facility all { + level info + } + facility protocols { + level debug + } + } + } + ntp { + server "0.pool.ntp.org" + server "1.pool.ntp.org" + server "2.pool.ntp.org" + } + console { + device ttyS0 { + speed 9600 + } + } + config-management { + commit-revisions 100 + } +} + +interfaces { + loopback lo { + } +} -- cgit v1.2.3