diff options
author | Cullum Smith <cullum@sacredheartsc.com> | 2024-10-18 23:40:11 -0400 |
---|---|---|
committer | Cullum Smith <cullum@sacredheartsc.com> | 2024-10-18 23:40:11 -0400 |
commit | 18e46bcafc2316c53d167cf6550fb69bd4e3be79 (patch) | |
tree | 1fc3793e0e4b7054f0f8438734d088b69ec46bde /scripts | |
parent | 230d46c72aea54a5f824052c8fa73148d89570dd (diff) | |
download | infrastructure-18e46bcafc2316c53d167cf6550fb69bd4e3be79.tar.gz |
add more automount dirs (need to clean this up)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/hostclass/idm_server/10-slapd | 9 | ||||
-rw-r--r-- | scripts/hostname/nfs1 | 131 |
2 files changed, 118 insertions, 22 deletions
diff --git a/scripts/hostclass/idm_server/10-slapd b/scripts/hostclass/idm_server/10-slapd index f6c9b4a..d01db70 100644 --- a/scripts/hostclass/idm_server/10-slapd +++ b/scripts/hostclass/idm_server/10-slapd @@ -185,15 +185,6 @@ EOF objectClass: automountMap automountMapName: auto_master EOF - ldap_add "automountKey=/home,automountMapName=auto_master,${automount_basedn}" <<EOF -objectClass: automount -automountKey: /home -automountInformation: auto_home -EOF - ldap_add "automountMapName=auto_home,${automount_basedn}" <<EOF -objectClass: automountMap -automountMapName: auto_home -EOF # ou=sudo,dc=example,dc=com ldap_add "$sudo_basedn" <<EOF diff --git a/scripts/hostname/nfs1 b/scripts/hostname/nfs1 index 98d5bcc..673c7a9 100644 --- a/scripts/hostname/nfs1 +++ b/scripts/hostname/nfs1 @@ -1,18 +1,59 @@ #!/bin/sh -homedir_priv_quota=250G -homedir_pub_quota=10G +nfs_mount_opts='-nfsv4,gssname=host,sec=krb5p' -create_dataset "${nfs_dataset}/user" -create_dataset "${nfs_dataset}/group" +default_priv_quota=250G +default_pub_quota=10G -for user in ${nfs_homedirs:-}; do - create_dataset "${nfs_dataset}/user/${user}" - create_dataset "${nfs_dataset}/user/${user}/priv" - create_dataset "${nfs_dataset}/user/${user}/pub" +# Add /home autofs map. +ldap_add "automountKey=/home,automountMapName=auto_master,${automount_basedn}" <<EOF +objectClass: automount +automountKey: /home +automountInformation: auto_home ${nfs_mount_opts} +EOF +ldap_add "automountMapName=auto_home,${automount_basedn}" <<EOF +objectClass: automountMap +automountMapName: auto_home +EOF +ldap_add "automountKey=*,automountMapName=auto_home,${automount_basedn}" <<EOF +objectClass: automount +automountKey: * +automountInformation: ${fqdn}:/user/&/priv +EOF + +# Create /- (direct) autofs map +ldap_add "automountKey=/-,automountMapName=auto_master,${automount_basedn}" <<EOF +objectClass: automount +automountKey: /- +automountInformation: auto_direct ${nfs_mount_opts} +EOF +ldap_add "automountMapName=auto_direct,${automount_basedn}" <<EOF +objectClass: automountMap +automountMapName: auto_direct +EOF - zfs set "refquota=${homedir_priv_quota}" "${nfs_dataset}/user/${user}/priv" - zfs set "refquota=${homedir_pub_quota}" "${nfs_dataset}/user/${user}/pub" +# Create /nfs/user autofs map. +ldap_add "automountKey=/nfs/user,automountMapName=auto_master,${automount_basedn}" <<EOF +objectClass: automount +automountKey: /nfs/user +automountInformation: auto_user ${nfs_mount_opts} +EOF +ldap_add "automountMapName=auto_user,${automount_basedn}" <<EOF +objectClass: automountMap +automountMapName: auto_user +EOF + +# Create user home directories. +for userquota in ${nfs_homedirs:-}; do + user=$(echo "$userquota" | awk -F: '{print $1}') + privquota=$(echo "$userquota" | awk -F: '{print $2}') + pubquota=$(echo "$userquota" | awk -F: '{print $3}') + + create_dataset -p "${nfs_dataset}/user/${user}/priv" + create_dataset -p "${nfs_dataset}/user/${user}/pub" + + zfs set "refquota=${privquota:-$default_priv_quota}" "${nfs_dataset}/user/${user}/priv" + zfs set "refquota=${pubquota:-$default_pub_quota}" "${nfs_dataset}/user/${user}/pub" chown "${user}:${user}" \ "${nfs_root}/user/${user}/priv" \ @@ -20,10 +61,74 @@ for user in ${nfs_homedirs:-}; do chmod 700 "${nfs_root}/user/${user}/priv" chmod 755 "${nfs_root}/user/${user}/pub" + + # Create user autofs key. + ldap_add "automountKey=${user},automountMapName=auto_user,${automount_basedn}" <<EOF +objectClass: automount +automountKey: ${user} +automountInformation: /priv ${fqdn}:/user/&/priv /pub ${fqdn}:/user/&/pub +EOF done - ldap_add "automountKey=*,automountMapName=auto_home,${automount_basedn}" <<EOF +# Add /nfs/group autofs map. +ldap_add "automountKey=/nfs/group,automountMapName=auto_master,${automount_basedn}" <<EOF objectClass: automount -automountKey: * -automountInformation: -nfsv4,gssname=host,sec=krb5p ${fqdn}:/user/&/priv +automountKey: /nfs/group +automountInformation: auto_group ${nfs_mount_opts} +EOF +ldap_add "automountMapName=auto_group,${automount_basedn}" <<EOF +objectClass: automountMap +automountMapName: auto_group +EOF + +# Create group home directories. +for groupquota in ${nfs_groupdirs:-}; do + group=$(echo "$groupquota" | awk -F: '{print $1}') + privquota=$(echo "$groupquota" | awk -F: '{print $2}') + pubquota=$(echo "$groupquota" | awk -F: '{print $3}') + + create_dataset -p "${nfs_dataset}/group/${group}/priv" + create_dataset -p "${nfs_dataset}/group/${group}/pub" + + zfs set "refquota=${privquota:-$default_priv_quota}" "${nfs_dataset}/group/${group}/priv" + zfs set "refquota=${pubquota:-$default_pub_quota}" "${nfs_dataset}/group/${group}/pub" + + chown "root:${group}" \ + "${nfs_root}/group/${group}/priv" \ + "${nfs_root}/group/${group}/pub" + + chmod 770 "${nfs_root}/group/${group}/priv" + chmod 775 "${nfs_root}/group/${group}/pub" + + # Create group autofs key. + ldap_add "automountKey=${group},automountMapName=auto_group,${automount_basedn}" <<EOF +objectClass: automount +automountKey: ${group} +automountInformation: /priv ${fqdn}:/group/&/priv /pub ${fqdn}:/group/&/pub +EOF +done + +# Add /nfs/media autofs map. +ldap_add "automountMapName=auto_media,${automount_basedn}" <<EOF +objectClass: automountMap +automountMapName: auto_media +EOF +ldap_add "automountKey=/nfs/media,automountMapName=auto_master,${automount_basedn}" <<EOF +objectClass: automount +automountKey: /nfs/media +automountInformation: auto_media ${nfs_mount_opts} +EOF + +# Create music dataset. +create_dataset -p "${nfs_dataset}/media/music" + +# Set music ACLs. +chgrp media-admin "${nfs_root}/media/music" +chmod 770 "${nfs_root}/media/music" + +# Create music autofs key. +ldap_add "automountKey=music,automountMapName=auto_media,${automount_basedn}" <<EOF +objectClass: automount +automountKey: music +automountInformation: ${fqdn}:/media/music EOF |