1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-30 10:38:37 +00:00

- Update to 1.2.5, fixing a DoS vulnerability.

- usr /var for runtime files making it possible to keep /usr mounted r/o.
- Grab 275 as a reserved UID and GID.
- Remove old cruft in pkg-install.
- Make 'make -DBATCH install' work non-interactively.
- Make 'pkg_add heartbeat-1.2.5' work non-interactively.
- Installation will fail without the user/group, so I simply create them.

PR:		ports/104577
Submitted by:	Ulrich Spoerlein <uspoerlein@gmail.com>
Approved by:	Scott Kleihege <scott-ports@tummy.com> (maintainer)
This commit is contained in:
Alejandro Pulver 2006-11-01 20:02:31 +00:00
parent 92ac0f0a2f
commit 2c757211eb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=176113
8 changed files with 92 additions and 168 deletions

View File

@ -6,7 +6,7 @@
#
PORTNAME= heartbeat
PORTVERSION= 1.2.4
PORTVERSION= 1.2.5
CATEGORIES= sysutils
MASTER_SITES= http://linux-ha.org/download/
@ -24,7 +24,9 @@ USE_GNOME= glib12
USE_LDCONFIG= yes
CONFIGURE_ARGS+= --disable-fatal-warnings \
--with-initdir=${PREFIX}/etc/rc.d
--with-initdir=${PREFIX}/etc/rc.d \
--localstatedir=/var \
--with-group-id=275 --with-ccmuser-id=275
SUB_FILES= pkg-install
PKGDEINSTALL= ${PKGINSTALL}
@ -63,11 +65,15 @@ post-patch:
${WRKSRC}/telecom/cms/Makefile.in
.endif
.if !defined(BATCH)
BATCH=no
.endif
post-deinstall:
@${SH} ${PKGINSTALL} ${PKGNAME} DEINSTALL
@BATCH=${BATCH} ${SH} ${PKGINSTALL} ${PKGNAME} DEINSTALL
post-install:
@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
@BATCH=${BATCH} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
# some subdirs treat man as documentation, therefor we have to install
# those man pages manually if NOPORTDOCS is defined

View File

@ -1,3 +1,3 @@
MD5 (heartbeat-1.2.4.tar.gz) = 7e3f752af06c25f7141c4b67a538e718
SHA256 (heartbeat-1.2.4.tar.gz) = cb2516a965582651859ab48a44dd8764332897ef9a81986a0aa25dc9306378cf
SIZE (heartbeat-1.2.4.tar.gz) = 2102978
MD5 (heartbeat-1.2.5.tar.gz) = d59b021af0e1cbaba56345cc67f6ef12
SHA256 (heartbeat-1.2.5.tar.gz) = 46f88a69324012317a4426dc93654ab28947b77675826686624d15cd5a4e357f
SIZE (heartbeat-1.2.5.tar.gz) = 2107371

View File

