From 5bfaa95b9c6a076bbe16966bb77c4dd42ddc5039 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 8 Jan 2013 20:03:01 +0000 Subject: Checkpoint svn path=/branches/tk377/; revision=4959 --- rcynic/installation-scripts/freebsd/install.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'rcynic/installation-scripts/freebsd') diff --git a/rcynic/installation-scripts/freebsd/install.sh b/rcynic/installation-scripts/freebsd/install.sh index 105de21b..2bcf561a 100644 --- a/rcynic/installation-scripts/freebsd/install.sh +++ b/rcynic/installation-scripts/freebsd/install.sh @@ -51,10 +51,8 @@ if ! rcynic_jaildir="$jaildir" rcynic_user="$jailuser" rcynic_group="$jailgroup" exit 1 fi -if /bin/test -r "$jaildir/etc/rcynic.conf"; then - echo "You already have config file \"${jaildir}/etc/rcynic.conf\", so I will use it." -elif /usr/bin/install -m 444 -o root -g wheel -p ../sample-rcynic.conf "${jaildir}/etc/rcynic.conf"; then - echo "Installed minimal ${jaildir}/etc/rcynic.conf, adding SAMPLE trust anchors" +if /usr/bin/install -m 444 -o root -g wheel -p ../sample-rcynic.conf "${jaildir}/etc/rcynic.conf.sample"; then + echo "Installed minimal ${jaildir}/etc/rcynic.conf.sample, adding SAMPLE trust anchors" for i in ../../sample-trust-anchors/*.tal; do j="$jaildir/etc/trust-anchors/${i##*/}" /bin/test -r "$i" || continue @@ -64,9 +62,18 @@ elif /usr/bin/install -m 444 -o root -g wheel -p ../sample-rcynic.conf "${jaildi done j=1 for i in $jaildir/etc/trust-anchors/*.tal; do - echo >>"${jaildir}/etc/rcynic.conf" "trust-anchor-locator.$j = /etc/trust-anchors/${i##*/}" + echo >>"${jaildir}/etc/rcynic.conf.sample" "trust-anchor-locator.$j = /etc/trust-anchors/${i##*/}" j=$((j+1)) done +else + echo "Installing minimal ${jaildir}/etc/rcynic.conf.sample failed" + exit 1 +fi + +if /bin/test -r "$jaildir/etc/rcynic.conf"; then + echo "You already have config file \"${jaildir}/etc/rcynic.conf\", so I will use it." +elif /bin/cp -p "$jaildir/etc/rcynic.conf.sample" "$jaildir/etc/rcynic.conf" + echo "Installed minimal ${jaildir}/etc/rcynic.conf" else echo "Installing minimal ${jaildir}/etc/rcynic.conf failed" exit 1 -- cgit v1.2.3 From 9d92820a291293378e4899397ea5e234b8603224 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 9 Jan 2013 16:59:08 +0000 Subject: More fun with pkg-install. svn path=/branches/tk377/; revision=4962 --- rcynic/installation-scripts/freebsd/rc.d.rcynic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rcynic/installation-scripts/freebsd') diff --git a/rcynic/installation-scripts/freebsd/rc.d.rcynic b/rcynic/installation-scripts/freebsd/rc.d.rcynic index 73e6efda..69c97ce6 100755 --- a/rcynic/installation-scripts/freebsd/rc.d.rcynic +++ b/rcynic/installation-scripts/freebsd/rc.d.rcynic @@ -12,7 +12,7 @@ name="rcynic" start_cmd="rcynic_start" stop_cmd="rcynic_stop" -: ${rcynic_jaildir="/var/rcynic"} +: ${rcynic_jaildir="/usr/local/var/rcynic"} : ${rcynic_user="rcynic"} : ${rcynic_group="rcynic"} -- cgit v1.2.3 From fe9fd5c229a0b8de234e581cd906b408f171dc42 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 9 Jan 2013 18:08:33 +0000 Subject: I guess it helps to create the parent directory too. svn path=/branches/tk377/; revision=4964 --- rcynic/installation-scripts/freebsd/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rcynic/installation-scripts/freebsd') diff --git a/rcynic/installation-scripts/freebsd/install.sh b/rcynic/installation-scripts/freebsd/install.sh index 2bcf561a..ac0a0504 100644 --- a/rcynic/installation-scripts/freebsd/install.sh +++ b/rcynic/installation-scripts/freebsd/install.sh @@ -34,7 +34,7 @@ else fi if ! /bin/test -d "${jaildir}"; then - /bin/mkdir "${jaildir}" + /bin/mkdir -p "${jaildir}" fi if /usr/bin/install -m 555 -o root -g wheel -p rc.d.rcynic ${DESTDIR}/usr/local/etc/rc.d/rcynic; then -- cgit v1.2.3 From 2a2d0d8ca7f03a73808c9857c78a6ce13e95e9f9 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 9 Jan 2013 20:08:58 +0000 Subject: Doh. svn path=/branches/tk377/; revision=4965 --- rcynic/installation-scripts/freebsd/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rcynic/installation-scripts/freebsd') diff --git a/rcynic/installation-scripts/freebsd/install.sh b/rcynic/installation-scripts/freebsd/install.sh index ac0a0504..7f3e9f02 100644 --- a/rcynic/installation-scripts/freebsd/install.sh +++ b/rcynic/installation-scripts/freebsd/install.sh @@ -72,7 +72,7 @@ fi if /bin/test -r "$jaildir/etc/rcynic.conf"; then echo "You already have config file \"${jaildir}/etc/rcynic.conf\", so I will use it." -elif /bin/cp -p "$jaildir/etc/rcynic.conf.sample" "$jaildir/etc/rcynic.conf" +elif /bin/cp -p "$jaildir/etc/rcynic.conf.sample" "$jaildir/etc/rcynic.conf"; then echo "Installed minimal ${jaildir}/etc/rcynic.conf" else echo "Installing minimal ${jaildir}/etc/rcynic.conf failed" -- cgit v1.2.3 From ddc122bdff0591ad350a985beed14cdde6a8fd73 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sat, 12 Jan 2013 01:50:45 +0000 Subject: Using @cwd in FreeBSD pkg-plist seems to work, and is much less of a change from what has until now been standard practice, so going with that. svn path=/branches/tk377/; revision=4967 --- rcynic/installation-scripts/freebsd/rc.d.rcynic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rcynic/installation-scripts/freebsd') diff --git a/rcynic/installation-scripts/freebsd/rc.d.rcynic b/rcynic/installation-scripts/freebsd/rc.d.rcynic index 69c97ce6..73e6efda 100755 --- a/rcynic/installation-scripts/freebsd/rc.d.rcynic +++ b/rcynic/installation-scripts/freebsd/rc.d.rcynic @@ -12,7 +12,7 @@ name="rcynic" start_cmd="rcynic_start" stop_cmd="rcynic_stop" -: ${rcynic_jaildir="/usr/local/var/rcynic"} +: ${rcynic_jaildir="/var/rcynic"} : ${rcynic_user="rcynic"} : ${rcynic_group="rcynic"} -- cgit v1.2.3 From 27d85628a8ebe96c3adc2dbeac0e58160c727071 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Fri, 1 Feb 2013 18:38:48 +0000 Subject: Checkpoint svn path=/branches/tk377/; revision=5001 --- rcynic/installation-scripts/freebsd/install.sh | 158 ------------------------ rcynic/installation-scripts/freebsd/rc.d.rcynic | 76 ------------ 2 files changed, 234 deletions(-) delete mode 100644 rcynic/installation-scripts/freebsd/install.sh delete mode 100755 rcynic/installation-scripts/freebsd/rc.d.rcynic (limited to 'rcynic/installation-scripts/freebsd') diff --git a/rcynic/installation-scripts/freebsd/install.sh b/rcynic/installation-scripts/freebsd/install.sh deleted file mode 100644 index 7f3e9f02..00000000 --- a/rcynic/installation-scripts/freebsd/install.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/sh - -# $Id$ -# -# Create a chroot jail for rcynic. -# -# This is approximately what a pkg-install script might do if this were -# a FreeBSD port. Perhaps some day it will be. - -: ${jaildir="${DESTDIR}/var/rcynic"} -: ${jailuser="rcynic"} -: ${jailgroup="rcynic"} -: ${setupcron="NO"} - -echo "Setting up \"${jaildir}\" as a chroot jail for rcynic." - -if /usr/sbin/pw groupshow "${jailgroup}" 2>/dev/null; then - echo "You already have a group \"${jailgroup}\", so I will use it." -elif /usr/sbin/pw groupadd ${jailgroup}; then - echo "Added group \"${jailgroup}\"." -else - echo "Adding group \"${jailgroup}\" failed..." - echo "Please create it, then try again." - exit 1 -fi - -if /usr/sbin/pw usershow "${jailuser}" 2>/dev/null; then - echo "You already have a user \"${jailuser}\", so I will use it." -elif /usr/sbin/pw useradd ${jailuser} -g ${jailgroup} -h - -d /nonexistant -s /usr/sbin/nologin -c "RPKI validation system"; then - echo "Added user \"${jailuser}\"." -else - echo "Adding user \"${jailuser}\" failed..." - echo "Please create it, then try again." - exit 1 -fi - -if ! /bin/test -d "${jaildir}"; then - /bin/mkdir -p "${jaildir}" -fi - -if /usr/bin/install -m 555 -o root -g wheel -p rc.d.rcynic ${DESTDIR}/usr/local/etc/rc.d/rcynic; then - echo "Installed rc.d.rcynic as ${DESTDIR}/usr/local/etc/rc.d/rcynic" -else - echo "Installing ${DESTDIR}/usr/local/etc/rc.d/rcynic failed" - exit 1 -fi - -echo "Running /usr/local/etc/rc.d/rcynic to set up directories" - -if ! rcynic_jaildir="$jaildir" rcynic_user="$jailuser" rcynic_group="$jailgroup" /bin/sh /usr/local/etc/rc.d/rcynic start; then - echo "Directory setup failed" - exit 1 -fi - -if /usr/bin/install -m 444 -o root -g wheel -p ../sample-rcynic.conf "${jaildir}/etc/rcynic.conf.sample"; then - echo "Installed minimal ${jaildir}/etc/rcynic.conf.sample, adding SAMPLE trust anchors" - for i in ../../sample-trust-anchors/*.tal; do - j="$jaildir/etc/trust-anchors/${i##*/}" - /bin/test -r "$i" || continue - /bin/test -r "$j" && continue - echo "Installing $i as $j" - /usr/bin/install -m 444 -o root -g wheel -p "$i" "$j" - done - j=1 - for i in $jaildir/etc/trust-anchors/*.tal; do - echo >>"${jaildir}/etc/rcynic.conf.sample" "trust-anchor-locator.$j = /etc/trust-anchors/${i##*/}" - j=$((j+1)) - done -else - echo "Installing minimal ${jaildir}/etc/rcynic.conf.sample failed" - exit 1 -fi - -if /bin/test -r "$jaildir/etc/rcynic.conf"; then - echo "You already have config file \"${jaildir}/etc/rcynic.conf\", so I will use it." -elif /bin/cp -p "$jaildir/etc/rcynic.conf.sample" "$jaildir/etc/rcynic.conf"; then - echo "Installed minimal ${jaildir}/etc/rcynic.conf" -else - echo "Installing minimal ${jaildir}/etc/rcynic.conf failed" - exit 1 -fi - -echo "Installing rcynic as ${jaildir}/bin/rcynic" - -/usr/bin/install -m 555 -o root -g wheel -p ../../rcynic "${jaildir}/bin/rcynic" - -if /bin/test ! -x "$jaildir/bin/rsync" -a ! -x ../../static-rsync/rsync; then - echo "Building static rsync for jail, this may take a little while" - (cd ../../static-rsync && exec make) -fi - -if /bin/test -x "$jaildir/bin/rsync"; then - echo "You already have an executable \"$jaildir/bin/rsync\", so I will use it" -elif /usr/bin/install -m 555 -o root -g wheel -p ../../static-rsync/rsync "${jaildir}/bin/rsync"; then - echo "Installed static rsync as \"${jaildir}/bin/rsync\"" -else - echo "Installing static rsync failed" - exit 1 -fi - -if /usr/bin/install -m 555 -o root -g wheel -p ../../rcynic-html "${jaildir}/bin/rcynic-html"; then - echo "Installed rcynic.py as \"${jaildir}/bin/rcynic-html\"" -else - echo "Installing rcynic-html failed" - exit 1 -fi - -echo "Setting up root's crontab to run jailed rcynic" - -case "$setupcron" in -YES|yes) - /usr/bin/crontab -l -u root 2>/dev/null | - /usr/bin/awk -v "jailuser=$jailuser" -v "jailgroup=$jailgroup" -v "jaildir=$jaildir" ' - BEGIN { - cmd = "exec /usr/sbin/chroot -u " jailuser " -g " jailgroup " " jaildir; - cmd = cmd " /bin/rcynic -c /etc/rcynic.conf"; - } - $0 !~ cmd { - print; - } - END { - "/usr/bin/hexdump -n 2 -e \"\\\"%u\\\\\\n\\\"\" /dev/random" | getline; - printf "%u * * * *\t%s\n", $1 % 60, cmd; - }' | - /usr/bin/crontab -u root - - /bin/cat </dev/null - - /usr/sbin/mtree -deU -p "${rcynic_jaildir}" </dev/null -} - -load_rc_config $name -run_rc_command "$1" -- cgit v1.2.3