Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/sushi Whew. Add an entire networking configuration tr...



details:   https://anonhg.NetBSD.org/src/rev/93f374f5de10
branches:  trunk
changeset: 509037:93f374f5de10
user:      garbled <garbled%NetBSD.org@localhost>
date:      Wed Apr 25 03:43:25 2001 +0000

description:
Whew.  Add an entire networking configuration tree for sushi.  This gives
sushi the ability to do the following tasks:
Edit /etc/exports
Edit /etc/hosts
Change the hostname
Modify NIC configuration
Change the default route
Setup YP/NIS.

diffstat:

 share/sushi/index                                 |    3 +-
 share/sushi/network/Makefile                      |   11 +
 share/sushi/network/exports/Makefile              |   11 +
 share/sushi/network/exports/addexport/Makefile    |   11 +
 share/sushi/network/exports/addexport/form        |   13 +
 share/sushi/network/exports/addexport/help        |   26 +++
 share/sushi/network/exports/addexport/preform     |    2 +
 share/sushi/network/exports/addexport/script      |   53 +++++++
 share/sushi/network/exports/addexport/script1     |    3 +
 share/sushi/network/exports/addexport/script2     |   11 +
 share/sushi/network/exports/addexport/script3     |   13 +
 share/sushi/network/exports/addexport/script4     |    2 +
 share/sushi/network/exports/addexport/script5     |   11 +
 share/sushi/network/exports/addexport/script6     |   11 +
 share/sushi/network/exports/addexport/script7     |   11 +
 share/sushi/network/exports/addexport/script8     |    9 +
 share/sushi/network/exports/addexport/script9     |    9 +
 share/sushi/network/exports/addexport/scripta     |   10 +
 share/sushi/network/exports/addexport/scriptb     |   11 +
 share/sushi/network/exports/delexport/Makefile    |   10 +
 share/sushi/network/exports/delexport/form        |    3 +
 share/sushi/network/exports/delexport/help        |    5 +
 share/sushi/network/exports/delexport/script      |   24 +++
 share/sushi/network/exports/delexport/script1     |    4 +
 share/sushi/network/exports/help                  |    9 +
 share/sushi/network/exports/index                 |    3 +
 share/sushi/network/help                          |   27 +++
 share/sushi/network/hostname/Makefile             |   10 +
 share/sushi/network/hostname/form                 |    3 +
 share/sushi/network/hostname/help                 |    6 +
 share/sushi/network/hostname/script               |   14 +
 share/sushi/network/hostname/script1              |    8 +
 share/sushi/network/hosts/Makefile                |   11 +
 share/sushi/network/hosts/addhost/Makefile        |   10 +
 share/sushi/network/hosts/addhost/form            |    3 +
 share/sushi/network/hosts/addhost/help            |    4 +
 share/sushi/network/hosts/addhost/script          |    9 +
 share/sushi/network/hosts/addv6host/Makefile      |   10 +
 share/sushi/network/hosts/addv6host/form          |    3 +
 share/sushi/network/hosts/addv6host/help          |    4 +
 share/sushi/network/hosts/addv6host/script        |    9 +
 share/sushi/network/hosts/delhost/Makefile        |   10 +
 share/sushi/network/hosts/delhost/form            |    2 +
 share/sushi/network/hosts/delhost/help            |    3 +
 share/sushi/network/hosts/delhost/script          |   14 +
 share/sushi/network/hosts/delhost/script1         |    3 +
 share/sushi/network/hosts/help                    |   16 ++
 share/sushi/network/hosts/index                   |    7 +
 share/sushi/network/hosts/modhost/Makefile        |   10 +
 share/sushi/network/hosts/modhost/form            |    4 +
 share/sushi/network/hosts/modhost/help            |    4 +
 share/sushi/network/hosts/modhost/preform         |    2 +
 share/sushi/network/hosts/modhost/script          |   11 +
 share/sushi/network/hosts/modhost/script1         |    4 +
 share/sushi/network/hosts/modhost/script2         |    6 +
 share/sushi/network/hosts/modv6host/Makefile      |   10 +
 share/sushi/network/hosts/modv6host/form          |    4 +
 share/sushi/network/hosts/modv6host/help          |    4 +
 share/sushi/network/hosts/modv6host/preform       |    2 +
 share/sushi/network/hosts/modv6host/script        |   11 +
 share/sushi/network/hosts/modv6host/script1       |    4 +
 share/sushi/network/hosts/modv6host/script2       |    6 +
 share/sushi/network/index                         |    7 +
 share/sushi/network/interfaces/Makefile           |   11 +
 share/sushi/network/interfaces/help               |   12 +
 share/sushi/network/interfaces/index              |    3 +
 share/sushi/network/interfaces/interface/Makefile |   10 +
 share/sushi/network/interfaces/interface/form     |   15 ++
 share/sushi/network/interfaces/interface/help     |    7 +
 share/sushi/network/interfaces/interface/preform  |    2 +
 share/sushi/network/interfaces/interface/script   |  108 +++++++++++++++
 share/sushi/network/interfaces/interface/script1  |    6 +
 share/sushi/network/interfaces/interface/script2  |  157 ++++++++++++++++++++++
 share/sushi/network/interfaces/listif/Makefile    |    8 +
 share/sushi/network/interfaces/listif/script      |   23 +++
 share/sushi/network/routing/Makefile              |   11 +
 share/sushi/network/routing/default/Makefile      |   10 +
 share/sushi/network/routing/default/form          |    3 +
 share/sushi/network/routing/default/help          |    5 +
 share/sushi/network/routing/default/script        |   15 ++
 share/sushi/network/routing/default/script1       |   11 +
 share/sushi/network/routing/help                  |    5 +
 share/sushi/network/routing/index                 |    3 +
 share/sushi/network/routing/ipv4table/Makefile    |    8 +
 share/sushi/network/routing/ipv4table/exec        |    1 +
 share/sushi/network/yp/Makefile                   |   11 +
 share/sushi/network/yp/client/Makefile            |   10 +
 share/sushi/network/yp/client/form                |    2 +
 share/sushi/network/yp/client/help                |    5 +
 share/sushi/network/yp/client/script              |   13 +
 share/sushi/network/yp/client/script1             |    8 +
 share/sushi/network/yp/domainname/Makefile        |   10 +
 share/sushi/network/yp/domainname/form            |    3 +
 share/sushi/network/yp/domainname/help            |    6 +
 share/sushi/network/yp/domainname/script          |   14 +
 share/sushi/network/yp/domainname/script1         |    8 +
 share/sushi/network/yp/help                       |   11 +
 share/sushi/network/yp/index                      |    6 +
 share/sushi/network/yp/master/Makefile            |   10 +
 share/sushi/network/yp/master/form                |    2 +
 share/sushi/network/yp/master/help                |    5 +
 share/sushi/network/yp/master/script              |   13 +
 share/sushi/network/yp/master/script1             |    8 +
 share/sushi/network/yp/slave/Makefile             |   10 +
 share/sushi/network/yp/slave/form                 |    3 +
 share/sushi/network/yp/slave/help                 |    5 +
 share/sushi/network/yp/slave/script               |   13 +
 share/sushi/network/yp/slave/script1              |    8 +
 108 files changed, 1181 insertions(+), 1 deletions(-)

