Simplify the WITH_SETUID option by using
GROUPS, rather than PKG[DE]INSTALL scripts
This commit is contained in:
parent
14ed37f49b
commit
93d84d3172
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=274406
4 changed files with 6 additions and 87 deletions
|
@ -51,20 +51,12 @@ CONFIGURE_ARGS+=--disable-pcre
|
|||
.endif
|
||||
|
||||
.ifdef(WITH_SETUID)
|
||||
KISMET_GROUP?= kismet
|
||||
CONFIGURE_ARGS+=--with-suidgroup=${KISMET_GROUP}
|
||||
GROUPS = kismet
|
||||
CONFIGURE_ARGS+=--with-suidgroup=${GROUPS}
|
||||
INSTALL_TARGET = suidinstall
|
||||
PLIST_SUB+= SUID=""
|
||||
PKGINSTALL= ${PKGDIR}/suid_pkg-install
|
||||
PKGDEINSTALL = ${PKGDIR}/suid_pkg-deinstall
|
||||
PKGMESSAGE= ${WRKDIR}/suid_pkg-message
|
||||
SUB_FILES+= suid_pkg-message
|
||||
SUB_LIST+= KISMET_GROUP=${KISMET_GROUP}
|
||||
|
||||
pre-su-install:
|
||||
@${SETENV} PKG_PREFIX=${PREFIX} ${SH} \
|
||||
${PKGINSTALL} ${PKGNAME} PRE-INSTALL
|
||||
|
||||
.else
|
||||
INSTALL_TARGET = install
|
||||
CONFIGURE_ARGS+=--without-suidgroup
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Kismet has been installed with a setuid-root capture helper binary,
|
||||
kismet has been installed with a setuid-root capture helper binary,
|
||||
%%LOCALBASE%%/bin/kismet_capture, which may be executed by users in the
|
||||
group %%KISMET_GROUP%%. USERS IN THIS GROUP WILL BE ABLE TO ALTER NETWORK
|
||||
INTERFACE STATES, but this is more secure than running all of Kismet
|
||||
as root. ONLY users in this group will be able to run Kismet and capture
|
||||
kismet group. USERS IN THIS GROUP WILL BE ABLE TO ALTER NETWORK
|
||||
INTERFACE STATES, but this is more secure than running all of kismet
|
||||
as root. ONLY users in this group will be able to run kismet and capture
|
||||
from physical network devices.
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# taken from net/cvsup-mirror
|
||||
|
||||
PATH=/bin:/usr/sbin
|
||||
KISMET_GROUP=${KISMET_GROUP:-kismet}
|
||||
|
||||
ask() {
|
||||
local question default answer
|
||||
|
||||
question=$1
|
||||
default=$2
|
||||
if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
|
||||
read -p "${question} [${default}]? " answer
|
||||
fi
|
||||
if [ x${answer} = x ]; then
|
||||
answer=${default}
|
||||
fi
|
||||
echo ${answer}
|
||||
}
|
||||
|
||||
yesno() {
|
||||
local dflt question answer
|
||||
|
||||
question=$1
|
||||
dflt=$2
|
||||
while :; do
|
||||
answer=$(ask "${question}" "${dflt}")
|
||||
case "${answer}" in
|
||||
[Yy]*) return 0;;
|
||||
[Nn]*) return 1;;
|
||||
esac
|
||||
echo "Please answer yes or no."
|
||||
done
|
||||
}
|
||||
|
||||
delete_group() {
|
||||
local g
|
||||
|
||||
g=$1
|
||||
if yesno "Do you want me to remove group \"${g}\"" y; then
|
||||
pw groupdel -n ${g}
|
||||
echo "Done."
|
||||
fi
|
||||
}
|
||||
|
||||
if [ x$2 != xDEINSTALL ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
delete_group ${KISMET_GROUP}
|
|
@ -1,22 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
PATH=/bin:/usr/sbin
|
||||
KISMET_GROUP=${KISMET_GROUP:-kismet}
|
||||
KISMET_GID=${KISMET_GID:-229}
|
||||
|
||||
case $2 in
|
||||
PRE-INSTALL)
|
||||
|
||||
if pw group show "${KISMET_GROUP}" 2>/dev/null; then
|
||||
echo "You already have a group \"${KISMET_GROUP}\", so I will use it."
|
||||
else
|
||||
if pw groupadd ${KISMET_GROUP} -g ${KISMET_GID}; then
|
||||
echo "Added group \"${KISMET_GROUP}\"."
|
||||
else
|
||||
echo "Adding group \"${KISMET_GROUP}\" failed..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue