![]() |
|
Guides All Guides and HOWTO's. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
The other older 2014 approach is the shell script and Makefile from Creating 'install.conf' for OpenBSD automatic installations
Because I did not have to time to update that script for VPS testing, I wrote a Makefile that concatenates or glues together an install.conf from separate file blocks or components. These blocks can have comment lines and empty lines to enhance readability. For a 'lean and mean' install.conf the Makefile just strips these lines. An example of the quite readable network configuration block: Code:
cat 10-network.resp # network response file # system hostname selects sitexx-$(hostname -s).tgz ! System hostname = df-us # --- Network interface configuration #Which network interface do you wish to configure = bge0 #IPv4 address for bge0 = autoconf #IPv6 address for bge0 = none #Which network interface do you wish to configure = done Which network interface do you wish to configure = vio0 IPv4 address for vio0 = autoconf IPv6 address for vio0 = none Which network interface do you wish to configure = done Start sshd(8) by default = yes # ----------------------------------------- Code:
System hostname = df-us Which network interface do you wish to configure = vio0 IPv4 address for vio0 = autoconf IPv6 address for vio0 = none Which network interface do you wish to configure = done Start sshd(8) by default = yes Code:
-rw-r--r-- 1 j65 j65 572 Jul 19 02:05 10-network.resp -rw-r--r-- 1 j65 j65 512 Jul 19 02:01 20-user-tz.resp -rw-r--r-- 1 j65 j65 279 Jul 19 00:18 40-disk.resp -rw-r--r-- 1 j65 j65 450 Jul 19 00:21 50-sets.resp Code:
CONF = install.conf [snip] BLOCKS += 10-network.resp BLOCKS += 20-user-tz.resp BLOCKS += 40-disk.resp BLOCKS += 50-sets.resp Code:
${CONF}.raw: ${BLOCKS} cat ${.ALLSRC} > ${.TARGET} Updating or modifying the first block with a dangerous command (imagine what if I used only a single '>') Code:
$ echo '# end of file' >>10-network.resp $ ls -lTt 10-network.resp install.conf.raw -rw-r--r-- 1 j65 j65 586 Jul 19 02:51:07 2022 10-network.resp -rw-r--r-- 1 j65 j65 1813 Jul 19 02:13:40 2022 install.conf.raw Code:
$ make install.conf.raw cat 10-network.resp 20-user-tz.resp 40-disk.resp 50-sets.resp > install.conf.raw $ make install.conf.raw `install.conf.raw' is up to date. ls -lTt *resp *raw -rw-r--r-- 1 j65 j65 1827 Jul 19 02:54:49 2022 install.conf.raw -rw-r--r-- 1 j65 j65 586 Jul 19 02:51:07 2022 10-network.resp -rw-r--r-- 1 j65 j65 512 Jul 19 02:01:18 2022 20-user-tz.resp -rw-r--r-- 1 j65 j65 450 Jul 19 00:21:13 2022 50-sets.resp -rw-r--r-- 1 j65 j65 279 Jul 19 00:18:56 2022 40-disk.resp The first and main target 'install.conf' depends on 'install.conf.raw' Code:
${CONF}: ${CONF}.raw @# remove blank lines and #comment lines /usr/bin/sed -E -e '/^[:blank:]*$$/d' -e '/^#.*$$/d' ${.TARG @# note that in the shell a single '$' (end-of-line) works : @# make(1) strips one, so it needs to be doubled !! Code:
$ make /usr/bin/sed -E -e '/^[:blank:]*$/d' -e '/^#.*$/d' install.conf.raw >install.conf $ make `install.conf' is up to date. $ make ls ls -lTt total 56 -rw-r--r-- 1 j65 j65 1043 Jul 19 03:06:53 2022 install.conf -rw-r--r-- 1 j65 j65 1827 Jul 19 02:54:49 2022 install.conf.raw -rw-r--r-- 1 j65 j65 586 Jul 19 02:51:07 2022 10-network.resp -rw-r--r-- 1 j65 j65 512 Jul 19 02:01:18 2022 20-user-tz.resp -rw-r--r-- 1 j65 j65 450 Jul 19 00:21:13 2022 50-sets.resp -rw-r--r-- 1 j65 j65 279 Jul 19 00:18:56 2022 40-disk.resp
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 19th July 2022 at 02:19 AM. |
|
|||
![]()
The Makefile
Code:
# --- Makefile to generate an 'install.conf' for autoinstall(8) # Copyright (c) 2022 j65nko daemonforums.org # ISC license (See https://cvsweb.openbsd.org/src/share/misc/license.template?rev=HEAD ) # --- ignore built-in rules .MAKEFLAGS = -r CONF = install.conf # For readability blocks can have comment lines and empty lines # These will be stripped from the final 'install.conf' BLOCKS += 10-network.resp BLOCKS += 20-user-tz.resp BLOCKS += 40-disk.resp BLOCKS += 50-sets.resp # Main target strips the comment and empty lines from the 'raw' file ${CONF}: ${CONF}.raw @# remove blank lines and #comment lines /usr/bin/sed -E -e '/^[:blank:]*$$/d' -e '/^#.*$$/d' ${.TARGET}.raw >${.TARGET} @# note that in the shell a single '$' (end-of-line) works : '/^[:blank:]*$/d' @# make(1) strips one, so it needs to be doubled !! # Concatenate all raw blocks to one single file ${CONF}.raw: ${BLOCKS} cat ${.ALLSRC} > ${.TARGET} # Utilities ls: ls -lTt show: ls -lT ${CONF} cat -n ${CONF} showraw: ls -lT ${CONF}.raw cat -n ${CONF}.raw clean: rm -f ${CONF} ${CONF}.raw .PHONY : show clean
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]()
The Makefile and response file in a single compressed tarball for downloading.
Create a directory e.g. AUTO-install, copy the tarball and extract Code:
$ mkdir AUTO-install $ cd AUTO-install $ cp ~/Downloads/MakeInstallconf.tgz . # check the tarball contents $ tar tvzf MakeInstallconf.tgz -rw-r--r-- 1 adriaan adriaan 586 Jul 19 02:51 10-network.resp -rw-r--r-- 1 adriaan adriaan 512 Jul 19 02:01 20-user-tz.resp -rw-r--r-- 1 adriaan adriaan 279 Jul 19 04:10 40-disk.resp -rw-r--r-- 1 adriaan adriaan 447 Jul 19 04:12 50-sets.resp -rw-r--r-- 1 adriaan adriaan 1121 Jul 19 03:46 Makefile -rw-r--r-- 1 adriaan adriaan 1040 Jul 19 04:12 install.conf -rw-r--r-- 1 adriaan adriaan 1824 Jul 19 04:12 install.conf.raw # extract $ tar xvzf MakeInstallconf.tgz 10-network.resp 20-user-tz.resp 40-disk.resp 50-sets.resp Makefile install.conf install.conf.raw
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 19th July 2022 at 02:44 AM. |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating 'install.conf' for OpenBSD automatic installations | J65nko | Guides | 4 | 19th July 2022 02:52 AM |
Most efficient approach to build new via openchrome video driver | shep | NetBSD General | 12 | 16th November 2021 02:08 PM |
Creating QR codes in OpenBSD | victorvas | Guides | 3 | 31st May 2019 06:01 AM |
Creating scenario with OpenBSD, network | benky | OpenBSD Security | 10 | 12th February 2015 09:35 PM |
OpenBSD autoinstall | J65nko | OpenBSD Installation and Upgrading | 4 | 12th December 2014 01:15 AM |