(defun authorized-keys (user)
(sprintf "/home/%s/.ssh/authorized_keys" user))
(defun add-jjl ()
(let ((me "jjl")
(my-ak (authorized-keys me)))
(local-user-exists me "wheel")
(file-exists-with-entire-contents
my-ak "0644" me me
"hardware keys"
ssh-authorized-keys-contents)))
(defun doas-for-wheel ()
(package-installed "doas")
(file-exists-with-entire-contents
"/usr/local/etc/doas.conf" "0644" "root" "wheel"
"permit nopass :wheel"
"permit nopass :wheel"))
(defun FreeBSD-boot-fibs (n)
(let ((directive (sprintf "net.fibs=%d" n)))
(file-exists-with-entire-contents
"/boot/loader.conf.d/fibs.conf" "0644" "root" "wheel"
directive directive)))
(defun FreeBSD-boot-load-modules (purpose-identifier module-names)
(let* ((loads (mapcar
(lambda (na) (sprintf "%s_load=\"YES\"" na))
module-names))
(file-contents (string-join "\n" loads)))
(file-exists-with-entire-contents
(sprintf "/boot/loader.conf.d/%s.conf" purpose-identifier)
"0644" "root" "wheel"
(sprintf "load modules: %s" (string-join " " module-names))
file-contents)))
(defun FreeBSD-devfs-firewall-jail-rules ()
(file-exists-with-entire-contents
"/etc/devfs.rules" "0600" "root" "wheel"
"devfs ruleset with bpf, pf, login"
"\
[devfsrules_firewall_jail_vnet=10]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path bpf* unhide
add path pf unhide
"))