@ -1,17 +1,15 @@
#! /bin/sh
BATCH=${BATCH:=no}
base=%%PREFIX%%
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then
# pkg_add fails anyhow, if we do not create the user/group
if [ "x${BATCH}" = xno ]; then
read -p "${question} [${default}]? " answer
fi
if [ x${answer} = x ]; then
if [ "x${answer}" = x ]; then
answer=${default}
fi
echo ${answer}
@ -33,26 +31,22 @@ yesno() {
}
make_account() {
local u g gcos homeopt home
local u g uid gid
u=$1
g=$2
gcos=$3
homeopt=${4:+"-d $4"}
uid=$3
gid=$4
if pw group show "${g}" >/dev/null 2>&1; then
echo "You already have a group \"${g}\", so I will use it."
else
echo "You need a group \"${g}\"."
if which -s pw && yesno "Would you like me to create it" y; then
pw groupadd ${g} || exit
if yesno "Would you like me to create it" y; then
pw groupadd ${g} -g ${gid} || exit
echo "Done."
else
echo "Please create it, and try again."
if ! grep -q "^${u}:" /etc/passwd; then
echo "While you're at it, please create a user \"${u}\" too,"
echo "with a default group of \"${g}\"."
fi
echo "Please create it manually, and try again."
exit 1
fi
fi
@ -61,90 +55,52 @@ make_account() {
echo "You already have a user \"${u}\", so I will use it."
else
echo "You need a user \"${u}\"."
if which -s pw && yesno "Would you like me to create it" y; then
pw useradd ${u} -g ${g} -h - ${homeopt} \
-s /nonexistent -c "${gcos}" || exit
if yesno "Would you like me to create it" y; then
pw useradd ${u} -u ${uid} -g ${g} -h - -d /nonexistant \
-s /sbin/nologin -c "Heartbeat cluster user" || exit
echo "Done."
else
echo "Please create it, and try again."
exit 1
fi
fi
if [ x"$homeopt" = x ]; then
eval home=~${u}
if [ ! -d "${home}" ]; then
if yesno \
"Would you like me to create ${u}'s home directory (${home})" y
then
mkdir -p ${home} || exit
chown -R ${u}:${g} ${home} || exit
chmod -R go= ${home} || exit
else
echo "Please create it, and try again."
exit 1
fi
fi
fi
}
delete_account() {
local u g home
local u g
u=$1
g=$2
if yesno "Do you want me to remove group \"${g}\"" y; then
echo "Removing group \"${g}\""
pw groupdel -n ${g}
echo "Done."
fi
if yesno "Do you want me to remove user \"${u}\"" y; then
eval home=~${u}
echo "Removing user \"${u}\""
pw userdel -n ${u}
echo "Done."
if [ -d "${home}" ]; then
echo "Please remember to remove the home directory \"${home}\" as"
echo "well as the mirrored files."
fi
fi
}
case $2 in
POST-INSTALL)
if which -s pw && which -s lockf; then
:
else
cat <<EOF
This system looks like a pre-2.2 version of FreeBSD. I see that it
is missing the "lockf" and/or "pw" utilities. I need these utilities.
Please get them and install them, and try again. You can get the
sources from:
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.bin/lockf.tar.gz
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz
EOF
exit 1
fi
echo ""
user=hacluster
group=haclient
make_account ${user} ${group} "${user} ${group}" "/nonexistent"
uid=275
gid=275
make_account ${user} ${group} $uid $gid
echo "Adding empty dirs and pid file."
test -d ${base}/var/lib/heartbeat/ckpt || \
install -d -m 755 ${base}/var/lib/heartbeat/ckpt
test -d ${base}/var/lib/heartbeat/ccm || \
install -d -m 755 ${base}/var/lib/heartbeat/ccm
test -d ${base}/var/lock/subsys || \
install -d -m 755 ${base}/var/lock/subsys
test -d ${base}/etc/ha.d/conf || \
install -d -m 755 ${base}/etc/ha.d/conf
test -f ${base}/var/run/heartbeat.pid || \
test -d /var/lib/heartbeat/ckpt || \
install -d -m 755 /var/lib/heartbeat/ckpt
test -d /var/lock/subsys || \
install -d -m 755 /var/lock/subsys
test -f /var/run/heartbeat.pid || \
install -m 644 -o ${user} -g ${group} /dev/null \
${base}/var/run/heartbeat.pid
/var/run/heartbeat.pid
;;
DEINSTALL)
@ -161,14 +117,14 @@ DEINSTALL)
delete_account hacluster haclient
echo "Removing runtime files"
if [ -d ${base}/var/lib/heartbeat ]; then
rm -r ${base}/var/lib/heartbeat
if [ -d /var/lib/heartbeat ]; then
rm -r /var/lib/heartbeat
fi
if [ -f ${base}/var/lock/subsys/heartbeat ]; then
rm ${base}/var/lock/subsys/heartbeat
if [ -f /var/lock/subsys/heartbeat ]; then
rm /var/lock/subsys/heartbeat
fi
if [ -f ${base}/var/run/heartbeat.pid ]; then
rm ${base}/var/run/heartbeat.pid
if [ -f /var/run/heartbeat.pid ]; then
rm /var/run/heartbeat.pid
fi
;;
esac

View File

