6 # Set to a list of packages to install.
7 export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs \
8 google-cloud-sdk panicmail sudo firstboot-growfs \
9 sysutils/py-google-compute-engine"
11 # Set to a list of third-party software to enable in rc.conf(5).
12 export VM_RC_LIST="ntpd sshd firstboot_growfs \
13 firstboot_pkgs firstboot_freebsd_update google_startup \
14 google_accounts_daemon google_clock_skew_daemon \
15 google_instance_setup google_ip_forwarding_daemon \
18 vm_extra_install_base() {
19 echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf
20 echo 'nameserver 169.254.169.254' >> ${DESTDIR}/etc/resolv.conf
21 echo 'nameserver 8.8.8.8' >> ${DESTDIR}/etc/resolv.conf
24 vm_extra_pre_umount() {
25 cat << EOF >> ${DESTDIR}/etc/rc.conf
27 ifconfig_DEFAULT="SYNCDHCP mtu 1460"
28 ntpd_sync_on_start="YES"
29 # need to fill in something here
30 #firstboot_pkgs_list=""
31 panicmail_autosubmit="YES"
34 cat << EOF >> ${DESTDIR}/boot/loader.conf
39 console="comconsole,vidconsole"
41 kern.timecounter.hardware=ACPI-safe
46 echo '169.254.169.254 metadata.google.internal metadata' > \
50 cat << EOF > ${DESTDIR}/etc/ntp.conf
51 server metadata.google.internal iburst
53 restrict default kod nomodify notrap nopeer noquery
54 restrict -6 default kod nomodify notrap nopeer noquery
61 cat << EOF >> ${DESTDIR}/etc/syslog.conf
62 *.err;kern.warning;auth.notice;mail.crit /dev/console
65 cat << EOF >> ${DESTDIR}/etc/ssh/sshd_config
66 ChallengeResponseAuthentication no
69 Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
70 AllowAgentForwarding no
71 ClientAliveInterval 420
74 cat << EOF >> ${DESTDIR}/etc/crontab
75 0 3 * * * root /usr/sbin/freebsd-update cron
78 cat << EOF >> ${DESTDIR}/etc/sysctl.conf
79 net.inet.icmp.drop_redirect=1
80 net.inet.ip.redirect=0
81 net.inet.tcp.blackhole=2
82 net.inet.udp.blackhole=1
83 kern.ipc.somaxconn=1024
84 debug.trace_on_panic=1
85 debug.debugger_on_panic=0
88 # To meet GCE marketplace requirements, extract the src.txz and
89 # ports.txz distributions to the target virtual machine disk image
90 # and fetch the sources for the third-party software installed on
92 if [ ! -c "${DESTDIR}/dev/null" ]; then
93 mkdir -p ${DESTDIR}/dev
94 mount -t devfs devfs ${DESTDIR}/dev
96 if [ -e "${DESTDIR}/../ftp/src.txz" ]; then
97 tar fxJ ${DESTDIR}/../ftp/src.txz -C ${DESTDIR}
99 if [ -e "${DESTDIR}/../ftp/ports.txz" ]; then
100 tar fxJ ${DESTDIR}/../ftp/ports.txz -C ${DESTDIR}
101 _INSTALLED_PACKAGES=$(chroot ${DESTDIR} pkg info -o -q -a)
102 for PACKAGE in ${_INSTALLED_PACKAGES}; do
104 make -C /usr/ports/${PACKAGE} fetch
107 if [ -c "${DESTDIR}/dev/null" ]; then
108 umount_loop ${DESTDIR}/dev
111 ## XXX: Verify this is needed. I do not see this requirement
112 ## in the docs, and it impairs the ability to boot-test a copy
113 ## of the image prior to packaging for upload to GCE.
114 #sed -E -i '' 's/^([^#].*[[:space:]])on/\1off/' ${DESTDIR}/etc/ttys
116 touch ${DESTDIR}/firstboot
118 rm -f ${DESTDIR}/etc/resolv.conf