aboutsummaryrefslogtreecommitdiff
path: root/security/trousers
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2013-07-27 04:24:14 +0000
committerHiroki Sato <hrs@FreeBSD.org>2013-07-27 04:24:14 +0000
commit2915c6da80db36bc399bb7a38329cc978fcb0261 (patch)
treef8a971148445b261aead10bcdc0748d6720b6069 /security/trousers
parent70f644326c13ed5544419e5cdddd8cff6aae7eb6 (diff)
downloadports-2915c6da80db36bc399bb7a38329cc978fcb0261.tar.gz
ports-2915c6da80db36bc399bb7a38329cc978fcb0261.zip
Notes
Diffstat (limited to 'security/trousers')
-rw-r--r--security/trousers/Makefile57
-rw-r--r--security/trousers/distinfo4
-rw-r--r--security/trousers/files/patch-src-tcsd-svrside.c99
-rw-r--r--security/trousers/files/patch-src-tspi-Makefile.am8
-rw-r--r--security/trousers/files/patch-src-tspi-ps-tspps.c42
-rw-r--r--security/trousers/pkg-plist4
6 files changed, 87 insertions, 127 deletions
diff --git a/security/trousers/Makefile b/security/trousers/Makefile
index c6da30051f87..db5c769abdf5 100644
--- a/security/trousers/Makefile
+++ b/security/trousers/Makefile
@@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= trousers
-PORTVERSION= 0.3.6
-PORTREVISION= 3
+PORTVERSION= 0.3.10
CATEGORIES= security
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTVERSION}
@@ -21,45 +20,36 @@ USE_OPENSSL= YES
USE_LDCONFIG= YES
USE_AUTOTOOLS= autoconf automake libtool
USE_RC_SUBR= tcsd
+WRKSRC= ${WRKDIR}/${DISTNAME}
GNU_CONFIGURE= YES
+CONFIGURE_ARGS= --with-gui=none --enable-static \
+ --localstatedir=${PREFIX}/var \
+ --with-tssuser=${USERS} --with-tssgroup=${GROUPS}
MAKE_JOBS_SAFE= YES
SUB_FILES= pkg-message
SUB_LIST= USERS=${USERS} GROUPS=${GROUPS}
-
USERS= _tss
GROUPS= _tss
+PORTEXAMPLES= tcsd.conf
-.include "Makefile.man"
-
-CONFIGURE_ARGS= --with-gui=none --enable-static \
- --localstatedir=${PREFIX}/var \
- --with-tssuser=${USERS} --with-tssgroup=${GROUPS}
-
-OPTIONS_DEFINE= EMULATOR DEBUG
+OPTIONS_DEFINE= EMULATOR EXAMPLES DEBUG
EMULATOR_DESC= Build for use with the tpm-emulator
-WRKSRC= ${WRKDIR}/${DISTNAME}
-
+.include "Makefile.man"
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MEMULATOR}
PKGNAMESUFFIX+= -no_tddl
LIB_DEPENDS+= tddl.1:${PORTSDIR}/emulators/tpm-emulator
-post-patch:
- @${REINPLACE_CMD} -e \
- 's|$${top_builddir}/src/tddl/libtddl.a|${LOCALBASE}/lib/libtddl.a|' \
- ${WRKSRC}/src/tcs/Makefile.am \
- ${WRKSRC}/src/tcsd/Makefile.am
- @${REINPLACE_CMD} -e \
- 's|libtddl\.a||g' \
- ${WRKSRC}/src/tddl/Makefile.am
-
+EXTRA_PATCHES= ${FILESDIR}/extra-patch-src-tcs-Makefile.am \
+ ${FILESDIR}/extra-patch-src-tcsd-Makefile.am \
+ ${FILESDIR}/extra-patch-src-tddl-Makefile.am
# The emulator has already a libttddl.so, so comment out trousers' libtddl in the pkg-plist
PLIST_SUB+= TDDL="@comment "
.else
PKGNAMESUFFIX+= -tddl
-CONFLICTS+= tpm-emulator-0*
+CONFLICTS+= tpm-emulator-[0-9]*
PLIST_SUB+= TDDL=""
.endif
@@ -72,22 +62,29 @@ run-autotools: run-autotools-autoreconf
run-autotools-autoreconf:
@cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTORECONF} -i
-post-install:
+.if ${PORT_OPTIONS:MEXAMPLES}
+post-install: install-examples
+.endif
+
+install-examples:
@${MKDIR} ${EXAMPLESDIR}
- @${INSTALL_DATA} -o ${USERS} -g ${GROUPS} -m 0600 \
+ ${INSTALL_DATA} -o ${USERS} -g ${GROUPS} -m 0600 \
${WRKSRC}/dist/tcsd.conf ${EXAMPLESDIR}/tcsd.conf
+
+post-install:
@[ -f ${PREFIX}/etc/tcsd.conf ] || \
- ${CP} -p ${EXAMPLESDIR}/tcsd.conf ${PREFIX}/etc/tcsd.conf
+ ${INSTALL_DATA} ${EXAMPLESDIR}/tcsd.conf ${PREFIX}/etc/tcsd.conf
@${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 /var/run/tpm
@${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 /var/run/ima
@${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 ${PREFIX}/var/lib/tpm
@${CAT} ${PKGMESSAGE}
add-plist-post:
- @${ECHO_CMD} "@cwd /" >> ${TMPPLIST}
- @${ECHO_CMD} "@unexec ${RMDIR} var/run/tpm 2>/dev/null || true" >> ${TMPPLIST}
- @${ECHO_CMD} "@exec ${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 var/run/tpm" >> ${TMPPLIST}
- @${ECHO_CMD} "@unexec ${RMDIR} var/run/ima 2>/dev/null || true" >> ${TMPPLIST}
- @${ECHO_CMD} "@exec ${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 var/run/ima" >> ${TMPPLIST}
+ @(${ECHO_CMD} "@cwd /"; \
+ ${ECHO_CMD} "@unexec ${RMDIR} var/run/tpm 2>/dev/null || true"; \
+ ${ECHO_CMD} "@exec ${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 var/run/tpm"; \
+ ${ECHO_CMD} "@unexec ${RMDIR} var/run/ima 2>/dev/null || true"; \
+ ${ECHO_CMD} "@exec ${INSTALL} -d -o ${USERS} -g ${GROUPS} -m 0700 var/run/ima"; \
+ ) >> ${TMPPLIST}
.include <bsd.port.mk>
diff --git a/security/trousers/distinfo b/security/trousers/distinfo
index ec38fc52a373..c37c1d73a449 100644
--- a/security/trousers/distinfo
+++ b/security/trousers/distinfo
@@ -1,2 +1,2 @@
-SHA256 (trousers-0.3.6.tar.gz) = 91025f60248af44df192e8df16fa6b0c0f1e48c54f6dc51626567ed95758b0d6
-SIZE (trousers-0.3.6.tar.gz) = 1335084
+SHA256 (trousers-0.3.10.tar.gz) = eb9569de5c66d9698f6c3303de03777b95ec72827f68b7744454bfa9227bc530
+SIZE (trousers-0.3.10.tar.gz) = 1658652
diff --git a/security/trousers/files/patch-src-tcsd-svrside.c b/security/trousers/files/patch-src-tcsd-svrside.c
index 1edc2996c65f..bc06646ec1a9 100644
--- a/security/trousers/files/patch-src-tcsd-svrside.c
+++ b/security/trousers/files/patch-src-tcsd-svrside.c
@@ -1,5 +1,5 @@
---- src/tcsd/svrside.c.orig 2010-06-10 05:19:00.000000000 +0900
-+++ src/tcsd/svrside.c 2010-10-24 21:04:04.838555802 +0900
+--- src/tcsd/svrside.c.orig 2012-09-25 23:23:01.000000000 +0900
++++ src/tcsd/svrside.c 2013-07-27 04:04:45.000000000 +0900
@@ -20,7 +20,6 @@
#include <sys/stat.h>
#include <sys/socket.h>
@@ -8,75 +8,55 @@
#if (defined (__OpenBSD__) || defined (__FreeBSD__))
#include <netinet/in.h>
#endif
-@@ -41,11 +40,9 @@
-
- struct tcsd_config tcsd_options;
- struct tpm_properties tpm_metrics;
--static volatile int hup = 0, term = 0;
--extern char *optarg;
-
--static void
--tcsd_shutdown(void)
-+void
-+tcsd_shutdown()
- {
- /* order is important here:
- * allow all threads to complete their current request */
-@@ -57,27 +54,44 @@
- EVENT_LOG_final();
+@@ -72,6 +71,32 @@
+ hup = 1;
}
--static void
--tcsd_signal_term(int signal)
+void
+tcsd_signal_int(int signal)
- {
-- term = 1;
++{
+ switch (signal) {
-+ case SIGINT:
-+ LogInfo("Caught SIGINT. Cleaning up and exiting.");
-+ break;
-+ case SIGHUP:
-+ LogInfo("Caught SIGHUP. Cleaning up and exiting.");
-+ break;
-+ default:
-+ LogError("Caught signal %d (which I didn't register for!)."
-+ " Ignoring.", signal);
-+ break;
++ case SIGINT:
++ LogInfo("Caught SIGINT. Cleaning up and exiting.");
++ break;
++ case SIGHUP:
++ LogInfo("Caught SIGHUP. Cleaning up and exiting.");
++ break;
++ default:
++ LogError("Caught signal %d (which I didn't register for!)."
++ " Ignoring.", signal);
++ break;
+ }
+ tcsd_shutdown();
+ exit(signal);
- }
-
- void
--tcsd_signal_hup(int signal)
++}
++
++void
+tcsd_signal_chld(int signal)
- {
-- hup = 1;
-+ /* kill zombies */
++{
++
+ wait3(NULL, WNOHANG, NULL);
- }
-
--static TSS_RESULT
--signals_init(void)
-+TSS_RESULT
-+signals_init()
++}
++
+ static TSS_RESULT
+ signals_init(void)
{
- int rc;
- sigset_t sigmask;
-- struct sigaction sa;
+@@ -80,6 +105,14 @@
+ struct sigaction sa;
sigemptyset(&sigmask);
-- if ((rc = sigaddset(&sigmask, SIGTERM))) {
+ if ((rc = sigaddset(&sigmask, SIGCHLD))) {
+ LogError("sigaddset: %s", strerror(errno));
+ return TCSERR(TSS_E_INTERNAL_ERROR);
+ }
+ if ((rc = sigaddset(&sigmask, SIGINT))) {
++ LogError("sigaddset: %s", strerror(errno));
++ return TCSERR(TSS_E_INTERNAL_ERROR);
++ }
+ if ((rc = sigaddset(&sigmask, SIGTERM))) {
LogError("sigaddset: %s", strerror(errno));
return TCSERR(TSS_E_INTERNAL_ERROR);
- }
-@@ -91,25 +105,30 @@
+@@ -94,25 +127,30 @@
return TCSERR(TSS_E_INTERNAL_ERROR);
}
@@ -116,7 +96,7 @@
{
TSS_RESULT result;
-@@ -183,7 +202,6 @@
+@@ -186,7 +224,6 @@
return TSS_SUCCESS;
}
@@ -124,7 +104,7 @@
void
usage(void)
{
-@@ -195,19 +213,6 @@
+@@ -199,19 +236,6 @@
fprintf(stderr, "\n");
}
@@ -144,15 +124,15 @@
int
main(int argc, char **argv)
{
-@@ -216,7 +221,6 @@
- int sd, newsd, c, option_index = 0;
+@@ -220,7 +244,6 @@
+ int newsd, c, option_index = 0;
unsigned client_len;
char *hostname = NULL;
- struct passwd *pwd;
struct hostent *client_hostent = NULL;
struct option long_options[] = {
{"help", 0, NULL, 'h'},
-@@ -245,6 +249,14 @@
+@@ -256,6 +279,14 @@
if ((result = tcsd_startup()))
return (int)result;
@@ -167,7 +147,7 @@
sd = socket(AF_INET, SOCK_STREAM, 0);
if (sd < 0) {
LogError("Failed socket: %s", strerror(errno));
-@@ -268,51 +280,20 @@
+@@ -279,51 +310,20 @@
LogError("Failed bind: %s", strerror(errno));
return -1;
}
@@ -222,7 +202,7 @@
if ((client_hostent = gethostbyaddr((char *) &client_addr.sin_addr,
sizeof(client_addr.sin_addr),
-@@ -332,12 +313,8 @@
+@@ -343,13 +343,9 @@
tcsd_thread_create(newsd, hostname);
hostname = NULL;
@@ -234,7 +214,8 @@
+ } while (1);
- /* To close correctly, we must receive a SIGTERM */
-- return 0;
+- tcsd_shutdown();
+ /* To close correctly, we must recieve a SIGHUP */
+ return -1;
+ return 0;
}
diff --git a/security/trousers/files/patch-src-tspi-Makefile.am b/security/trousers/files/patch-src-tspi-Makefile.am
index a9971a2ea021..4274ae1173c4 100644
--- a/security/trousers/files/patch-src-tspi-Makefile.am
+++ b/security/trousers/files/patch-src-tspi-Makefile.am
@@ -1,11 +1,11 @@
---- src/tspi/Makefile.am.orig 2010-03-12 05:41:54.000000000 +0900
-+++ src/tspi/Makefile.am 2010-10-24 21:04:04.840556827 +0900
+--- src/tspi/Makefile.am.orig 2012-09-20 02:24:48.000000000 +0900
++++ src/tspi/Makefile.am 2013-07-27 04:01:03.000000000 +0900
@@ -17,7 +17,7 @@
# 5. If any interfaces have been added since the last public release, then increment age.
# 6. If any interfaces have been removed since the last public release, then set age to 0.
--libtspi_la_LDFLAGS=-version-info 2:3:1 -lpthread @CRYPTOLIB@
-+libtspi_la_LDFLAGS=-version-info 2:3:1 -lpthread @CRYPTOLIB@ -L@prefix@/lib -liconv
+-libtspi_la_LDFLAGS=-version-info 3:0:2 -lpthread @CRYPTOLIB@
++libtspi_la_LDFLAGS=-version-info 3:0:2 ${PTHREAD_LIB} @CRYPTOLIB@ -L@prefix@/lib -liconv
libtspi_la_CFLAGS=-I$(top_srcdir)/src/include -DAPPID=\"TSPI\" -DVAR_PREFIX=\"@localstatedir@\" -DETC_PREFIX=\"@sysconfdir@\"
diff --git a/security/trousers/files/patch-src-tspi-ps-tspps.c b/security/trousers/files/patch-src-tspi-ps-tspps.c
index 248931c3d900..41076366f5ce 100644
--- a/security/trousers/files/patch-src-tspi-ps-tspps.c
+++ b/security/trousers/files/patch-src-tspi-ps-tspps.c
@@ -1,5 +1,5 @@
---- src/tspi/ps/tspps.c.orig 2010-05-02 11:39:11.000000000 +0900
-+++ src/tspi/ps/tspps.c 2010-10-24 21:04:04.843557352 +0900
+--- src/tspi/ps/tspps.c.orig 2012-09-20 02:24:48.000000000 +0900
++++ src/tspi/ps/tspps.c 2013-07-27 04:03:25.000000000 +0900
@@ -29,6 +29,11 @@
#define LE_16 htole16
#define LE_32 htole32
@@ -12,37 +12,21 @@
#else
#define LE_16(x) (x)
#define LE_32(x) (x)
-@@ -43,11 +48,26 @@
+@@ -43,9 +48,13 @@
#include "tspps.h"
#include "tsplog.h"
-+#ifndef LE_16
-+static UINT16 htole16(UINT16 x)
-+{
-+ BYTE *b = &x;
-+ return (UINT16) (b[0] + (b[1] << 8));
-+}
-+#define LE_16 htole16
-+#endif
-+
-+#ifndef LE_32
-+static UINT32 htole32(UINT32 x)
-+{
-+ BYTE *b = &x;
-+ return (UINT32) (b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24));
-+}
-+#define LE_32 htole32
-+#endif
+
static int user_ps_fd = -1;
static MUTEX_DECLARE_INIT(user_ps_lock);
--#if (defined (__FreeBSD__) || defined (__OpenBSD__))
--static MUTEX_DECLARE_INIT(user_ps_path);
--#endif
- #if defined (SOLARIS)
- static struct flock fl = {
- 0,
-@@ -70,9 +90,7 @@
+ #if (defined (__FreeBSD__) || defined (__OpenBSD__))
++#include <sys/endian.h>
++#define LE_16 htole16
++#define LE_32 htole32
+ static MUTEX_DECLARE_INIT(user_ps_path);
+ #endif
+ static struct flock fl;
+@@ -60,9 +69,7 @@
TSS_RESULT result;
char *file_name = NULL, *home_dir = NULL;
struct passwd *pwp;
@@ -52,7 +36,7 @@
struct stat stat_buf;
char buf[PASSWD_BUFSIZE];
uid_t euid;
-@@ -82,10 +100,6 @@
+@@ -72,10 +79,6 @@
*file = strdup(file_name);
return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
}
@@ -63,7 +47,7 @@
euid = geteuid();
#if defined (SOLARIS)
-@@ -98,32 +112,14 @@
+@@ -88,32 +91,14 @@
*/
rc = snprintf(buf, sizeof (buf), "%s/%d", TSS_USER_PS_DIR, euid);
#else
diff --git a/security/trousers/pkg-plist b/security/trousers/pkg-plist
index da346fdf4e73..f9ace92b3b2f 100644
--- a/security/trousers/pkg-plist
+++ b/security/trousers/pkg-plist
@@ -1,6 +1,5 @@
@comment $FreeBSD$
@unexec cmp -s %D/etc/tcsd.conf %D/%%EXAMPLESDIR%%/tcsd.conf && rm -f %D/etc/tcsd.conf || true
-%%EXAMPLESDIR%%/tcsd.conf
@exec [ -f %D/etc/tcsd.conf ] || cp -p %B/%f %D/etc/tcsd.conf
include/trousers/trousers.h
include/trousers/tss.h
@@ -31,9 +30,8 @@ include/tss/tss_typedef.h
lib/libtspi.a
lib/libtspi.la
lib/libtspi.so
-lib/libtspi.so.2
+lib/libtspi.so.3
sbin/tcsd
-@dirrm %%EXAMPLESDIR%%
@dirrmtry var/lib/tpm
@dirrmtry var/lib
@dirrmtry var