@ -271,6 +271,6 @@ sbin/supervise-ldirectord-config
@dirrmtry etc/ha.d/conf
@dirrmtry etc/ha.d
@cwd /
@dirrmtry var/lib/heartbeat/ckpt
@dirrmtry var/lib/heartbeat/ccm
@dirrmtry var/lib/heartbeat
@dirrmtry var/lock/subsys
@dirrmtry var/lock
@dirrmtry var/lib

View File

@ -6,7 +6,7 @@
#
PORTNAME= heartbeat
PORTVERSION= 1.2.4
PORTVERSION= 1.2.5
CATEGORIES= sysutils
MASTER_SITES= http://linux-ha.org/download/
@ -24,7 +24,9 @@ USE_GNOME= glib12
USE_LDCONFIG= yes
CONFIGURE_ARGS+= --disable-fatal-warnings \
--with-initdir=${PREFIX}/etc/rc.d
--with-initdir=${PREFIX}/etc/rc.d \
--localstatedir=/var \
--with-group-id=275 --with-ccmuser-id=275
SUB_FILES= pkg-install
PKGDEINSTALL= ${PKGINSTALL}
@ -63,11 +65,15 @@ post-patch:
${WRKSRC}/telecom/cms/Makefile.in
.endif
.if !defined(BATCH)
BATCH=no
.endif
post-deinstall:
@${SH} ${PKGINSTALL} ${PKGNAME} DEINSTALL
@BATCH=${BATCH} ${SH} ${PKGINSTALL} ${PKGNAME} DEINSTALL
post-install:
@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
@BATCH=${BATCH} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
# some subdirs treat man as documentation, therefor we have to install
# those man pages manually if NOPORTDOCS is defined

View File

@ -1,3 +1,3 @@
MD5 (heartbeat-1.2.4.tar.gz) = 7e3f752af06c25f7141c4b67a538e718
SHA256 (heartbeat-1.2.4.tar.gz) = cb2516a965582651859ab48a44dd8764332897ef9a81986a0aa25dc9306378cf
SIZE (heartbeat-1.2.4.tar.gz) = 2102978
MD5 (heartbeat-1.2.5.tar.gz) = d59b021af0e1cbaba56345cc67f6ef12
SHA256 (heartbeat-1.2.5.tar.gz) = 46f88a69324012317a4426dc93654ab28947b77675826686624d15cd5a4e357f
SIZE (heartbeat-1.2.5.tar.gz) = 2107371

View File

