comparison sbin/fjail @ 219:39b736a91d0d

Begin a "configure" command for jails
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 29 Aug 2022 09:40:01 +0200
parents ee9b32ab0e9a
children 9addf133d208
comparison
equal deleted inserted replaced
218:e370985c08ad 219:39b736a91d0d
61 Adjust some Unix privileges to mounted jail datasets 61 Adjust some Unix privileges to mounted jail datasets
62 62
63 populate MOUNTPOINT BASETXZ 63 populate MOUNTPOINT BASETXZ
64 64
65 Populate the jail directory in MOUNTPOINT with the base system in BASETXZ 65 Populate the jail directory in MOUNTPOINT with the base system in BASETXZ
66
67 configure MOUNPOINT
68
69 Configure some basic parts of the system at MOUNTPOINT:
70 disable root password, syslog and other basic configuration settings
66 71
67 copy [OPTIONS] SOURCE-DATASET DEST-DATASET 72 copy [OPTIONS] SOURCE-DATASET DEST-DATASET
68 73
69 Copy a tree of ZFS datasets with "zfs send -R" and "zfs receive". 74 Copy a tree of ZFS datasets with "zfs send -R" and "zfs receive".
70 Note that the destination dataset must not exist already. 75 Note that the destination dataset must not exist already.
317 find "${_mp}/boot" -type f -delete 322 find "${_mp}/boot" -type f -delete
318 } 323 }
319 324
320 325
321 # 326 #
327 # "configure" -- configure the mountpoint
328 #
329 # command_configure mountpoint
330 #
331 command_configure() {
332 # mountpoint
333 local _mp
334
335 _mp="$1"
336
337 if [ -z "${_mp}" ]; then
338 echo "ERROR: no mountpoint given" >&2
339 return 2
340 fi
341 if [ ! -d "${_mp}" ]; then
342 echo "ERROR: mountpoint \`${_mp}' does not exist" >&2
343 return 1
344 fi
345
346 # Deactive the by default empty root password
347 pw -R "${_mp}" usermod -w no -n root
348
349 sysrc -R "${_mp}" sendmail_enable=NONE
350 sysrc -R "${_mp}" clear_tmp_enable=YES
351 sysrc -R "${_mp}" clear_tmp_X=NO
352 sysrc -R "${_mp}" syslogd_flags=-ss
353 sysrc -R "${_mp}" bsdstats_enable=NO # no automatic BSD stats when booting
354
355 # Timezone to CET
356 ln -s ../usr/share/zoneinfo/Europe/Berlin "${_mp}/etc/localtime"
357 }
358
359
360 #
322 # "copy" -- ZFS copy of datasets 361 # "copy" -- ZFS copy of datasets
323 # 362 #
324 # command_copy source-dataset destination-dataset 363 # command_copy source-dataset destination-dataset
325 # 364 #
326 command_copy() { 365 command_copy() {
619 command_privs "$@" 658 command_privs "$@"
620 ;; 659 ;;
621 populate) 660 populate)
622 command_populate "$@" 661 command_populate "$@"
623 ;; 662 ;;
663 configure)
664 comment_configure "$@"
665 ;;
624 copy) 666 copy)
625 command_copy "$@" 667 command_copy "$@"
626 ;; 668 ;;
627 *) 669 *)
628 echo "ERROR: unknown command \`${command}'" >&2 670 echo "ERROR: unknown command \`${command}'" >&2