Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Jan 2005 16:12:37 +0100 (CET)
From:      domi@saargate.de
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/76816: new port: security/sophie
Message-ID:  <200501291512.QAA34642@watcher.saargate.de>
Resent-Message-ID: <200501291520.j0TFKFCY073714@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         76816
>Category:       ports
>Synopsis:       new port: security/sophie
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 29 15:20:15 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Dominik Brettnacher
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
>Environment:

>Description:


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	sophie
#	sophie/Makefile
#	sophie/distinfo
#	sophie/pkg-descr
#	sophie/pkg-plist
#	sophie/files
#	sophie/files/patch-aa
#	sophie/files/patch-ab
#	sophie/files/sophie.sh
#
echo c - sophie
mkdir -p sophie > /dev/null 2>&1
echo x - sophie/Makefile
sed 's/^X//' >sophie/Makefile << 'END-of-sophie/Makefile'
X# New ports collection makefile for:	sophie
X# Date created:			Fri Jan 28 20:49:29 GMT 2005
X# Whom:				Dominik Brettnacher <domi@saargate.de>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	sophie
XPORTVERSION=	3.04rc2
XCATEGORIES=	security
XMASTER_SITES=	http://www.vanja.com/tools/sophie/
X
XMAINTAINER=	domi@saargate.de
XCOMMENT=	a daemon which uses libsavi library from Sophos anti virus
X
XMAN8=		sophie.8
X
XGNU_CONFIGURE=	yes
XUSE_REINPLACE=	yes
X
Xpost-patch:
X	@${REINPLACE_CMD} -i.orig -e "s|/usr/local/etc/sophie.cfg|${PREFIX}/etc/sophie.cfg|g" ${WRKSRC}/sophie.c
X	@${REINPLACE_CMD} -i.orig -e "s|@def_savi_config@|${PREFIX}/etc/sophie.savi|g" ${WRKSRC}/sophie.cfg.in
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/sophie ${PREFIX}/bin/sophie
X	${INSTALL_MAN} ${WRKSRC}/sophie.8 ${MAN8PREFIX}/man/man8
X	${INSTALL_DATA} ${WRKSRC}/sophie.cfg ${PREFIX}/etc/sophie.cfg-dist
X	[ -f ${PREFIX}/etc/sophie.cfg ] || cp ${PREFIX}/etc/sophie.cfg-dist ${PREFIX}/etc/sophie.cfg
X	${INSTALL_DATA} ${WRKSRC}/etc/sophie.savi ${PREFIX}/etc/sophie.savi-dist
X	[ -f ${PREFIX}/etc/sophie.savi ] || cp ${PREFIX}/etc/sophie.savi-dist ${PREFIX}/etc/sophie.savi
X	${INSTALL_SCRIPT} ${FILESDIR}/sophie.sh ${PREFIX}/etc/rc.d/sophie.sh
X
X.if !defined(NOPORTDOCS)
X	${MKDIR} ${DOCSDIR}
X	${INSTALL_MAN} ${WRKSRC}/README ${DOCSDIR}
X	${INSTALL_MAN} ${WRKSRC}/README.NETWORK ${DOCSDIR}
X.endif
X
X.include <bsd.port.mk>
END-of-sophie/Makefile
echo x - sophie/distinfo
sed 's/^X//' >sophie/distinfo << 'END-of-sophie/distinfo'
XMD5 (sophie-3.04rc2.tar.gz) = b1461232ce0788c7a9227bec72577a9f
XSIZE (sophie-3.04rc2.tar.gz) = 146638
END-of-sophie/distinfo
echo x - sophie/pkg-descr
sed 's/^X//' >sophie/pkg-descr << 'END-of-sophie/pkg-descr'
XSophie is a daemon which uses 'libsavi' library from Sophos anti virus.
X
XOn startup, Sophie initializes SAVI (Sophos Anti-Virus Interface), loads virus 
Xpatterns into memory, opens a local UNIX domain socket (or a TCP socket), and 
Xwaits for someone to connect and instructs it which path to scan. Since it is 
Xloaded in RAM, scanning is very fast. Of course, speed of scanning also 
Xdepends on SAVI settings and size of the file. 
X
XWWW: http://www.vanja.com/tools/sophie/
END-of-sophie/pkg-descr
echo x - sophie/pkg-plist
sed 's/^X//' >sophie/pkg-plist << 'END-of-sophie/pkg-plist'
Xbin/sophie
X@unexec if cmp -s %D/etc/sophie.cfg %D/etc/sophie.cfg-dist; then rm -f %D/etc/sophie.cfg; fi
Xetc/sophie.cfg-dist
X@exec [ -f %B/sophie.cfg ] || cp %B/%f %B/sophie.cfg
X@unexec if cmp -s %D/etc/sophie.savi %D/etc/sophie.savi-dist; then rm -f %D/etc/sophie.savi; fi
Xetc/sophie.savi-dist
X@exec [ -f %B/sophie.savi ] || cp %B/%f %B/sophie.savi
Xetc/rc.d/sophie.sh
X%%PORTDOCS%%%%DOCSDIR%%/README
X%%PORTDOCS%%%%DOCSDIR%%/README.NETWORK
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
END-of-sophie/pkg-plist
echo c - sophie/files
mkdir -p sophie/files > /dev/null 2>&1
echo x - sophie/files/patch-aa
sed 's/^X//' >sophie/files/patch-aa << 'END-of-sophie/files/patch-aa'
X--- sophie_init.c.orig	Tue Jan 27 17:04:34 2004
X+++ sophie_init.c	Sun Dec 12 16:40:45 2004
X@@ -10,6 +10,13 @@
X static int parse_config(char *line, char *option, int option_size, char *value, int value_size);
X static void sophie_savi_set_defaults(void);
X 
X+const char* const STRING_OPTIONS[] = {
X+	"IdeDir",
X+	"VirusDataDir",
X+	"VirusDataName"};
X+
X+const char* const U16_OPTIONS[] = {
X+	"MaxRecursionDepth"};
X 
X CISavi3 *pSAVI;
X 
X@@ -597,10 +604,31 @@
X 		sophie_print(1, "%s Default SAVI configuration options set", NOTESTR);
X }
X 
X+static int determineSType(char *option) {
X+	int i;
X+	
X+	if (STRNCMP(option, "Grp", 3)) {
X+		return SOPHOS_TYPE_OPTION_GROUP;
X+	}
X+	
X+	for (i = 0; i < sizeof(STRING_OPTIONS) / sizeof(char*); i++) {
X+		if (strcmp(option, STRING_OPTIONS[i]) == 0) {
X+			return SOPHOS_TYPE_STRING;
X+		}
X+	}
X+	
X+	for (i = 0; i < sizeof(U16_OPTIONS) / sizeof(char*); i++) {
X+		if (strcmp(option, U16_OPTIONS[i]) == 0) {
X+			return SOPHOS_TYPE_U16;
X+		}
X+	}
X+	
X+	return SOPHOS_TYPE_U32;
X+}
X+
X void sophie_set_engine_config(CISavi3 *pSAVI)
X {
X 	FILE *cfg;
X-	int stype;
X 	char cfgbuf[128];
X 	char option[64];
X 	char value[256]; /* if someone gives really long path, for example */
X@@ -638,20 +666,9 @@
X 	{
X 		if (parse_config(cfgbuf, option, sizeof(option), value, sizeof(value)))
X 		{
X-			/* FIXME: At this point, we'll only set the config options that take int as a value. */
X-			/* String options will be added later, if needed (for VirusDataDir, VirusDataName and IdeDir) */
X-
X 			/* Set the configuration option */
X 		
X-			/* Crap... */
X-			if (STRNCMP(option, "MaxRecursionDepth", 17))
X-				stype = SOPHOS_TYPE_U16;
X-			else if (STRNCMP(option, "Grp", 3))
X-				stype = SOPHOS_TYPE_OPTION_GROUP;
X-			else
X-				stype = SOPHOS_TYPE_U32;
X-
X-			hr = pSAVI->pVtbl->SetConfigValue(pSAVI, option, stype, value);
X+			hr = pSAVI->pVtbl->SetConfigValue(pSAVI, option, determineSType(option), value);
X 			if (SOPHOS_FAILED(hr))
X 				sophie_print(0, "%s Unable to setup configuration value '%s' to '%s'", WARNSTR, option, value);
X 			else
END-of-sophie/files/patch-aa
echo x - sophie/files/patch-ab
sed 's/^X//' >sophie/files/patch-ab << 'END-of-sophie/files/patch-ab'
X--- sophie.cfg.in.orig	Sat Jan 29 15:33:25 2005
X+++ sophie.cfg.in	Sat Jan 29 15:33:36 2005
X@@ -40,12 +40,12 @@
X # User to run Sophie as
X #
X # Change requires: RESTART
X-user: mail
X+user: nobody
X 
X # Group to run Sophie as
X #
X # Change requires: RESTART
X-group: mail
X+group: nogroup
X 
X # Scanning timeout (in seconds)
X # If Sophie child doesn't finish scanning a file within this timeframe,
END-of-sophie/files/patch-ab
echo x - sophie/files/sophie.sh
sed 's/^X//' >sophie/files/sophie.sh << 'END-of-sophie/files/sophie.sh'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
X#
X# Add the following lines to /etc/rc.conf to enable sophie:
X#
X#sophie_enable="YES"
X#
X# See sophie(8) for flags
X#
X
X. /usr/local/etc/rc.subr
X
Xname=sophie
Xrcvar=`set_rcvar`
X
Xcommand=/usr/local/bin/sophie
X
Xstop_postcmd=stop_postcmd
X
Xstop_postcmd()
X{
X  rm -f $pidfile
X}
X
X# set defaults
X
Xsophie_enable=${sophie_enable:-"NO"}
Xsophie_pidfile=${sophie_pidfile:-"/var/run/sophie.pid"}
Xsophie_flags=${sophie_flags:-"-D"}
X
Xload_rc_config $name
Xrun_rc_command "$1"
END-of-sophie/files/sophie.sh
exit


>How-To-Repeat:


>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501291512.QAA34642>