gce.conf revision 277263
1#!/bin/sh 2# 3# $FreeBSD: projects/release-vmimage/release/tools/gce.conf 277263 2015-01-16 19:27:19Z gjb $ 4# 5 6# Set to a list of packages to install. 7export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs google-cloud-sdk google-daemon panicmail sudo firstboot-growfs google-startup-scripts" 8 9# Set to a list of third-party software to enable in rc.conf(5). 10export VM_RC_LIST="google_accounts_manager ntpd" 11 12vm_extra_install_base() { 13 echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf 14 echo 'nameserver 169.254.169.254' >> ${DESTDIR}/etc/resolv.conf 15 echo 'nameserver 8.8.8.8' >> ${DESTDIR}/etc/resolv.conf 16} 17 18vm_extra_pre_umount() { 19 cat << EOF >> ${DESTDIR}/etc/rc.conf 20console="comconsole" 21dumpdev="AUTO" 22ifconfig_vtnet0="SYNCDHCP mtu 1460" 23ntpd_sync_on_start="YES" 24ntpd_enable="YES" 25sshd_enable="YES" 26google_accounts_manager_enable="YES" 27#disabled until I can figure out why the reboot for updates is hanging 28#firstboot_freebsd_update_enable="YES" 29#firstboot_pkgs_enable="YES" 30# need to fill in something here 31#firstboot_pkgs_list="" 32panicmail_autosubmit="YES" 33firstboot_growfs_enable="YES" 34google_startup_enable="YES" 35EOF 36 37 cat << EOF >> ${DESTDIR}/boot/loader.conf 38autoboot_delay="-1" 39beastie_disable="YES" 40loader_logo="none" 41hw.memtest.tests="0" 42console="comconsole" 43hw.vtnet.mq_disable=1 44kern.timecounter.hardware=ACPI-safe 45aesni_load="YES" 46nvme_load="YES" 47EOF 48 49 echo '169.254.169.254 metadata.google.internal metadata' > \ 50 ${DESTDIR}/etc/hosts 51 52 # overwrite ntp.conf 53 cat << EOF > ${DESTDIR}/etc/ntp.conf 54server metadata.google.internal iburst 55 56restrict default kod nomodify notrap nopeer noquery 57restrict -6 default kod nomodify notrap nopeer noquery 58 59restrict 127.0.0.1 60restrict -6 ::1 61restrict 127.127.1.0 62EOF 63 64 cat << EOF >> ${DESTDIR}/etc/syslog.conf 65*.err;kern.warning;auth.notice;mail.crit /dev/console 66EOF 67 68 cat << EOF >> ${DESTDIR}/etc/ssh/sshd_config 69ChallengeResponseAuthentication no 70X11Forwarding no 71AcceptEnv LANG 72Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc 73AllowAgentForwarding no 74ClientAliveInterval 420 75EOF 76 77 cat << EOF >> ${DESTDIR}/etc/crontab 780 3 * * * root /usr/sbin/freebsd-update cron 79EOF 80 81 cat << EOF >> ${DESTDIR}/etc/sysctl.conf 82net.inet.icmp.drop_redirect=1 83net.inet.ip.redirect=0 84net.inet.tcp.blackhole=2 85net.inet.udp.blackhole=1 86kern.ipc.somaxconn=1024 87debug.trace_on_panic=1 88debug.debugger_on_panic=0 89EOF 90 91 sed -E -i '' 's/^([^#].*[[:space:]])on/\1off/' ${DESTDIR}/etc/ttys 92 93 touch ${DESTDIR}/firstboot 94 95 return 0 96} 97