summaryrefslogtreecommitdiffstats
path: root/etc/autofs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-08-17 09:44:42 +0000
committertrasz <trasz@FreeBSD.org>2014-08-17 09:44:42 +0000
commitcac9beab7d53f0c37ce2a2a1b893be59028928f4 (patch)
treeb1803eddeeac8277c4ac48d69f5a735564939289 /etc/autofs
parent9bd03869ff37c33e97817d979b3c3039fde1520d (diff)
downloadFreeBSD-src-cac9beab7d53f0c37ce2a2a1b893be59028928f4.zip
FreeBSD-src-cac9beab7d53f0c37ce2a2a1b893be59028928f4.tar.gz
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 MFC after: 2 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'etc/autofs')
-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
4 files changed, 68 insertions, 0 deletions
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$
+#
OpenPOWER on IntegriCloud