1.\" $OpenBSD: autoinstall.8,v 1.14 2015/05/05 07:20:42 jmc Exp $ 2.\" 3.\" Copyright (c) 2013 Robert Peichaer <rpe@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: May 5 2015 $ 18.Dt AUTOINSTALL 8 19.Os 20.Sh NAME 21.Nm autoinstall 22.Nd unattended OpenBSD installation and upgrade 23.Sh DESCRIPTION 24.Nm 25allows unattended installation or upgrade of 26.Ox 27by automatically responding to installer questions with 28answers from a response file. 29.Nm 30uses DHCP to discover the location of the response 31file and HTTP to fetch the file. 32If that fails, the installer asks for the location which can either be 33a URL or a local path. 34.Pp 35To start unattended installation or upgrade choose '(A)utoinstall' at the 36install prompt. 37If there is only one network interface, the installer fetches the response 38file via that interface. 39If there is more than one network interface, a selection is presented 40and the installer fetches the response file via the selected interface. 41.Pp 42If the machine is netbooted, the 43.Nm 44feature is invoked if the user does not intervene within 45a short time. 46It behaves as if the user selected '(A)utoinstall', but 47always fetches the response file via the netboot interface. 48.Pp 49If either 50.Pa /auto_install.conf 51or 52.Pa /auto_upgrade.conf 53is found during boot, 54.Nm 55behaves as if the machine is netbooted, but uses the local response file. 56In case both files exist, 57.Pa /auto_install.conf 58takes precedence. 59.Pp 60.Nm 61uses HTTP to fetch one of the files 62.Pa install.conf 63or 64.Ar MAC_address Ns - Ns Pa install.conf 65for install answers, or one of 66.Pa upgrade.conf 67or 68.Ar MAC_address Ns - Ns Pa upgrade.conf 69for upgrade answers. 70The URL used to fetch the file is constructed from information provided in 71the 72.Xr dhcpd.conf 5 73statements 74.Ic next-server 75and 76.Ic filename . 77If 78.Ar filename 79is 80.Cm auto_install , 81then the URLs tried are, in order: 82.Sm off 83.Bd -unfilled -offset indent 84.No http:// Ar next-server No / Ar MAC_address No -install.conf 85.No http:// Ar next-server No /install.conf 86.Ed 87.Sm on 88.Pp 89where 90.Ar MAC_address 91is a string of six hex octets separated by colons 92representing the MAC 93address of the interface being used to fetch the files. 94.Pp 95If 96.Ar filename 97is 98.Cm auto_upgrade , 99the URLs tried are, in order: 100.Sm off 101.Bd -unfilled -offset indent 102.No http:// Ar next-server No / Ar MAC_address No -upgrade.conf 103.No http:// Ar next-server No /upgrade.conf 104.Ed 105.Sm on 106.Pp 107On architectures where the 108.Ic filename 109statement is used to provide the name of the file to netboot 110it is necessary to create symbolic links called 111.Pa auto_install 112and 113.Pa auto_upgrade 114that point to the expected boot program 115and to change the value of the 116.Ic filename 117statement in the 118.Xr dhcpd.conf 5 119file to be 120.Cm auto_install 121or 122.Cm auto_upgrade . 123.Pp 124Note that in these cases, the HTTP server and TFTP server must 125be on the same machine. 126.Pp 127The response file is a line-oriented ASCII text file. 128The format of each line is: 129.Pp 130.D1 Ar question No = Ar answer 131.Pp 132.Ar question 133is an installer question (not including the question mark) or a non-ambiguous 134part of it, consisting of whitespace separated words. 135.Ar answer 136is the answer to the question. 137Passwords may be in plaintext, encrypted with 138.Xr encrypt 1 , 139or set to 140.Ql ************* 141(13 '*'s) to disable password logins, only permitting alternative access methods 142(for example, 143.Xr ssh 1 144keys). 145.Pp 146If 147.Nm 148does not find an answer in the response file, the default answer as 149provided by the installer is used. 150.Pp 151The response file may contain answers to the following questions, which are 152only available during unattended installation to provide additional installer 153features: 154.Bl -tag -width Ds 155.It Public ssh key for root account = Ar ssh key 156.Ar ssh key 157is stored in 158.Pa /root/.ssh/authorized_keys . 159.It Public ssh key for user puffy = Ar ssh key 160.Ar ssh key 161is stored in 162.Pa ~puffy/.ssh/authorized_keys . 163.It URL to autopartitioning template for disklabel = Ar url 164A template file for 165.Xr disklabel 8 166autopartitioning is fetched from 167.Ar url 168allowing a custom partition layout for the root disk. 169.El 170.Sh FILES 171.Bl -tag -width "/etc/dhcpd.confXXX" -compact 172.It Pa /etc/dhcpd.conf 173.Xr dhcpd 8 174configuration file 175.It Pa install.conf 176response file for unattended installation 177.It Pa upgrade.conf 178response file for unattended upgrade 179.El 180.Sh EXAMPLES 181A typical 182.Pa install.conf 183file will look something like this: 184.Bd -literal -offset indent 185System hostname = server1 186Password for root = $2a$14$Z4xRMg8vDpgYH...GVot3ySoj8yby 187Change the default console to com0 = yes 188Which speed should com0 use = 19200 189Setup a user = puffy 190Password for user = ************* 191Public ssh key for user = ssh-ed25519 AAAAC3NzaC1...g3Aqre puffy@ai 192What timezone are you in = Europe/Stockholm 193Location of sets = http 194HTTP Server = ftp.eu.openbsd.org 195.Ed 196.Pp 197The same file could be used for upgrades by creating a symbolic link called 198.Pa upgrade.conf 199that points to 200.Pa install.conf . 201The upgrade process will only use the answers it needs. 202.Pp 203And an example 204.Xr dhcpd.conf 5 205.Ic host 206declaration: 207.Bd -literal -offset indent 208host foo { 209 hardware ethernet 00:50:60:49:8b:84; 210 fixed-address 192.168.2.180; 211 filename "auto_install"; 212 option host-name "foo"; 213} 214.Ed 215.Sh SEE ALSO 216.Xr dhcpd.conf 5 , 217.Xr diskless 8 218.Sh HISTORY 219The 220.Nm 221feature first appeared in 222.Ox 5.5 . 223.Sh AUTHORS 224.An Robert Peichaer Aq Mt rpe@openbsd.org 225