@ -1,17 +1,15 @@
#! /bin/sh
BATCH=${BATCH:=no}
base=%%PREFIX%%
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then
# pkg_add fails anyhow, if we do not create the user/group
if [ "x${BATCH}" = xno ]; then
read -p "${question} [${default}]? " answer
fi
if [ x${answer} = x ]; then
if [ "x${answer}" = x ]; then
answer=${default}
fi
echo ${answer}
@ -33,26 +31,22 @@ yesno() {
}
make_account() {
local u g gcos homeopt home
local u g uid gid
u=$1
g=$2
gcos=$3
homeopt=${4:+"-d $4"}
uid=$3
gid=$4
if pw group show "${g}" >/dev/null 2>&1; then
echo "You already have a group \"${g}\", so I will use it."
else
echo "You need a group \"${g}\"."
if which -s pw && yesno "Would you like me to create it" y; then
pw groupadd ${g} || exit
if yesno "Would you like me to create it" y; then
pw groupadd ${g} -g ${gid} || exit
echo "Done."
else
echo "Please create it, and try again."
if ! grep -q "^${u}:" /etc/passwd; then
echo "While you're at it, please create a user \"${u}\" too,"
echo "with a default group of \"${g}\"."
fi
echo "Please create it manually, and try again."
exit 1
fi
fi
@ -61,90 +55,52 @@ make_account() {
echo "You already have a user \"${u}\", so I will use it."
else
echo "You need a user \"${u}\"."
if which -s pw && yesno "Would you like me to create it" y; then
pw useradd ${u} -g ${g} -h - ${homeopt} \
-s /nonexistent -c "${gcos}" || exit
if yesno "Would you like me to create it" y; then
pw useradd ${u} -u ${uid} -g ${g} -h - -d /nonexistant \
-s /sbin/nologin -c "Heartbeat cluster user" || exit
echo "Done."
else
echo "Please create it, and try again."
exit 1
fi
fi
if [ x"$homeopt" = x ]; then
eval home=~${u}
if [ ! -d "${home}" ]; then
if yesno \
"Would you like me to create ${u}'s home directory (${home})" y
then
mkdir -p ${home} || exit
chown -R ${u}:${g} ${home} || exit
chmod -R go= ${home} || exit
else
echo "Please create it, and try again."
exit 1
fi
fi
fi
}
delete_account() {
local u g home
local u g
u=$1
g=$2
if yesno "Do you want me to remove group \"${g}\"" y; then
echo "Removing group \"${g}\""
pw groupdel -n ${g}
echo "Done."
fi
if yesno "Do you want me to remove user \"${u}\"" y; then
eval home=~${u}
echo "Removing user \"${u}\""
pw userdel -n ${u}
echo "Done."
if [ -d "${home}" ]; then
echo "Please remember to remove the home directory \"${home}\" as"
echo "well as the mirrored files."
fi
fi
}
case $2 in
POST-INSTALL)
if which -s pw && which -s lockf; then
:
else
cat <<EOF
This system looks like a pre-2.2 version of FreeBSD. I see that it
is missing the "lockf" and/or "pw" utilities. I need these utilities.
Please get them and install them, and try again. You can get the
sources from:
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.bin/lockf.tar.gz
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz
EOF
exit 1
fi
echo ""
user=hacluster
group=haclient
make_account ${user} ${group} "${user} ${group}" "/nonexistent"
uid=275
gid=275
make_account ${user} ${group} $uid $gid
echo "Adding empty dirs and pid file."
test -d ${base}/var/lib/heartbeat/ckpt || \
install -d -m 755 ${base}/var/lib/heartbeat/ckpt
test -d ${base}/var/lib/heartbeat/ccm || \
install -d -m 755 ${base}/var/lib/heartbeat/ccm
test -d ${base}/var/lock/subsys || \
install -d -m 755 ${base}/var/lock/subsys
test -d ${base}/etc/ha.d/conf || \
install -d -m 755 ${base}/etc/ha.d/conf
test -f ${base}/var/run/heartbeat.pid || \
test -d /var/lib/heartbeat/ckpt || \
install -d -m 755 /var/lib/heartbeat/ckpt
test -d /var/lock/subsys || \
install -d -m 755 /var/lock/subsys
test -f /var/run/heartbeat.pid || \
install -m 644 -o ${user} -g ${group} /dev/null \
${base}/var/run/heartbeat.pid
/var/run/heartbeat.pid
;;
DEINSTALL)
@ -161,14 +117,14 @@ DEINSTALL)
delete_account hacluster haclient
echo "Removing runtime files"
if [ -d ${base}/var/lib/heartbeat ]; then
rm -r ${base}/var/lib/heartbeat
if [ -d /var/lib/heartbeat ]; then
rm -r /var/lib/heartbeat
fi
if [ -f ${base}/var/lock/subsys/heartbeat ]; then
rm ${base}/var/lock/subsys/heartbeat
if [ -f /var/lock/subsys/heartbeat ]; then
rm /var/lock/subsys/heartbeat
fi
if [ -f ${base}/var/run/heartbeat.pid ]; then
rm ${base}/var/run/heartbeat.pid
if [ -f /var/run/heartbeat.pid ]; then
rm /var/run/heartbeat.pid
fi
;;
esac

View File

@ -271,6 +271,6 @@ sbin/supervise-ldirectord-config
@dirrmtry etc/ha.d/conf
@dirrmtry etc/ha.d
@cwd /
@dirrmtry var/lib/heartbeat/ckpt
@dirrmtry var/lib/heartbeat/ccm
@dirrmtry var/lib/heartbeat
@dirrmtry var/lock/subsys
@dirrmtry var/lock
@dirrmtry var/lib