aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d/jail
Commit message (Collapse)AuthorAgeFilesLines
* Move rc startup scripts from etc/ to sbin/init/Brad Davis2018-07-281-601/+0
| | | | | | | | | | | This keeps most startup scripts as CONFS per discussion on src-committers from back during BSDCan. Approved by: will (mentor) Differential Revision: https://reviews.freebsd.org/D16466 Notes: svn path=/head/; revision=336845
* rc.d/jail: avoid misinterpreting expr argumentsEd Maste2018-02-281-3/+3
| | | | | | | | | | | | | | | | (Due to some misconfiguration) I ended up with _mask set to "-v<something>", and /etc/rc.d/jail then failed with "expr: illegal option -- v". Use "expr --" so that variable content is never interpreted as an option. Reviewed by: jamie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14535 Notes: svn path=/head/; revision=330122
* Many shops still prefer rc.conf(5) based jail configuration(s). In-partDevin Teske2016-10-121-1/+2
| | | | | | | | | | | | | | | | | | | because they can use sysrc in conjunction with ssh and xargs to perform en-masse changes in a large distribution with lots of jails spread over many hosts on a LAN/WAN. Provide a mechanism for disabling the warning eschewed by /etc/rc.d/jail in said situation. If jail_confwarn="NO" is in rc.conf(5) (default "YES") skip the warning that per-jail configurations are obsolete and that the user should migrate to jail.conf(5). Reviewed by: jelischer MFC after: 3 days Sponsored by: FIS Global, Inc. Differential Revision: https://reviews.freebsd.org/D7465 Notes: svn path=/head/; revision=307159
* Allow enforce_statfs (see jail(8)) to be set per jailDevin Teske2016-08-101-0/+1
| | | | | | | | Reviewed by: jelischer MFC after: 3 days Notes: svn path=/head/; revision=303943
* Start jails non-parallel if jail_parallel_start is NO. This was trueJamie Gritton2016-07-141-3/+6
| | | | | | | | | | for an explicitly specified jail list; now it's also true for all jails. PR: 209112 MFC after: 3 days Notes: svn path=/head/; revision=302857
* Wait for jails to complete startup if jail_parallel_start is YES,Jamie Gritton2016-07-141-15/+16
| | | | | | | | | | instead of assuming they'll take less than one second. PR: 203172 Submitted by: dmitry2004@yandex.ru Notes: svn path=/head/; revision=302855
* Don't remove the /var/run/jail_name.id file if a jail fails to start.Jamie Gritton2016-04-231-2/+0
| | | | | | | | | | | | This messes up ezjail (and possibly others), when attempting to start a jail that already exists. PR: 208806 Reviewed by: tj MFC after: 5 days Notes: svn path=/head/; revision=298516
* - Add descriptions to most of the rc scripts. Those are mostly taken from theirLars Engels2016-04-231-0/+1
| | | | | | | | | | | daemon's manpage and probably improved. - Consistently use "filesystem" not "file system". Approved by: bapt, brueffer Differential Revision: D452 Notes: svn path=/head/; revision=298514
* Interpret vnet_interface/vnet.interface as arrayDevin Teske2016-02-121-2/+17
| | | | Notes: svn path=/head/; revision=295555
* Add new rc.conf parameter "jail_reverse_stop"Mark Felder2016-02-101-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | When a user defines "jail_list" in rc.conf the jails are started in the order defined. Currently the jails are not are stopped in reverse order which may break dependencies between jails/services and prevent a clean shutdown. The new parameter "jail_reverse_stop" will shutdown jails in "jail_list" in reverse order when set to "YES". Please note that this does not affect manual invocation of the jail rc script. If a user runs the command # service jail stop jail1 jail2 jail3 the jails will be stopped in exactly the order specified regardless of jail_reverse_stop being defined in rc.conf. PR: 196152 Approved by: jamie MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D5233 Notes: svn path=/head/; revision=295471
* Fix grammar in error statementDevin Teske2016-02-041-1/+1
| | | | | | | s/consider to migrate to jail.conf/consider migrating to jail.conf/ Notes: svn path=/head/; revision=295269
* Allow the (old rc-style) exec_afterstart jail parameters to start numberingJamie Gritton2016-01-251-3/+3
| | | | | | | | | | | at 0, like exec_prestart and the others do. Make param0 optional, i.e. still look for param1. PR: 142973 MFC after: 3 days Notes: svn path=/head/; revision=294749
* Let old-style (shell-based) jail configuration handle jail names thatJamie Gritton2015-12-261-62/+68
| | | | | | | | | | | | | | | | contain characters not allowed in a shell variable (such as "-"). These will be replaced by an underscore in jail config variables, e.g. for jail "foo-bar" you would set "jail_foo_bar_hostname". This is separate from the current code that changes the jail names if they contain "." or "/". It also doesn't apply to jails defined in a jail.conf file. PR: 191181 MFC after: 5 days Notes: svn path=/head/; revision=292759
* Allow osreldate and osrelease to be set per jailPoul-Henning Kamp2015-10-201-0/+2
| | | | Notes: svn path=/head/; revision=289627
* Use read to parse a line instead of set.Hiroki Sato2015-09-101-5/+4
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=287615
* Fix a conversion error in rc.d/jailPeter Wemm2015-08-271-1/+1
| | | | Notes: svn path=/head/; revision=287220
* Un-revert the r278323 again - whatever Jenkins/kyua is up it, it hasJamie Gritton2015-02-101-2/+1
| | | | | | | nothing to do with this. Notes: svn path=/head/; revision=278480
* Revert the rc part of r278323 until I can figure out what Jenkins is doing.Jamie Gritton2015-02-071-1/+2
| | | | Notes: svn path=/head/; revision=278343
* Add mount.procfs jail parameter, so procfs can be mounted when a prison'sJamie Gritton2015-02-061-3/+2
| | | | | | | | | | | | root is in its fstab. Also fix a typo while I'm at it. PR: 197237 197066 MFC after: 3 days Notes: svn path=/head/; revision=278323
* Temporarily remove the warning added r270781 - it prints the warningPeter Wemm2014-09-081-2/+0
| | | | | | | | regardless of whether the usage is correct or not and this generates a LOT of noise, even when you have specified a mask. Notes: svn path=/head/; revision=271248
* Fix a bug which prevented mount.fstab parameter from being convertedHiroki Sato2014-09-041-4/+4
| | | | | | | | | when jail_JID_devfs_enable=NO. Spotted by: peter Notes: svn path=/head/; revision=271145
* Fix typo: s/_maske/_mask/Glen Barber2014-09-041-1/+1
| | | | | | | | MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=271078
* - Add a warning message when an IPv6 address is specified with no prefixlen.Hiroki Sato2014-08-291-21/+17
| | | | | | | - Use a parameter argument in jls(8) instead of doing grep. Notes: svn path=/head/; revision=270781
* Rev 256256 had an undocumented side effect of breaking existing behaviorPeter Wemm2013-12-081-2/+2
| | | | | | | | | | | for ipv6 jails. Among the harmful side effects included putting a route to an entire /64 onto an interface even if you were in a smaller network - eg: /80. This broke the freebsd.org cluster hosted at ISC which has /80 networks. Notes: svn path=/head/; revision=259094
* - Fix jail_parallel_start="YES".Hiroki Sato2013-10-211-26/+60
| | | | | | | | | - Fix ip[46].addr when interface parameter is not defined. Spotted by: rpaulo Notes: svn path=/head/; revision=256835
* - Fix a bug which prevented jails from starting when $jail_conf was used andHiroki Sato2013-10-181-15/+26
| | | | | | | | | | no jail name was specified. - Display error messages when start/stop fails. Reported by: swills Notes: svn path=/head/; revision=256716
* - Fix "ifname|addr" syntax support in jail_{jname}_ip.Hiroki Sato2013-10-151-17/+44
| | | | | | | - Create /var/run/jail_{jname}.id because ezjail-admin depends on it. Notes: svn path=/head/; revision=256498
* - Normalize jailname. "example.com" is converted to "example_com".Hiroki Sato2013-10-141-20/+34
| | | | | | | | | | | | - Fix a bug that some $jail_{jname}_foo variables did not work. - Fix a bug which prevented $jail_devfs_ruleset from working[1]. - Move $jail_parameters to the last of the configuraiton lines[1]. Reported by: Jase Thew[1] Approved by: re (glebius) Notes: svn path=/head/; revision=256440
* - Add mount.fdescfs parameter to jail(8). This is similar toHiroki Sato2013-10-121-3/+2
| | | | | | | | | | | | | mount.devfs but mounts fdescfs. The mount happens just after mount.devfs. - rc.d/jail now displays whole error message from jail(8) when a jail fails to start. Approved by: re (gjb) Notes: svn path=/head/; revision=256385
* - Update rc.d/jail to use a jail(8) configuration file instead ofHiroki Sato2013-10-101-570/+299
| | | | | | | | | | | | | | | command line options. The "jail_<jname>_*" rc.conf(5) variables for per-jail configuration are automatically converted to /var/run/jail.<jname>.conf before the jail(8) utility is invoked. This is transparently backward compatible. - Fix a minor bug in jail(8) which prevented it from returning false when jail -r failed. Approved by: re (glebius) Notes: svn path=/head/; revision=256256
* Add a conditional sleep 1 in case we add any IPv6 addresses to interfaces.Bjoern A. Zeeb2013-01-171-1/+8
| | | | | | | | | | | | Do this per jail started, not per address. This will allow DAD to complete and services to properly start. Before we have seen problems with services trying to start before the IPv6 address was available to use and thus erroring and failing to start. MFC after: 3 days Notes: svn path=/head/; revision=245525
* Only pass ip[46].addr when _addrl contains a valueEitan Adler2012-11-151-1/+2
| | | | | | | | | | Submitted by: crees Reviewed by: Mike Jakubik <mike.jakubik@intertainservices.com> Approved by: cperciva MFC after: 2 weeks Notes: svn path=/head/; revision=243080
* Simply things so that "#REQUIRE: FILESYSTEMS" means the fileDavid E. O'Brien2012-09-111-1/+1
| | | | | | | | | | | | | | systems are fully "ready to go". 'FILESYSTEMS' states: "This is a dummy dependency, for services which require file systems to be mounted before starting." However, we have 'var' which is was run after 'FILESYSTEMS' and can mount /var if it already isn't mounted. Furthermore, several scripts cannot use /var until 'cleanvar' has done its thing. Thus "FILESYSTEMS" hasn't really meant all critical file systems are fully usable. Notes: svn path=/head/; revision=240336
* - Allow to pass extra parameters for each jails.Jun Kuriyama2012-08-191-5/+19
| | | | | | | | | | - To achieve above, convert jail(8) invocation to use new style command line "-c" flag. Reviewed at: freebsd-jail@ Notes: svn path=/head/; revision=239382
* Move -n ${_jail} before ${_flags} so that any -n options in ${_flags}Dag-Erling Smørgrav2012-07-181-1/+1
| | | | | | | will override ours instead of the other way around. Notes: svn path=/head/; revision=238605
* Name jails automatically.Dag-Erling Smørgrav2012-07-041-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=238102
* When creating the jails /dev/log symlink, do it by full path to avoidBrooks Davis2012-01-201-4/+1
| | | | | | | | | | | | | creating stray "log" symlinks if the mount fails. That apparently happens in some ezjail configs. PR: conf/143084 Submitted by: Dirk Engling <erdgeist at erdgeist.org> Reviewed by: simon MFC after: 2 weeks Notes: svn path=/head/; revision=230403
* Prepare for the removal of set_rcvar() by changing the rcvar=Doug Barton2012-01-141-1/+1
| | | | | | | | | | | | | | | | | | assignments to the literal values it would have returned. The concept of set_rcvar() was nice in theory, but the forks it creates are a drag on the startup process, which is especially noticeable on slower systems, such as embedded ones. During the discussion on freebsd-rc@ a preference was expressed for using ${name}_enable instead of the literal values. However the code portability concept doesn't really apply since there are so many other places where the literal name has to be searched for and replaced. Also, using the literal value is also a tiny bit faster than dereferencing the variables, and every little bit helps. Notes: svn path=/head/; revision=230099
* Replace ${SYSCTL_W} with ${SYSCTL} in rc.d scripts, as they are identical.Ed Maste2011-03-301-2/+2
| | | | | | | | | This is a further clean up after r202988. SYSCTL_W is still initialized in rc.subr as some ports may still use it. Notes: svn path=/head/; revision=220153
* Implement the idea of parallel-only-at-start-time in a cleaner, moreDoug Barton2010-03-071-15/+10
| | | | | | | | | rc.d'ish way. Not objected to by: netchild Notes: svn path=/head/; revision=204818
* Redirect stdin from /dev/null when starting a jail:Alexander Leidinger2010-03-051-2/+18
| | | | | | | | | | | | | | | | | | | | | | | At least in RELENG_7 this fixes some start problems for some programs from the ports. It is also more correct, as a jail shall not expect input (interactivity) from the jail-host. Revert the current behavior of starting jails in the background and make it optional only for the start of jails (jail_parallell_start=YES in rc.conf): - The stop can not be done in the background, the system needs to wait until everything is stopped correctly before it can reboot or power down. - The start should not be done in parallel by default, this not only breaks POLA for people comming from RELENG_x, it may also break a dependency chain with other scripts in the jail-host, which need to do some stuff after the jails are up and running (e.g. hardlinking a mysql socket from one jail into another one). Discussed on: freebsd-jails@ Notes: svn path=/head/; revision=204759
* Execute the start/stop process of a jail in the background.Remko Lodder2009-11-021-1/+1
| | | | | | | | | | | | | | This will prevent that the script hangs during startup, which could cause annoying effects after rebooting for example. PR: kern/139422 Submitted by: Andrey Groshev <greenx at yartv dot ru> Approved by: imp (mentor, implicit) MFC after: 3 days Facilitated by: Snow B.V. Notes: svn path=/head/; revision=198785
* Small cleanups to the jail script:Ed Schouten2009-06-101-4/+3
| | | | | | | | | | | | - Remove redundant debugging of consolelog. - Use `while :', instead of `while [ true ]'. This is done in other places as well. Submitted by: Jille Timmermans <jille quis cx> (not jilles) Reviewed by: jilles Notes: svn path=/head/; revision=193939
* Added (pre|post)(start|stop) jail hooks. These can be used to runRuslan Ermilov2009-04-281-2/+108
| | | | | | | | | | | arbitrary commands (outside the jail) associated with said events, e.g. to bring up/down CARP interfaces representing services run in jails. Reviewed by: simon Notes: svn path=/head/; revision=191620
* Update jail startup script for multi-IPv4/v6/no-IP jails.Bjoern A. Zeeb2009-01-261-16/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | Note: this is only really necessary because of the ifconfig logic to add/remove the jail IPs upon start/stop. Consensus among simon and I is that the logic should really be factored out from the startup script and put into a proper management solution. - We now support starting of no-IP jails. - Remove the global jail_<jname>_netmask option as it is only helpful to set netmasks/prefixes for the right address family and per address. - Implement jail_<jname>_ip options to support both address familes with regard to ifconfig logic. - Implement _multi<n> support suffix to the jail_<jname>_ip option to configure additional addresses to avoid overlong, unreadbale jail_<jname>_ip lines with lots of addresses. Submitted by: initial work from Ruben van Staveren Discussed on: freebsd-jail in Nov 2008. Reviewed by: simon, ru (partial, older version) MFC after: 1 week Notes: svn path=/head/; revision=187708
* Allow a jail's IP alias to be created with an arbitrary netmask.Ruslan Ermilov2008-09-241-1/+3
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=183325
* Allow a jail to be started with a specific route fib.Andrew Thompson2008-09-161-1/+8
| | | | | | | | Reviewed by: secteam (simon) Reviewed by: brooks, bz Notes: svn path=/head/; revision=183100
* As previously discussed, add the svn:executable property to all scriptsDoug Barton2008-07-161-0/+0
| | | | Notes: svn path=/head/; revision=180563
* Add warning about this script dealing with untrusted data.Simon L. B. Nielsen2008-01-131-0/+6
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=175293
* Fix indentation.Ralf S. Engelschall2007-05-241-1/+1
| | | | Notes: svn path=/head/; revision=169925