mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-22 02:00:08 +01:00
Merge pull request #987 from BastilleBSD/add-space-between-jails
add blank line after each jail on multiple targets
This commit is contained in:
@@ -90,6 +90,7 @@ set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
|
||||
@@ -115,6 +115,7 @@ check_fib() {
|
||||
}
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
|
||||
@@ -87,10 +87,15 @@ bastille_root_check
|
||||
set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
host_path="${HOST_PATH}"
|
||||
jail_path="$(echo ${bastille_jailsdir}/${_jail}/root/${JAIL_PATH} | sed 's#//#/#g')"
|
||||
|
||||
if ! cp "${OPTION}" "${host_path}" "${jail_path}"; then
|
||||
error_continue "CP failed: ${host_path} -> ${jail_path}"
|
||||
fi
|
||||
|
||||
done
|
||||
@@ -51,6 +51,8 @@ destroy_jail() {
|
||||
local OPTIONS
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
|
||||
bastille_jail_base="${bastille_jailsdir}/${_jail}"
|
||||
bastille_jail_log="${bastille_logsdir}/${_jail}_console.log"
|
||||
|
||||
@@ -85,6 +85,7 @@ bastille_root_check
|
||||
set_target_single "${TARGET}"
|
||||
|
||||
info "[${TARGET}]:"
|
||||
|
||||
check_target_is_running "${TARGET}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
bastille start "${TARGET}"
|
||||
else
|
||||
|
||||
@@ -89,12 +89,17 @@ set_target_single "${SOURCE_TARGET}" && SOURCE_TARGET="${TARGET}"
|
||||
set_target "${DEST_TARGET}" && DEST_TARGET="${JAILS}"
|
||||
|
||||
for _jail in ${DEST_TARGET}; do
|
||||
|
||||
if [ "${_jail}" = "${SOURCE_TARGET}" ]; then
|
||||
continue
|
||||
else
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
source_path="$(echo ${bastille_jailsdir}/${SOURCE_TARGET}/root/${SOURCE_PATH} | sed 's#//#/#g')"
|
||||
dest_path="$(echo ${bastille_jailsdir}/${_jail}/root/${DEST_PATH} | sed 's#//#/#g')"
|
||||
|
||||
if ! cp "${OPTION}" "${source_path}" "${dest_path}"; then
|
||||
error_continue "JCP failed: ${source_path} -> ${dest_path}"
|
||||
fi
|
||||
|
||||
@@ -102,6 +102,7 @@ set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
|
||||
@@ -142,6 +142,7 @@ fi
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
|
||||
@@ -567,7 +567,7 @@ case "${ACTION}" in
|
||||
add_interface "${TARGET}" "${INTERFACE}" "${IP}"
|
||||
fi
|
||||
if [ -n "${VLAN_ID}" ]; then
|
||||
add_vlan "${TARGET}" "${INTERFACE}" "${IP}" "${VLAN_ID}"
|
||||
add_vlan "${TARGET}" "${INTERFACE}" "${IP}" "${VLAN_ID}"
|
||||
fi
|
||||
if [ "${AUTO}" -eq 1 ]; then
|
||||
bastille start "${TARGET}"
|
||||
|
||||
@@ -96,6 +96,7 @@ errors=0
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
|
||||
@@ -86,12 +86,17 @@ bastille_root_check
|
||||
set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
bastille start "${_jail}"
|
||||
else
|
||||
error_notify "Jail is not running."
|
||||
error_continue "Use [-a|--auto] to auto-start the jail."
|
||||
fi
|
||||
|
||||
jexec -l "${_jail}" /usr/sbin/service "$@"
|
||||
|
||||
done
|
||||
|
||||
@@ -111,7 +111,9 @@ for _jail in ${JAILS}; do
|
||||
fi
|
||||
fi
|
||||
|
||||
info "[${_jail}]:"
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_stopped "${_jail}" || error_continue "Jail is already running."
|
||||
|
||||
# Validate interfaces and add IPs to firewall table
|
||||
|
||||
@@ -86,7 +86,9 @@ set_target "${TARGET}" "reverse"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || error_continue "Jail is already stopped."
|
||||
|
||||
# Remove RDR rules
|
||||
|
||||
@@ -86,12 +86,17 @@ bastille_root_check
|
||||
set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
bastille start "${_jail}"
|
||||
else
|
||||
error_notify "Jail is not running."
|
||||
error_continue "Use [-a|--auto] to auto-start the jail."
|
||||
fi
|
||||
|
||||
jexec -l "${_jail}" /usr/sbin/sysrc "$@"
|
||||
|
||||
done
|
||||
|
||||
@@ -75,6 +75,9 @@ bastille_root_check
|
||||
set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
|
||||
bastille_jail_tags="${bastille_jailsdir}/${_jail}/tags"
|
||||
case ${ACTION} in
|
||||
add)
|
||||
|
||||
@@ -270,6 +270,7 @@ fi
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
|
||||
@@ -85,10 +85,12 @@ bastille_root_check
|
||||
set_target_single "${TARGET}"
|
||||
|
||||
info "[${TARGET}]:"
|
||||
|
||||
check_target_is_running "${TARGET}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
bastille start "${TARGET}"
|
||||
else
|
||||
error_notify "Jail is not running."
|
||||
error_continue "Use [-a|--auto] to auto-start the jail."
|
||||
fi
|
||||
|
||||
jexec -l "${TARGET}" /usr/bin/top
|
||||
|
||||
@@ -87,6 +87,7 @@ set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
check_target_is_running "${_jail}" || if [ "${AUTO}" -eq 1 ]; then
|
||||
|
||||
@@ -45,43 +45,57 @@ EOF
|
||||
|
||||
zfs_snapshot() {
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
# shellcheck disable=SC2140
|
||||
zfs snapshot -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"@"${TAG}"
|
||||
echo
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
zfs_destroy_snapshot() {
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
# shellcheck disable=SC2140
|
||||
zfs destroy -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"@"${TAG}"
|
||||
echo
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
zfs_set_value() {
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
zfs "${ATTRIBUTE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"
|
||||
echo
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
zfs_get_value() {
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
zfs get "${ATTRIBUTE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"
|
||||
echo
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
zfs_disk_usage() {
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
echo ""
|
||||
info "[${_jail}]:"
|
||||
|
||||
zfs list -t all -o name,used,avail,refer,mountpoint,compress,ratio -r "${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${_jail}"
|
||||
echo
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user