authorative only name server daemon

This commit is contained in:
jakob 2002-09-13 17:09:20 +00:00
parent 4396c1855b
commit 194d5daa24
8 changed files with 172 additions and 0 deletions

43
net/nsd/Makefile Normal file
View File

@ -0,0 +1,43 @@
# $OpenBSD: Makefile,v 1.1.1.1 2002/09/13 17:09:20 jakob Exp $
COMMENT= authorative only name server daemon
VERSION= 1.0.1
DISTNAME= nsd-${VERSION}
CATEGORIES= net
MASTER_SITES= http://www.nlnetlabs.nl/downloads/nsd/
HOMEPAGE= http://www.nlnetlabs.nl/nsd/
MAINTAINER= Jakob Schlyter <jakob@openbsd.org>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MAKE_FLAGS+= PREFIX='${PREFIX}' \
NSDZONESDIR=/var/nsd \
NSDZONES=/var/nsd/nsd.zones \
NSDUSER=named
DOCDIR= share/doc/nsd
DOCFILES= README RELNOTES CREDITS DIFFERENCES REQUIREMENTS
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/nsd ${PREFIX}/sbin
${INSTALL_PROGRAM} ${WRKSRC}/nsd-notify ${PREFIX}/sbin
${INSTALL_PROGRAM} ${WRKSRC}/zonec ${PREFIX}/sbin
${INSTALL_SCRIPT} ${WRKSRC}/nsdc.sh ${PREFIX}/sbin/nsdc
${INSTALL_MAN} ${WRKSRC}/nsd.8 ${PREFIX}/man/man8
${INSTALL_MAN} ${WRKSRC}/nsdc.8 ${PREFIX}/man/man8
${INSTALL_MAN} ${WRKSRC}/zonec.8 ${PREFIX}/man/man8
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/nsd
${INSTALL_DATA} ${WRKSRC}/nsd.zones.sample ${PREFIX}/share/examples/nsd
${INSTALL_DATA_DIR} ${PREFIX}/${DOCDIR}
.for f in ${DOCFILES}
${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/${DOCDIR}
.endfor
.include <bsd.port.mk>

3
net/nsd/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (nsd-1.0.1.tar.gz) = 3569d4102ef6720d787e2b39539e0b3e
RMD160 (nsd-1.0.1.tar.gz) = 9168920daee0c2c8c9eda61d4e0dde8e96d73738
SHA1 (nsd-1.0.1.tar.gz) = f2ba81432ee316983298c7e692ee425693a2cd9c

View File

@ -0,0 +1,40 @@
$OpenBSD: patch-nsd_8,v 1.1.1.1 2002/09/13 17:09:20 jakob Exp $
--- nsd.8.orig Wed Aug 21 14:13:44 2002
+++ nsd.8 Fri Sep 13 18:48:27 2002
@@ -49,6 +49,7 @@
.Op Fl a Ar ip-address
.Op Fl p Ar port
.Op Fl u Ar username
+.Op Fl t Ar chrootdir
.Op Fl i Ar identity
.Sh DESCRIPTION
.Ic NSD
@@ -87,16 +88,13 @@ Use the specified
.Ar database
instead of the default
.Em /etc/nsd/nsd.db
-.It Fl a
-.Ar ip-address
+.It Fl a Ar ip-address
Bind the socket to the specified
.Ar ip-address
-.It Fl p
-.Ar port
+.It Fl p Ar port
Answer the queries on the specified
.Ar port
-.It Fl u
-.Ar username
+.It Fl u Ar username
Drop user and group privileges to those of
.Ar username
after binding the socket.
@@ -107,6 +105,8 @@ username
id
id.gid
For example: nsd -or- 80 -or- 80.80
+.It Fl t Ar chroot
+specifies a directory to chroot to upon startup.
.It Fl i Ar identity
Return the specified
.Ar identity

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-nsd_c,v 1.1.1.1 2002/09/13 17:09:20 jakob Exp $
--- nsd.c.orig Thu Jun 13 14:48:22 2002
+++ nsd.c Thu Jul 11 22:11:42 2002
@@ -79,7 +79,7 @@ xrealloc(p, size)
int
usage()
{
- fprintf(stderr, "usage: nsd [-d] [-p port] [-n identity] [-u user|uid] -f database\n");
+ fprintf(stderr, "usage: nsd [-d] [-p port] [-n identity] [-u user|uid] [-t chrootdir] -f database\n");
exit(1);
}
@@ -202,6 +202,7 @@ main(argc, argv)
nsd.identity = CF_IDENTITY;
nsd.version = CF_VERSION;
nsd.username = CF_USERNAME;
+ nsd.chrootdir = NULL;
/* EDNS0 */
nsd.edns.max_msglen = CF_EDNS_MAX_MESSAGE_LEN;
@@ -235,7 +236,7 @@ main(argc, argv)
/* Parse the command line... */
- while((c = getopt(argc, argv, "a:df:p:i:u:")) != -1) {
+ while((c = getopt(argc, argv, "a:df:p:i:u:t:")) != -1) {
switch (c) {
case 'a':
if((nsd.tcp.addr = nsd.udp.addr = inet_addr(optarg)) == -1)
@@ -256,6 +257,9 @@ main(argc, argv)
break;
case 'u':
nsd.username = optarg;
+ break;
+ case 't':
+ nsd.chrootdir = optarg;
break;
case '?':
default:

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-nsd_h,v 1.1.1.1 2002/09/13 17:09:20 jakob Exp $
--- nsd.h.orig Thu Jul 11 22:01:02 2002
+++ nsd.h Thu Jul 11 22:01:20 2002
@@ -86,6 +86,7 @@ struct nsd {
char *username;
uid_t uid;
gid_t gid;
+ char *chrootdir;
char *version;
char *identity;

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-server_c,v 1.1.1.1 2002/09/13 17:09:20 jakob Exp $
--- server.c.orig Thu Aug 29 13:03:07 2002
+++ server.c Fri Sep 13 18:40:37 2002
@@ -334,6 +334,12 @@ server(nsd)
}
#endif
+ /* Chroot */
+ if(nsd->chrootdir && chroot(nsd->chrootdir)) {
+ syslog(LOG_ERR, "unable to chroot: %m");
+ return -1;
+ }
+
/* Drop the permissions */
if(setgid(nsd->gid) != 0 || setuid(nsd->uid) !=0) {
syslog(LOG_ERR, "unable to drop user priviledges: %m");

5
net/nsd/pkg/DESCR Normal file
View File

@ -0,0 +1,5 @@
nsd is the daemon part of the NSD package written by NLnet Labs in
collaboration with RIPE NCC. NSD stands for name server daemon and
provides authoritative DNS information.
WWW: ${HOMEPAGE}

15
net/nsd/pkg/PLIST Normal file
View File

@ -0,0 +1,15 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2002/09/13 17:09:20 jakob Exp $
man/man8/nsd.8
man/man8/nsdc.8
man/man8/zonec.8
sbin/nsd
sbin/nsd-notify
sbin/nsdc
sbin/zonec
share/doc/nsd/CREDITS
share/doc/nsd/DIFFERENCES
share/doc/nsd/README
share/doc/nsd/RELNOTES
share/doc/nsd/REQUIREMENTS
share/examples/nsd
@dirrm share/doc/nsd