[124] in The Cryptographic File System users list
CFS 1.3 patches
daemon@ATHENA.MIT.EDU (lcs Mixmaster Remailer)
Sun Feb 21 06:42:37 1999
From owner-cfs-users@nsa.research.att.com Sun Feb 21 11:42:36 1999
Return-Path: <owner-cfs-users@nsa.research.att.com>
Delivered-To: cfs-mtg@bloom-picayune.mit.edu
Received: (qmail 5593 invoked from network); 21 Feb 1999 11:42:35 -0000
Received: from unknown (HELO mail-blue.research.att.com) (135.207.30.102)
by bloom-picayune.mit.edu with SMTP; 21 Feb 1999 11:42:35 -0000
Received: from amontillado.research.att.com (amontillado.research.att.com [135.207.24.32])
by mail-blue.research.att.com (Postfix) with ESMTP
id 2562C4CE5B; Sun, 21 Feb 1999 06:42:35 -0500 (EST)
Received: from nsa.research.att.com (majordomo@nsa.research.att.com [135.207.24.155])
by amontillado.research.att.com (8.8.7/8.8.7) with ESMTP id GAA22502;
Sun, 21 Feb 1999 06:42:37 -0500 (EST)
Received: (from majordomo@localhost) by nsa.research.att.com (8.7.3/8.7.3) id GAA18725 for cfs-users-list; Sun, 21 Feb 1999 06:38:15 -0500 (EST)
X-Authentication-Warning: nsa.research.att.com: majordomo set sender to owner-cfs-users@nsa.research.att.com using -f
Received: from mail-blue.research.att.com (mail-blue.research.att.com [135.207.30.102]) by nsa.research.att.com (8.7.3/8.7.3) with ESMTP id GAA18721 for <cfs-users@nsa.research.att.com>; Sun, 21 Feb 1999 06:38:13 -0500 (EST)
Received: by mail-blue.research.att.com (Postfix)
id 2563D4CE5B; Sun, 21 Feb 1999 06:40:05 -0500 (EST)
Delivered-To: cfs-users@research.att.com
Received: from anon.lcs.mit.edu (anon.lcs.mit.edu [18.26.0.254])
by mail-blue.research.att.com (Postfix) with SMTP id D6ABE4CE5A
for <cfs-users@research.att.com>; Sun, 21 Feb 1999 06:40:04 -0500 (EST)
Date: 21 Feb 1999 11:40:03 -0000
Message-ID: <19990221114003.4537.qmail@nym.alias.net>
To: cfs-users@research.att.com
From: lcs Mixmaster Remailer <mix@anon.lcs.mit.edu>
X-Comment1: This message did not originate from the
X-Comment2: above address. It was automatically remailed
X-Comment3: by an anonymous mail service. Please report
X-Comment4: problems or inappropriate use to
X-Comment5: <postmaster@anon.lcs.mit.edu>
Subject: CFS 1.3 patches
Sender: owner-cfs-users@research.att.com
Precedence: bulk
Return-Path: <owner-cfs-users@nsa.research.att.com>
I don't like the way cattach parses arguments. The choice of "--" as
a magical argument for reading from /dev/stdin conflicts with
well-established conventions (e.g., getopt(3) using it as an
end-of-options marker).
I've also seen directories sometimes stat as ENOTDIR. Spurious?
Anyone have a suggestion on good large-key ciphers?
I wonder if CFS could be improved with a common code segment that
tries to use /dev/random instead of trying to do it in userland. I am
not sure if this should be compile-time or run-time decision.
Is there, or should there be RNG API (which specifies how to manage
and drain possibly multiple entropy pools, etc.)? All I know of are
some potentially non-portable conventions, such as /dev/urandom being
non-blocking and less secure than /dev/random.
Below is patch for CFS 1.3.
Includes fixes to get it working under NetBSD.
Includes a tricky use of socket precedence rules to allow CFS and NFS
servers to share port 2049.
Also allows binding to specific IP.
Tests port range more sanely.
--- cfs/Makefile.orig
+++ cfs/Makefile
@@ -65,15 +65,15 @@
#COPT=-O -DNOT_ANSI_C -DPROTOTYPES=0
# for gcc, use
CC=gcc
-COPT=-O2 -DPROTOTYPES=1
+COPT=-O2 -DNFS_PORT_SHARING=SO_REUSEPORT -DPROTOTYPES=1
#1B: paths:
BINDIR=/usr/local/bin
ETCDIR=/usr/local/sbin
PRINTCMD=enscript -Gr2
# you only need RSAREF for ESM
-RSALIB=/usr/mab/rsaref/install/rsaref.a
-RINCLUDES=/usr/mab/rsaref/source
+RSALIB=/usr/local/lib/rsaref.a
+RINCLUDES=/usr/local/include
# if you're a paranoid facist, you might want to configure
# default timeouts on the attach command. If you do,
@@ -149,9 +149,9 @@
# for mounting, you need to use a command like:
# mount -o -P,-c localhost:/null /crypt
# use -DSHORTLINKS to support the BSD 4.4 symbolic links (Dave Carrel)
-#CFLAGS=$(COPT) -DBSD44 -DANYPORT -DCFS_PORT=2049 -DSHORTLINKS -I$(RINCLUDES)
-#LIBS=
-#COMPAT=-lcompat
+CFLAGS=$(COPT) -DBSD44 -DANYPORT -DCFS_PORT=2049 -DSHORTLINKS -I$(RINCLUDES)
+LIBS=
+COMPAT=-lcompat
## use these flags on Solaris 2.3 / SUNOS 5.x
#CFLAGS=$(COPT) -DSOLARIS2X -DPORTMAP -I$(RINCLUDES) -DPTMX
@@ -166,7 +166,7 @@
# (3/3) CONFIGURE: one last thing
#==========================================================================
# finally, comment out the next line:
-CC=you_forgot_to_edit_the_makefile
+#CC=you_forgot_to_edit_the_makefile
# now you're done with local configuration.
@@ -260,7 +260,7 @@
rpcgen -l -o admproto_clnt.c admproto.x
clean:
- rm -f $(OBJS) $(COBJS) $(OTHERS) cfsd cmkdir cattach cdetach cname ccat
+ rm -f $(OBJS) $(COBJS) $(OTHERS) cfsd cmkdir cattach cdetach cname ccat cpasswd
rm -f $(EOBJS) esm
cfs.shar: $(SRCS) $(ESRCS) $(MANS)
--- cfs/cfs.c.orig
+++ cfs/cfs.c
@@ -47,6 +47,7 @@
#include "admproto.h"
#include "cfs.h"
+/* the ip address allowed to send us NFS requests */
struct in_addr validhost;
#if defined(SOLARIS2X) || defined(__NetBSD__)
@@ -63,11 +64,15 @@
char zerovect[]={0,0,0,0,0,0,0,0,0};
int cursecs;
+#ifdef __NetBSD__
+int _rpcsvcdirty; /* used by rpcgenerated code */
+#endif
+
main(argc,argv)
int argc;
char **argv;
{
- int port=CFS_PORT;
+ unsigned int port=CFS_PORT;
struct timeval tv;
struct hostent *hp;
@@ -82,25 +87,31 @@
#endif
/* create the right kind of socket */
- if (argc > 2) {
- fprintf(stderr,"Usage: cfsd [port]\n");
+ if (argc > 3) {
+ fprintf(stderr,"Usage: cfsd [port] [ip_address]\n");
exit(1);
}
- if (argc==2) {
- if ((port=atoi(argv[1]))<=0) {
- fprintf(stderr,"Usage: cfsd [port]\n");
+ if (argc>=2) {
+ if ((port = (unsigned int)strtoul(argv[1], (char **)NULL, 10))
+ > 65535) {
+ fprintf(stderr,"Error: invalid port\n");
exit(1);
}
}
- if ((hp=gethostbyname("localhost"))==NULL) {
- fprintf(stderr,"Can't deal with localhost\n");
- exit(1);
- }
bzero((char *)&sin,sizeof(sin));
sin.sin_family=AF_INET;
- bcopy((char *)hp->h_addr,(char *)&sin.sin_addr,hp->h_length);
- /* sin.sin_addr = inet_makeaddr(INADDR_ANY,np);*/
- validhost.s_addr=sin.sin_addr.s_addr;
+ if (argc >= 3) {
+ if ((hp=gethostbyname(argv[2]))==NULL) {
+ fprintf(stderr,"Can't resolve host %s\n", argv[2]);
+ exit(1);
+ }
+ bcopy((char *)hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
+ validhost.s_addr=sin.sin_addr.s_addr;
+ }
+ else {
+ sin.sin_addr.s_addr = htonl(INADDR_ANY);
+ validhost.s_addr=htonl(INADDR_LOOPBACK); /* XXX */
+ }
sin.sin_port = htons(port);
#ifdef SOLARIS2X
@@ -175,6 +186,26 @@
exit(1);
}
+#ifdef NFS_PORT_SHARING
+ /* This allows you to use a machine which doesn't support */
+ /* NFS mounts on ports other than 2049 as NFS and CFS server! */
+ /* It does this by allocating a more specific socket for CFS */
+
+/* Prevent completely duplicate bindings if possible */
+#ifdef SO_REUSEPORT /* 4.4BSD */
+#define REUSE_METHOD SO_REUSEPORT
+#else
+#define REUSE_METHOD SO_REUSEADDR
+#endif
+
+ _rpcsvcdirty = 1; /* overload this temporarily */
+ if (setsockopt(svrsock, SOL_SOCKET, REUSE_METHOD,
+ &_rpcsvcdirty,sizeof(_rpcsvcdirty))!=0) {
+ perror("setsockopt");
+ exit(1);
+ }
+
+#endif
if (bind(svrsock,(struct sockaddr *)&sin,sizeof(sin)) != 0) {
perror("bind");
exit(1);
--- cfs/cfsd.8.orig
+++ cfs/cfsd.8
@@ -3,11 +3,14 @@
cfsd - cryptographic file system daemon
.SH SYNOPSIS
.B cfsd
+[ \fIport\fP ]
+[ \fIhostname\fP ]
.SH DESCRIPTION
\fBcfsd\fP is the user-level daemon for the Cryptographic File System
(CFS). It is essentially an RPC server for the NFS protocol augmented
with the CFS_ADMIN protocol. It listens on the CFS port (ordinarily
-port 3049) on the \fBlocalhost\fP interface.
+port 3049) on any interface. These defaults can be overridden on
+the command line.
.LP
The main function of \fBcfsd\fP is to manage the keys for currently
attached encrypted directories, presenting them in clear form under
Frame 313