From 203af6c8ade7556e6298bc2c6d63925d4b4348b7 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:39:10 -0700 Subject: [PATCH] Update common.sh - move generation of static mac to main functions --- usr/local/share/bastille/common.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index b1df86f9..55e54206 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -70,6 +70,14 @@ warn() { echo -e "${COLOR_YELLOW}$*${COLOR_RESET}" } +generate_static_mac() { + local jail_name="${1}" + local external_interface="${2}" + local macaddr_prefix="$(ifconfig ${external_interface} | grep ether | awk '{print $2}' | cut -d':' -f1-3)" + local macaddr_suffix="$(echo -n ${jail_name} | sha256 | cut -b -5 | sed 's/\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F][0-9a-fA-F]\)\([0-9a-fA-F]\)/\1:\2:\3/')" + macaddr="${macaddr_prefix}:${macaddr_suffix}" +} + generate_vnet_jail_netblock() { local jail_name="$1" local use_unique_bridge="$2"