summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-08-31 21:18:23 +0000
committertrasz <trasz@FreeBSD.org>2014-08-31 21:18:23 +0000
commite8d76f86d25e64bdb4a9ab0b15c509c07491724a (patch)
tree3eebe0ef20c0ab7543612cca9aa64d87a222a4ed /etc
parent0ca40bff6c5041cdf647ca146893c61a26796c76 (diff)
downloadFreeBSD-src-e8d76f86d25e64bdb4a9ab0b15c509c07491724a.zip
FreeBSD-src-e8d76f86d25e64bdb4a9ab0b15c509c07491724a.tar.gz
MFC r270096:
Bring in the new automounter, similar to what's provided in most other UNIX systems, eg. MacOS X and Solaris. It uses Sun-compatible map format, has proper kernel support, and LDAP integration. There are still a few outstanding problems; they will be fixed shortly. Reviewed by: allanjude@, emaste@, kib@, wblock@ (earlier versions) Phabric: D523 Relnotes: yes Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'etc')
-rw-r--r--etc/Makefile4
-rw-r--r--etc/auto_master5
-rw-r--r--etc/autofs/Makefile9
-rw-r--r--etc/autofs/include_ldap38
-rw-r--r--etc/autofs/special_hosts17
-rw-r--r--etc/autofs/special_null4
-rw-r--r--etc/defaults/rc.conf1
-rw-r--r--etc/mtree/BSD.root.dist2
-rw-r--r--etc/rc.d/Makefile3
-rw-r--r--etc/rc.d/automount31
-rw-r--r--etc/rc.d/automountd19
-rw-r--r--etc/rc.d/autounmountd18
12 files changed, 150 insertions, 1 deletions
diff --git a/etc/Makefile b/etc/Makefile
index 0cb7b52..976981a 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -11,7 +11,8 @@ SUBDIR= sendmail
SUBDIR+=tests
.endif
-BIN1= crontab \
+BIN1= auto_master \
+ crontab \
devd.conf \
devfs.conf \
ddb.conf \
@@ -225,6 +226,7 @@ distribution:
echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
) | ${METALOG.add}
.endif
+ ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
.if ${MK_BLUETOOTH} != "no"
${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
.endif
diff --git a/etc/auto_master b/etc/auto_master
new file mode 100644
index 0000000..16d55e2
--- /dev/null
+++ b/etc/auto_master
@@ -0,0 +1,5 @@
+# $FreeBSD$
+#
+# Automounter master map, see auto_master(5) for details.
+#
+/net -hosts -nosuid
diff --git a/etc/autofs/Makefile b/etc/autofs/Makefile
new file mode 100644
index 0000000..c9eda50
--- /dev/null
+++ b/etc/autofs/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+FILES= include_ldap special_hosts special_null
+
+NO_OBJ=
+FILESDIR= /etc/autofs
+FILESMODE= 755
+
+.include <bsd.prog.mk>
diff --git a/etc/autofs/include_ldap b/etc/autofs/include_ldap
new file mode 100644
index 0000000..58970c0
--- /dev/null
+++ b/etc/autofs/include_ldap
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# Modify this to suit your needs. The "$1" is the map name, eg. "auto_master".
+# To debug, simply run this script with map name as the only parameter. It's
+# supposed to output map contents ("key location" pairs) to standard output.
+SEARCHBASE="ou=$1,dc=example,dc=com"
+ENTRY_ATTRIBUTE="cn"
+VALUE_ATTRIBUTE="automountInformation"
+
+/usr/local/bin/ldapsearch -LLL -x -o ldif-wrap=no -b "$SEARCHBASE" "$ENTRY_ATTRIBUTE" "$VALUE_ATTRIBUTE" | awk '
+$1 == "'$ENTRY_ATTRIBUTE':" {
+ key = $2
+}
+
+$1 == "'$VALUE_ATTRIBUTE':" && key {
+ printf "%s%s", key, OFS
+ key = ""
+ for (i=2; i<NF; i++) {
+ printf "%s%s", $(i), OFS
+ }
+ printf "%s%s", $NF, ORS
+}
+
+# Double colon after attribute name means the value is in Base64.
+$1 == "'$VALUE_ATTRIBUTE'::" && key {
+ printf "%s%s", key, OFS
+ key = ""
+ for (i=2; i<NF; i++) {
+ printf "%s%s", $(i), OFS
+ }
+ printf "%s", $NF | "b64decode -rp"
+ close("b64decode -rp")
+ printf "%s", ORS
+}
+'
diff --git a/etc/autofs/special_hosts b/etc/autofs/special_hosts
new file mode 100644
index 0000000..f81449d
--- /dev/null
+++ b/etc/autofs/special_hosts
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+if [ $# -eq 0 ]; then
+ out=`getent hosts`
+ [ $? -eq 0 ] || exit 1
+ echo "$out" | awk '{ print $2 }' | sort -u
+ exit 0
+fi
+
+out=`showmount -e "$1"`
+[ $? -eq 0 ] || exit 1
+echo "$out" | awk -v host="$1" \
+ 'NR > 1 { printf "%s\t%s:%s ", $1, host, $1 } END { printf "\n" }'
+
diff --git a/etc/autofs/special_null b/etc/autofs/special_null
new file mode 100644
index 0000000..41c1000
--- /dev/null
+++ b/etc/autofs/special_null
@@ -0,0 +1,4 @@
+#!/usr/bin/true
+#
+# $FreeBSD$
+#
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index ac73973..97da01e 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -311,6 +311,7 @@ amd_enable="NO" # Run amd service with $amd_flags (or NO).
amd_program="/usr/sbin/amd" # path to amd, if you want a different one.
amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"
amd_map_program="NO" # Can be set to "ypcat -k amd.master"
+autofs_enable="NO" # Run automountd(8)
nfs_client_enable="NO" # This host is an NFS client (or NO).
nfs_access_cache="60" # Client cache timeout in seconds
nfs_server_enable="NO" # This host is an NFS server (or NO).
diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist
index c02e4f7..e3ca074 100644
--- a/etc/mtree/BSD.root.dist
+++ b/etc/mtree/BSD.root.dist
@@ -24,6 +24,8 @@
etc
X11
..
+ autofs
+ ..
bluetooth
..
defaults
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index 375da6d..e522fed 100644
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -20,6 +20,9 @@ FILES= DAEMON \
atm3 \
auditd \
auditdistd \
+ automount \
+ automountd \
+ autounmountd \
bgfsck \
${_bluetooth} \
bootparams \
diff --git a/etc/rc.d/automount b/etc/rc.d/automount
new file mode 100644
index 0000000..63bda42
--- /dev/null
+++ b/etc/rc.d/automount
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: automount
+# REQUIRE: nfsclient
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="automount"
+rcvar="autofs_enable"
+start_cmd="automount_start"
+stop_cmd="automount_stop"
+required_modules="autofs"
+
+automount_start()
+{
+
+ /usr/sbin/automount
+}
+
+automount_stop()
+{
+
+ /sbin/umount -At autofs
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/automountd b/etc/rc.d/automountd
new file mode 100644
index 0000000..6d74665
--- /dev/null
+++ b/etc/rc.d/automountd
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: automountd
+# REQUIRE: automount
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="automountd"
+rcvar="autofs_enable"
+pidfile="/var/run/${name}.pid"
+command="/usr/sbin/${name}"
+required_modules="autofs"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/autounmountd b/etc/rc.d/autounmountd
new file mode 100644
index 0000000..c57f90d
--- /dev/null
+++ b/etc/rc.d/autounmountd
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: autounmountd
+# REQUIRE: nfsclient
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="autounmountd"
+rcvar="autofs_enable"
+pidfile="/var/run/${name}.pid"
+command="/usr/sbin/${name}"
+
+load_rc_config $name
+run_rc_command "$1"
OpenPOWER on IntegriCloud