Add userconf-getent.sh to Makefile
Fix syntax error
Split getent and sshkey
These scripts can be used to set up a FreeBSD host from an OpenNebula context, and does not need any port or package to be installed in order to work. Only a subset of OpenNebula context is supported; this script is written to work with ungleich's setup, and has not been tested in other environments.
The original OpenNebula contextualization script also supports FreeBSD, but it has a lot of dependency requirements, hence this project. If you need some feature from OpenNebula that is not supported here, it might be better to use their script instead.
These scripts support network configuration and setting an SSH public key in authorized_keys.
The scripts will only write data when invoked with the --install
argument.
Otherwise, if the scripts are called without arguments, they print the changes that would have been made.
A --prefix DIR
argument can be provided to prepend the given DIR
to all paths being written to,
which can be useful for testing or writing to another installation.
There is also a firstboot rc script, that can be triggered manually by running service firstboot_clsetup start
.
However, it requires that both /etc/rc.conf.d/netif
and /etc/rc.conf.d/routing
do not exist yet.
At first boot, you should run cloudsetup-network --install
; at subsequent boots,
if desired, you could run cloudsetup-network --install --force
.
This will write /etc/rc.conf.d/netif
, /etc/rc.conf.d/routing
and /etc/resolv.conf
,
but will not call service netif restart
.
Usage: cloudsetup-network [--help] [--install [--force]] [--prefix prefix]
This program will write /etc/rc.conf.d/netif, /etc/rc.conf.d/routing and /etc/resolv.conf,
using the settings from the OpenNebula context disk image.
--help Show this help text.
--install Write files for first boot.
--force Overwrite files if already exist.
(NOTE: resolv.conf will always be overwritten if network is written)
--prefix DIR Write to directory specified in DIR.
At first boot, you should run cloudsetup-user --install
.
This will ensure that the SSH key is listed in the users' .ssh/authorized_keys
file.
It will not override this file, so other keys will not be touched.
It is not recommended to run this on subsequent boots, in order to allow the user to revoke their key by removing it from this file, and replacing it with a different one.
Usage: cloudsetup-user [--help] [--install [--prefix prefix]
This program will append the SSH key from the OpenNebula context disk image to authorized_keys.
--help Show this help text.
--install Write files for first boot.
--prefix DIR Write to directory specified in DIR.
Simply run make install
.
Note that, in order for this to run at first boot,
it is also necessary to add firstboot_clsetup_enable=YES
in /etc/rc.conf.
The script is marked with keyword firstboot
so it will only run on the first boot.
The inverse also works; make uninstall
removes the scripts again.
OpenNebula's configuration format has some similarities to cloud-init's "no-cloud" configuration, which also consists of a CD image, but instead of a shell script with environment variables, it contains a few YAML files. This system is used by Proxmox, among others, so it would be very useful to support this.