Page MenuHomeFreeBSD
Paste P561

rc.d/jail patch by antranigv
ActivePublic

Authored by antranigv_freebsd.am on Feb 28 2023, 5:37 PM.
Tags
None
Referenced Files
F57147722: rc.d/jail patch by antranigv
Feb 28 2023, 5:37 PM
Subscribers
None
12a13,60
>
> ## Note from antranigv
> #
> #### Terminology
> # jail.conf means the config format of jail.conf
> # /etc/jail.conf is the file itself
> # /etc/jail.*.conf is any file that matches that pattern
> # /etc/jail.conf.d/*.conf is any file that matches that pattern
> # "something" parameters means a parameters named "something" in jail.conf
> # "something=" is a parameter inside rc.conf
> # I know, I'm mostly repeating myself, but some people are new to this :)
> #
> #### Regarding jail file management ->
> # If you are reading this, then I've sent you this file for testing. Currently,
> # we need to test the following scenarios.
> # 1. a jail exists in /etc/jail.conf
> # 2. #1 + a jail in /etc/jail.anotherjail.conf
> # 3. #2 + a jail in /etc/jail.conf.d/yetanother.conf
> # 4. #3 + a jail at one of the jail.conf locations, that depends on another jail
> # using the "depend" parameter. Read more in jail(8), jail parameters.
> # 5. The above, used with/without "jail_parallel_start=" and/or "jail_reverse_stop="
> #
> # Technically, this rc.d/jail should be able to "merge" global configs from
> # /etc/jail.conf. Meaning, you can have your global vars in /etc/jail.conf and
> # the rest should be in their own files, without any global configs.
> #
> #### Regarding jail_list, "depend" parameter and start order ->
> # Before this patch, only the jails in /etc/jail.conf start
> # automatically if no jail is defined in "jail_list=".
> #
> # With this patch, all jails in /etc/jail.conf, /etc/jail.*.conf and
> # /etc/jail.conf.d/*.conf start automatically.
> #
> # Again, if "jail_list=" is defined, then only those jails would start.
> #
> # That being said, the best practice would be to define global variables in
> # /etc/jail.conf, and have a config file of each jail in
> # /etc/jail.conf.d/somejail.conf; this will give you the ability to do
> # mv /etc/jail.conf.d/somejail.conf /etc/jail.conf.d/somejail.conf.dis
> # which will disable the jail.
> #
> # ==> CAREFUL! always disable/edit the jail when it's NOT running, otherwise your
> # cleanup commands might not work.
> #
> # Thank you for testing, if you have any more feedback, please email me at
> # jailtest@freebsd.am ; suggestions and bug reports are very welcome.
> # -- antranigv
>
458c506
< command_args="-f $jail_conf -c"
---
> command_args='-f - -c'
463c511,513
< if $command $rc_flags $command_args >> $_tmp 2>&1; then
---
> if cat $jail_conf $jail_conf_dir/*.conf \
> /etc/jail.*.conf 2>/dev/null | \
> $command $rc_flags $command_args >> $_tmp 2>&1; then
488c538
< command_args="-i -f $_conf -c $_j"
---
> command_args="-i -f - -c $_j"
491c541,543
< if $command $rc_flags $command_args \
---
> if cat $jail_conf $_conf $jail_conf_dir/*.conf \
> /etc/jail.*.conf 2>/dev/null | \
> $command $rc_flags $command_args \
516c568
< command_args="-i -f $_conf -c $_j"
---
> command_args="-i -f - -c"
518c570,572
< if $command $rc_flags $command_args \
---
> if (cat $_conf $jail_conf $jail_conf_dir/*.conf \
> /etc/jail.*.conf 2>/dev/null | \
> $command $rc_flags $command_args $_j) \
546c600
< command_args="-f $jail_conf -r"
---
> command_args='-f - -r'
553a608,609
> cat $jail_conf $jail_conf_dir/*.conf \
> /etc/jail.*.conf 2>/dev/null | \
577c633,635
< $command -q -f $_conf -r $_j >> $_tmp 2>&1
---
> cat $_conf $jail_conf $jail_conf_dir/*.conf \
> /etc/jail.*.conf 2>/dev/null | \
> $command -q -f - -r $_j >> $_tmp 2>&1

Event Timeline

antranigv_freebsd.am updated the paste's language from autodetect to diff.Feb 28 2023, 5:38 PM
antranigv_freebsd.am updated the paste's language from diff to autodetect.Feb 28 2023, 5:40 PM