From 945944feb4e90bd3988895d475246fe2a3a77afd Mon Sep 17 00:00:00 2001 From: Christer Edwards Date: Sun, 12 Apr 2020 19:06:27 -0600 Subject: [PATCH] release validation fixes --- usr/local/share/bastille/bootstrap.sh | 2 +- usr/local/share/bastille/create.sh | 1 + usr/local/share/bastille/import.sh | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/usr/local/share/bastille/bootstrap.sh b/usr/local/share/bastille/bootstrap.sh index 3add1de8..8035afdc 100644 --- a/usr/local/share/bastille/bootstrap.sh +++ b/usr/local/share/bastille/bootstrap.sh @@ -357,7 +357,7 @@ case "${1}" in *-stable-build-[0-9]*|*-STABLE-BUILD-[0-9]*) ## check for HardenedBSD(specific stable build releases) NAME_VERIFY=$(echo "${RELEASE}" | grep -iwE '([0-9]{1,2})(-stable-build)-([0-9]{1,3})$' | sed 's/BUILD/build/g' | sed 's/STABLE/stable/g') - NAME_RELEASE=$(echo "${NAME_VERIFY}" | sed 's/-build-[0-9]\{1,2\}//g') + NAME_RELEASE=$(echo "${NAME_VERIFY}" | sed 's/-build-[0-9]\{1,3\}//g') NAME_BUILD=$(echo "${NAME_VERIFY}" | sed 's/[0-9]\{1,2\}-stable-//g') UPSTREAM_URL="${bastille_url_hardenedbsd}${NAME_RELEASE}/${HW_MACHINE}/${HW_MACHINE_ARCH}/${NAME_BUILD}" PLATFORM_OS="HardenedBSD" diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index e2efad98..2f37b9b1 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -479,6 +479,7 @@ fi ## check if interface is valid if [ -n "${INTERFACE}" ]; then validate_netif + validate_netconf else validate_netconf fi diff --git a/usr/local/share/bastille/import.sh b/usr/local/share/bastille/import.sh index 98da5218..5742b5ad 100644 --- a/usr/local/share/bastille/import.sh +++ b/usr/local/share/bastille/import.sh @@ -140,14 +140,14 @@ generate_config() { if [ "${FILE_EXT}" = ".zip" ]; then # Gather some bits from foreign/iocage config files JSON_CONFIG="${bastille_jailsdir}/${TARGET_TRIM}/config.json" - if [ -f "${JSON_CONFIG}" ]; then + if [ -n "${JSON_CONFIG}" ]; then IPV4_CONFIG=$(grep -wo '\"ip4_addr\": \".*\"' "${JSON_CONFIG}" | tr -d '" ' | sed 's/ip4_addr://') IPV6_CONFIG=$(grep -wo '\"ip6_addr\": \".*\"' "${JSON_CONFIG}" | tr -d '" ' | sed 's/ip6_addr://') fi elif [ "${FILE_EXT}" = ".tar.gz" ]; then # Gather some bits from foreign/ezjail config files PROP_CONFIG="${bastille_jailsdir}/${TARGET_TRIM}/prop.ezjail-${FILE_TRIM}-*" - if [ -f "${PROP_CONFIG}" ]; then + if [ -n "${PROP_CONFIG}" ]; then IPVX_CONFIG=$(grep -wo "jail_${TARGET_TRIM}_ip=.*" ${PROP_CONFIG} | tr -d '" ' | sed "s/jail_${TARGET_TRIM}_ip=//") fi fi