diff --git a/Makefile b/Makefile index 43b3252..61b8c70 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,8 @@ MAKEFILES = ansible.mk \ use.mk FRAMEWORKS_MAKEFILES = frameworks/freenit.project.mk \ frameworks/freenit.service.mk -SCRIPTS = bhyve-init.sh \ +SCRIPTS = apply-proxy.sh \ + bhyve-init.sh \ cbsd-init.sh \ chef-provision.sh \ expect-run.sh \ diff --git a/cbsd-profile/system/master_poststop.d/deregister.sh b/cbsd-profile/system/master_poststop.d/deregister.sh index 30edb62..af6b566 100755 --- a/cbsd-profile/system/master_poststop.d/deregister.sh +++ b/cbsd-profile/system/master_poststop.d/deregister.sh @@ -1,6 +1,6 @@ #!/bin/sh -CBSD_WORKDIR=`sysrc -n cbsd_workdir` +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` LOCK_DIR="${CBSD_WORKDIR}/tmp" LOCK_FILE="${LOCK_DIR}/cbsd.zone.lock" diff --git a/cbsd-profile/system/master_prestart.d/register.sh b/cbsd-profile/system/master_prestart.d/register.sh index 7b34a8a..c392641 100755 --- a/cbsd-profile/system/master_prestart.d/register.sh +++ b/cbsd-profile/system/master_prestart.d/register.sh @@ -1,6 +1,6 @@ #!/bin/sh -CBSD_WORKDIR=`sysrc -n cbsd_workdir` +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` LOCK_DIR="${CBSD_WORKDIR}/tmp" LOCK_FILE="${LOCK_DIR}/cbsd.zone.lock" diff --git a/mk/common.mk b/mk/common.mk index e007a0a..1216fb2 100644 --- a/mk/common.mk +++ b/mk/common.mk @@ -8,7 +8,7 @@ RUNNING_GID != id -g UID ?= ${RUNNING_UID} GID ?= ${RUNNING_GID} DOMAIN != reggae get-config DOMAIN -CBSD_WORKDIR != sysrc -n cbsd_workdir +CBSD_WORKDIR != sysrc -s cbsdd -n cbsd_workdir EXTRA_PACKAGES = .for provisioner in ${PROVISIONERS} diff --git a/scripts/apply-proxy.sh b/scripts/apply-proxy.sh new file mode 100755 index 0000000..7c54800 --- /dev/null +++ b/scripts/apply-proxy.sh @@ -0,0 +1,13 @@ +#!/bin/sh + + +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` +PKG_PROXY=`reggae get-config PKG_PROXY` + +for jname in $(env NOCOLOR=1 cbsd jls header=0 display=jname); do + pkg_file="${CBSD_WORKDIR}/jails-data/${jname}-data/usr/local/etc/pkg.conf" + sed -i "" -r "/^pkg_env.*/d" "${pkg_file}" + if [ "${PKG_PROXY}" != "no" ]; then + echo "pkg_env : { http_proxy: \"http://${PKG_PROXY}/\" }" >>"${pkg_file}" + fi +done diff --git a/scripts/chef-provision.sh b/scripts/chef-provision.sh index f52e88a..9c485f3 100755 --- a/scripts/chef-provision.sh +++ b/scripts/chef-provision.sh @@ -1,6 +1,6 @@ #!/bin/sh -CBSD_WORKDIR=`sysrc -n cbsd_workdir` +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` SERVICE="${1}" TYPE="${2}" diff --git a/scripts/import.sh b/scripts/import.sh index 8b9dd51..cd70c44 100755 --- a/scripts/import.sh +++ b/scripts/import.sh @@ -1,6 +1,6 @@ #!/bin/sh -CBSD_WORKDIR=`sysrc -n cbsd_workdir` +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` IMAGE_PATH="${1}" HYPERVISOR="${2:-jail}" DOMAIN=`reggae get-config DOMAIN` diff --git a/scripts/network-init.sh b/scripts/network-init.sh index caa2e5f..6fb0fe8 100755 --- a/scripts/network-init.sh +++ b/scripts/network-init.sh @@ -89,9 +89,9 @@ setup_pf() { -e "s;MASTER_IP;${MASTER_IP};g" \ "${SCRIPT_DIR}/../templates/pf.conf" >/etc/pf.conf fi - sysrc pflog_enable="YES" - sysrc pf_enable="YES" - sysrc blacklistd_enable="YES" + service pflog enable + service pf enable + service blacklistd enable sysrc sshd_flags+="\-oUseBlacklist=yes" } diff --git a/scripts/puppet-provision.sh b/scripts/puppet-provision.sh index 0069967..185c4dc 100755 --- a/scripts/puppet-provision.sh +++ b/scripts/puppet-provision.sh @@ -1,6 +1,6 @@ #!/bin/sh -CBSD_WORKDIR=`sysrc -n cbsd_workdir` +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` SERVICE="${1}" TYPE="${2}" diff --git a/scripts/register.sh b/scripts/register.sh index 489064b..1c5d83f 100755 --- a/scripts/register.sh +++ b/scripts/register.sh @@ -9,7 +9,7 @@ if [ "${vnet}" != "1" ]; then fi . "${PROJECT_ROOT}/scripts/default.conf" - CBSD_WORKDIR=`sysrc -n cbsd_workdir` + CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` NAME=${jname} IP=${ipv4_first} ACTION="${1}" diff --git a/scripts/salt-provision.sh b/scripts/salt-provision.sh index 3aee68f..56d7ed3 100755 --- a/scripts/salt-provision.sh +++ b/scripts/salt-provision.sh @@ -1,6 +1,6 @@ #!/bin/sh -CBSD_WORKDIR=`sysrc -n cbsd_workdir` +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` SERVICE="${1}" TYPE="${2}" PY_VERSION_MAJOR="3" diff --git a/scripts/shell-provision.sh b/scripts/shell-provision.sh index f38dde8..f3f1643 100755 --- a/scripts/shell-provision.sh +++ b/scripts/shell-provision.sh @@ -1,6 +1,6 @@ #!/bin/sh -CBSD_WORKDIR=`sysrc -n cbsd_workdir` +CBSD_WORKDIR=`sysrc -s cbsdd -n cbsd_workdir` SERVICE="${1}" TYPE="${2}"