diffs (truncated from 1620 to 300 lines):

diff -r 6891a9917657 -r 93f374f5de10 share/sushi/index
--- a/share/sushi/index Wed Apr 25 03:31:23 2001 +0000
+++ b/share/sushi/index Wed Apr 25 03:43:25 2001 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: index,v 1.3 2001/03/07 07:05:08 garbled Exp $
+# $NetBSD: index,v 1.4 2001/04/25 03:43:25 garbled Exp $
 install                install Software Installation and Maintenance
 system         system  System Maintenance
 users          users   Security & Users
+network                network Network related configuration
 BLANK          BLANK   BLANK
 info           info    Using sushi (information only)
 util           util    Sushi utilities (logging/scripting)
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/Makefile      Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,11 @@
+#      $NetBSD: Makefile,v 1.1 2001/04/25 03:43:25 garbled Exp $
+
+SUBDIR= exports hostname hosts interfaces routing yp
+
+FILES= index help
+FILESDIR=${BINDIR}/sushi/network
+MKOBJ= no
+
+.include "../../Makefile.inc"
+.include <bsd.prog.mk>
+.include <bsd.subdir.mk>
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/Makefile      Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,11 @@
+#      $NetBSD: Makefile,v 1.1 2001/04/25 03:43:25 garbled Exp $
+
+SUBDIR= addexport delexport
+
+FILES= index help
+FILESDIR=${BINDIR}/sushi/network/exports
+MKOBJ= no
+
+.include "../../Makefile.inc"
+.include <bsd.prog.mk>
+.include <bsd.subdir.mk>
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/Makefile    Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,11 @@
+#      $NetBSD: Makefile,v 1.1 2001/04/25 03:43:26 garbled Exp $
+
+FILES= form preform help
+FILESDIR=${BINDIR}/sushi/network/exports/addexport
+SCRIPTS= script1 script2 script3 script4 script5 script6
+SCRIPTS+= script7 script8 script9 scripta scriptb script
+SCRIPTSDIR=${BINDIR}/sushi/network/exports/addexport
+MKOBJ= no
+
+.include "../../../Makefile.inc"
+.include <bsd.prog.mk>
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/form
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/form        Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,13 @@
+# $NetBSD: form,v 1.1 2001/04/25 03:43:26 garbled Exp $
+noedit:@@@1@@@                 Filesystem to export
+script:script2,@@@1@@@         Export all subdirectories?
+script:scriptb,@@@1@@@         Map root access to a user/group?
+script:script3,@@@1@@@         User to map root access to
+multiscript:script4,@@@1@@@    Groups to map root access to
+script:script5,@@@1@@@         Export filesystem read-only?
+script:script6,@@@1@@@         Allow NFS connections from unreserved ports?
+script:script7,@@@1@@@         Allow mount connections from unreserved ports?
+escript:50,script8,@@@1@@@     Network to export mount to
+escript:15,script9,@@@1@@@     Netmask to apply to above network
+escript:80,scripta,@@@1@@@     Hosts/netgroups to export mount to
+list:YES,NO                    Restart mountd so changes take effect?
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/help
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/help        Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,26 @@
+Under NetBSD, you may only export a complete filesystem, you cannot
+export a subdirectory of a filesystem.  Therefore only filesystem mount
+points will be displayed to you.
+
+If you choose to export all subdirectories, clients may mount any
+subdirectory of the mount point, rather than the entire mount point.
+
+Mapping root access to a specific user or group means that root on the
+client machine, will have the access permissions of the user/group selected.
+
+Allowing unreserved port connections may sometimes be needed for less secure
+client implementations.  Using this option will decrease the security of your
+system.
+
+Setting the network and netmask allows you to export a filesystem to an
+entire network, or subnet.
+
+Hosts/netgroups to export mount to, allows you to specify individual hosts,
+or netgroups as may be defined in an /etc/netgroup file, that are allowed to
+mount filesystems from this host.  You may specify IP's, hostnames, or
+netgroups.  Multiple hosts to export to should be space separated.
+
+For more information and details on exporting filesystems, please see the
+exports(5) manpage.
+
+$NetBSD: help,v 1.1 2001/04/25 03:43:26 garbled Exp $
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/preform
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/preform     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,2 @@
+# $NetBSD: preform,v 1.1 2001/04/25 03:43:26 garbled Exp $
+script:script1         Filesystem to export
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script      Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,53 @@
+#!/bin/sh
+# $NetBSD: script,v 1.1 2001/04/25 03:43:26 garbled Exp $
+
+IFS=" "
+EXPORTS=`cat /etc/exports`
+echo $EXPORTS | grep -v "^$1" | grep -v '^$' >/etc/exports
+LINE="$1"
+
+if [ "$2" = "YES" ]; then
+       LINE=`echo "$LINE -alldirs"`
+fi
+if [ "$3" = "YES" ]; then
+       LINE=`echo "$LINE -maproot=$4"`
+       if [ "$5" != " " ]; then
+               GROUPS=`echo "$5" | sed -e 's/,/:/g'`
+               LINE=`echo "$LINE"":$GROUPS"`
+       fi
+fi
+if [ "$6" = "YES" ]; then
+       LINE=`echo "$LINE -ro"`
+fi
+if [ "$7" = "YES" ]; then
+       LINE=`echo "$LINE -noresvport"`
+fi
+if [ "$8" = "YES" ]; then
+       LINE=`echo "$LINE -noresvmnt"`
+fi
+if [ "$9" != " " ]; then
+       LINE=`echo "$LINE -network $9"`
+fi
+if [ "$10" != " " ]; then
+       LINE=`echo "$LINE -mask $10"`
+fi
+if [ "$11" != " " ]; then
+       LINE=`echo "$LINE $11"`
+fi
+
+echo $LINE >>/etc/exports
+
+if [ "$?" = "0" ]; then
+       echo "Added or modified $1 in /etc/exports"
+else
+       echo "Failed to modify /etc/exports"
+fi
+
+if [ "$12" = "YES" ]; then
+       if [ -f "/var/run/mountd.pid" ]; then
+               kill -HUP `cat /var/run/mountd.pid`
+               echo "Restarted mountd."
+       else
+               echo "Mountd not running, cannot refresh."
+       fi
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script1
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script1     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,3 @@
+#!/bin/sh
+# $NetBSD: script1,v 1.1 2001/04/25 03:43:27 garbled Exp $
+df -l | egrep -v '(procfs|kernfs|mfs)' | awk '{print $6}' | grep -v Mounted
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script2
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script2     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+# $NetBSD: script2,v 1.1 2001/04/25 03:43:27 garbled Exp $
+
+grep "^$1 " /etc/exports | grep -- '-alldirs' > /dev/null
+if [ "$?" = "0" ]; then
+       echo "YES"
+       echo "NO"
+else
+       echo "NO"
+       echo "YES"
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script3     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,13 @@
+#!/bin/sh
+# $NetBSD: script3,v 1.1 2001/04/25 03:43:27 garbled Exp $
+
+MAPROOT=`grep "$1 " /etc/exports | grep -- '-maproot'`
+if [ $? != 0 ]; then
+       cut -f 1 -d ':' /etc/passwd
+else
+       MAPROOT=`echo $MAPROOT | sed -e 's/.*-maproot=\(.*\) *.*/\1/'`
+       USER=`echo $MAPROOT | cut -f 1 -d ':'`
+       USER=`id -p $USER | grep uid | awk '{print $2}'`
+       echo $USER
+       cut -f 1 -d ':' /etc/passwd | grep -v "$USER$"
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script4     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+cut -f 1 -d : /etc/group
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script5
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script5     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+# $NetBSD: script5,v 1.1 2001/04/25 03:43:27 garbled Exp $
+
+grep "^$1 " /etc/exports | grep -- '-ro' > /dev/null
+if [ "$?" = "0" ]; then
+       echo "YES"
+       echo "NO"
+else
+       echo "NO"
+       echo "YES"
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script6
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script6     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+# $NetBSD: script6,v 1.1 2001/04/25 03:43:27 garbled Exp $
+
+grep "^$1 " /etc/exports | grep -- '-noresvport' > /dev/null
+if [ "$?" = "0" ]; then
+       echo "YES"
+       echo "NO"
+else
+       echo "NO"
+       echo "YES"
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script7
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script7     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+# $NetBSD: script7,v 1.1 2001/04/25 03:43:27 garbled Exp $
+
+grep "^$1 " /etc/exports | grep -- '-noresvmnt' > /dev/null
+if [ "$?" = "0" ]; then
+       echo "YES"
+       echo "NO"
+else
+       echo "NO"
+       echo "YES"
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script8     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+# $NetBSD: script8,v 1.1 2001/04/25 03:43:28 garbled Exp $
+
+NETWORK=`grep "^$1 " /etc/exports | grep -- '-network' | sed -e 's/.*-network \([a-zA-Z0-9.:%/]*\) *.*/\1/'`
+if [ -z "$NETWORK" ]; then
+       echo " "
+else
+       echo $NETWORK
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/script9
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/script9     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+# $NetBSD: script9,v 1.1 2001/04/25 03:43:28 garbled Exp $
+
+NETWORK=`grep "^$1 " /etc/exports | grep -- '-mask' | sed -e 's/.*-mask \([a-zA-Z0-9.:%/]*\) *.*/\1/'`
+if [ -z "$NETWORK" ]; then
+       echo " "
+else
+       echo $NETWORK
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/scripta
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/sushi/network/exports/addexport/scripta     Wed Apr 25 03:43:25 2001 +0000
@@ -0,0 +1,10 @@
+#!/bin/sh
+# $NetBSD: scripta,v 1.1 2001/04/25 03:43:28 garbled Exp $
+LIST=`grep "^$1 " /etc/exports | sed -e 's/-network [a-zA-Z0-9.:%/]*//g' \
+  | sed -e 's/-mask [a-zA-Z0-9.:%/]*//g' | sed -e 's/-[a-zA-Z0-9=:]*//g' \
+  | sed -e "s@$1@@"`
+if [ -z "$LIST" ]; then
+       echo
+else
+       echo "$LIST"
+fi
diff -r 6891a9917657 -r 93f374f5de10 share/sushi/network/exports/addexport/scriptb
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000



Home | Main Index | Thread Index | Old Index