2018-11-24 20:07:20 -07:00
|
|
|
Targeting
|
|
|
|
|
=========
|
2018-11-28 21:02:42 -07:00
|
|
|
|
2025-04-19 10:20:22 -05:00
|
|
|
Bastille uses a ``subcommand TARGET ARGS`` syntax, meaning that each command
|
2025-11-09 17:24:39 -07:00
|
|
|
requires a target. Targets are usually jails, but can also be releases.
|
2018-11-28 21:02:42 -07:00
|
|
|
|
2025-11-09 17:24:39 -07:00
|
|
|
Targeting a jail is done by providing the exact jail name, the JID of the
|
|
|
|
|
jail, a tag, or by typing the starting few characters of a jail.
|
2025-07-16 18:03:35 -06:00
|
|
|
|
2025-11-09 17:24:39 -07:00
|
|
|
If you use a tag as the TARGET, Bastille will target any and all jails that have
|
|
|
|
|
that tag assigned. If you have a jail with the same name as the tag you are trying to
|
2025-07-16 18:49:31 -06:00
|
|
|
target, Bastille will target the jail, and not the tag.
|
2018-11-28 21:02:42 -07:00
|
|
|
|
2025-02-28 23:50:42 -07:00
|
|
|
Targeting a release is done by providing the exact release name. (Note: do not
|
2025-04-10 06:53:03 -06:00
|
|
|
include the ``-pX`` point-release version.)
|
2018-11-28 21:02:42 -07:00
|
|
|
|
2025-11-09 17:24:39 -07:00
|
|
|
Bastille includes a pre-defined keyword of [ALL|all] to target all running
|
|
|
|
|
jails. It is also possible to target multiple jails by grouping them in
|
2025-04-20 11:19:18 -05:00
|
|
|
quotes, as seen below.
|
2018-11-28 21:02:42 -07:00
|
|
|
|
2025-02-28 23:50:42 -07:00
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
|
|
ishmael ~ # bastille cmd "jail1 jail2 jail3" echo Hello!
|
2018-11-28 21:02:42 -07:00
|
|
|
|
2025-04-23 14:29:07 -06:00
|
|
|
Priority
|
|
|
|
|
--------
|
|
|
|
|
|
2025-07-08 22:40:28 -05:00
|
|
|
The priority value determines in what order commands are executed if multiple
|
2025-11-09 17:24:39 -07:00
|
|
|
jails are targetted, including the [ALL|all] target.
|
2025-04-23 14:29:07 -06:00
|
|
|
|
2025-07-08 22:40:28 -05:00
|
|
|
It also controls in what order jails are started and stopped on system startup
|
|
|
|
|
and shutdown. This requires Bastille to be enabled with ``sysrc bastille_enable=YES``.
|
|
|
|
|
Jails will start in order starting at the lowest value, and will stop in order
|
|
|
|
|
starting at the highest value. So, jails with a priority value of 1 will start
|
|
|
|
|
first, and stop last.
|
2025-04-23 14:29:07 -06:00
|
|
|
|
2025-07-08 22:40:28 -05:00
|
|
|
When jails are created with Bastille, this value defaults to ``99``, but can be
|
|
|
|
|
overridden with ``-p|--priority VALUE`` on creation.
|
|
|
|
|
See ``bastille create --priority 90 TARGET...``.
|
2025-04-23 14:29:07 -06:00
|
|
|
|
|
|
|
|
This value can be changed using ``bastille config TARGET set priority VALUE``.
|
|
|
|
|
|
|
|
|
|
This value will be shown using ``bastille list all``.
|
|
|
|
|
|
2025-11-09 17:24:39 -07:00
|
|
|
Examples: Jails
|
|
|
|
|
---------------
|
2018-11-28 21:02:42 -07:00
|
|
|
|
|
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
|
|
ishmael ~ # bastille ...
|
|
|
|
|
|
|
|
|
|
+-----------+--------+------------------+-------------------------------------------------------------+
|
|
|
|
|
| command | target | args | description |
|
|
|
|
|
+===========+========+==================+=============================================================+
|
2025-11-09 17:24:39 -07:00
|
|
|
| cmd | ALL | 'sockstat -4' | execute `sockstat -4` in ALL jails (ip4 sockets) |
|
2020-04-14 11:52:29 +02:00
|
|
|
+-----------+--------+-----+------------+-------------------------------------------------------------+
|
2018-11-28 21:02:42 -07:00
|
|
|
| console | mariadb02 | --- | console (shell) access to mariadb02 |
|
2022-03-16 13:55:51 +01:00
|
|
|
+----+------+--------+-----+------------+-------------------------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| pkg | web01 | 'install nginx' | install nginx package in web01 jail |
|
2018-11-28 21:02:42 -07:00
|
|
|
+-----------+--------+------------------+-------------------------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| pkg | ALL | upgrade | upgrade packages in ALL jails |
|
2020-04-14 11:52:29 +02:00
|
|
|
+-----------+--------+------------------+-------------------------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| pkg | ALL | audit | (CVE) audit packages in ALL jails |
|
2020-04-14 11:52:29 +02:00
|
|
|
+-----------+--------+------------------+-------------------------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| sysrc | web01 | nginx_enable=YES | execute `sysrc nginx_enable=YES` in web01 jail |
|
2020-04-14 11:52:29 +02:00
|
|
|
+-----------+--------+------------------+-------------------------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| template | ALL | username/base | apply `username/base` template to ALL jails |
|
2020-04-14 11:52:29 +02:00
|
|
|
+-----------+--------+------------------+-------------------------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| start | web02 | --- | start web02 jail |
|
2020-04-14 11:52:29 +02:00
|
|
|
+----+------+----+---+------------------+--------------+----------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| cp | bastion03 | /tmp/resolv.conf-cf etc/resolv.conf | copy host-path to jail-path in bastion03 |
|
2022-03-16 13:55:51 +01:00
|
|
|
+----+------+----+---+---------------------------------+----------------------------------------------+
|
2025-11-09 17:24:39 -07:00
|
|
|
| create | folsom | 13.2-RELEASE 10.17.89.10 | create 13.2 jail named `folsom` with IP |
|
2022-03-16 13:55:51 +01:00
|
|
|
+-----------+--------+---------------------------------+----------------------------------------------+
|
2018-11-28 21:02:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples: Releases
|
2025-04-14 15:30:12 -06:00
|
|
|
------------------
|
2018-11-28 21:02:42 -07:00
|
|
|
|
|
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
|
|
ishmael ~ # bastille ...
|
|
|
|
|
|
2025-04-20 11:19:18 -05:00
|
|
|
+-----------+--------------+--------------+------------------------------------+
|
|
|
|
|
| command | target | args | description |
|
|
|
|
|
+===========+==============+==============+====================================+
|
|
|
|
|
| bootstrap | 13.2-RELEASE | --- | bootstrap 13.2-RELEASE release |
|
|
|
|
|
+-----------+--------------+--------------+------------------------------------+
|
|
|
|
|
| update | 12.4-RELEASE | --- | update 12.4-RELEASE release |
|
|
|
|
|
+-----------+--------------+--------------+------------------------------------+
|
|
|
|
|
| verify | 12.4-RELEASE | --- | verify 12.4-RELEASE release |
|
|
|
|
|
+-----------+--------------+--------------+------------------------------------+
|