Skip to content

Commit

Permalink
* Sets up a uhub UID and GID for the daemon to run as.
Browse files Browse the repository at this point in the history
* Modifies configuration file permissions to restrict them to root and the above
  GID.
* Patches uhub source so that PREFIX/etc/uhub/uhub.conf is the compiled in
  default configuration file.
* rc.d script changes - enable above uid/gid, enable syslog logging, simplify.

PR:		151819
Submitted by:	Aragon Gouveia <aragon@phat.za.net>
Approved by:	maintainer
  • Loading branch information
swltr committed Nov 11, 2010
1 parent 6c46ce5 commit c4ef5ec
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
3 changes: 2 additions & 1 deletion GIDs
@@ -1,4 +1,4 @@
# $FreeBSD: ports/GIDs,v 1.112 2010/11/07 12:37:41 fjoe Exp $
# $FreeBSD: ports/GIDs,v 1.113 2010/11/07 17:46:58 fjoe Exp $
# Please keep this file sorted by GID!
smmsp:*:25:
bind:*:53:
Expand Down Expand Up @@ -119,6 +119,7 @@ _iodined:*:353:
httptunnel:*:361:
ldap:*:389:
tiarra:*:398:
uhub:*:411:
drweb:*:426:
callweaver:*:444:
courier:*:465:
Expand Down
3 changes: 2 additions & 1 deletion UIDs
@@ -1,4 +1,4 @@
# $FreeBSD: ports/UIDs,v 1.125 2010/11/07 02:38:01 nork Exp $
# $FreeBSD: ports/UIDs,v 1.126 2010/11/07 12:27:54 fjoe Exp $
# Please keep this file sorted by UID!
smmsp:*:25:25::0:0:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin
bind:*:53:53::0:0:Bind Sandbox:/:/usr/sbin/nologin
Expand Down Expand Up @@ -129,6 +129,7 @@ _iodined:*:353:353::0:0:Iodine Daemon:/nonexistent:/usr/sbin/nologin
httptunnel:*:361:361::0:0:httptunnel Daemon:/nonexistent:/usr/sbin/nologin
ldap:*:389:389::0:0:OpenLDAP Server:/nonexistent:/usr/sbin/nologin
tiarra:*:398:398::0:0:Tiarra IRC Proxy:/nonexistent:/usr/sbin/nologin
uhub:*:411:411::0:0:uHub ADC Daemon:/nonexistent:/usr/sbin/nologin
drweb:*:426:426::0:0:Dr.Web Mail Scanner:/nonexistent:/usr/sbin/nologin
callweaver:*:444:444::0:0:Callweaver account:/var/lib/callweaver:/usr/sbin/nologin
courier:*:465:465::0:0:Courier Mail Server:/nonexistent:/usr/sbin/nologin
Expand Down
23 changes: 15 additions & 8 deletions net-p2p/uhub/Makefile
Expand Up @@ -7,7 +7,7 @@

PORTNAME= uhub
PORTVERSION= 0.3.2
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= net-p2p
MASTER_SITES= http://www.extatic.org/downloads/uhub/
DISTNAME= ${PORTNAME}-${PORTVERSION}-src
Expand All @@ -19,6 +19,10 @@ USE_PERL5_BUILD=yes
USE_GMAKE= yes

USE_RC_SUBR= uhub.sh
USERS= uhub
GROUPS= uhub
SHAREGRP= uhub
SHAREMODE= 640

WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
MAKEFILE= ${WRKSRC}/GNUmakefile
Expand All @@ -36,15 +40,18 @@ LDFLAGS+= -L${OPENSSLLIB}

post-patch:
@${REINPLACE_CMD} -e 's|/etc/uhub/|${PREFIX}&|' ${WRKSRC}/doc/uhub.conf
@${REINPLACE_CMD} -e 's|/etc/uhub/|${PREFIX}&|' ${WRKSRC}/src/uhub.h

post-install:
do-install:
@${INSTALL_PROGRAM} ${WRKSRC}/uhub ${PREFIX}/bin/uhub
@${MKDIR} ${PREFIX}/etc/uhub
@${INSTALL_DATA} ${WRKSRC}/doc/uhub.conf ${PREFIX}/etc/uhub/uhub.conf.sample
@${INSTALL_DATA} ${WRKSRC}/doc/users.conf ${PREFIX}/etc/uhub/users.conf.sample
@if [ -f ${PREFIX}/etc/uhub/motd.txt ]; then \
${TOUCH} ${PREFIX}/etc/uhub/motd.txt.sample ; \
fi
@if [ -f ${PREFIX}/etc/uhub/rules.txt ]; then \
${TOUCH} ${PREFIX}/etc/uhub/rules.txt.sample ; \
fi
@${INSTALL_DATA} /dev/null ${PREFIX}/etc/uhub/motd.txt.sample
@${INSTALL_DATA} /dev/null ${PREFIX}/etc/uhub/rules.txt.sample
.for i in uhub.conf users.conf motd.txt rules.txt
@[ ! -f ${PREFIX}/etc/uhub/${i} ] \
&& cp -p ${PREFIX}/etc/uhub/${i}.sample ${PREFIX}/etc/uhub/${i}
.endfor

.include <bsd.port.post.mk>
12 changes: 5 additions & 7 deletions net-p2p/uhub/files/uhub.sh.in
@@ -1,6 +1,6 @@
#!/bin/sh
#
# $FreeBSD: ports/net-p2p/uhub/files/uhub.sh.in,v 1.1 2009/11/11 16:43:59 amdmi3 Exp $
# $FreeBSD: ports/net-p2p/uhub/files/uhub.sh.in,v 1.2 2010/03/27 00:14:31 dougb Exp $
#
# PROVIDE: uhub
# REQUIRE: DAEMON
Expand All @@ -11,8 +11,6 @@
#
# uhub_enable (bool): Set it to "YES" to enable uhub
# Default is "NO".
# uhub_conf (path): Set full path to config file.
# Default is "%%PREFIX%%/etc/uhub/uhub.conf".
# uhub_pidfile (path): Set full path to pid file.
# Default is "/var/run/uhub.pid".
#
Expand All @@ -24,12 +22,12 @@ rcvar=`set_rcvar`

load_rc_config $name

: ${uhub_enable="NO"}
: ${uhub_conf="%%PREFIX%%/etc/uhub/uhub.conf"}
: ${uhub_pidfile="/var/run/${name}.pid"}
: ${uhub_enable:="NO"}
: ${uhub_flags:="-L -u uhub -g uhub"}
: ${uhub_pidfile:="/var/run/${name}.pid"}

command=%%PREFIX%%/bin/uhub
command_args="-fq -c ${uhub_conf} -p ${uhub_pidfile}"
command_args="-f -p ${uhub_pidfile}"
pidfile=${uhub_pidfile}
required_files=${uhub_conf}
stop_postcmd=stop_postcmd
Expand Down

0 comments on commit c4ef5ec

Please sign in to comment.