From 8da851cdcf3884556bea02511fef054058f7f507 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Jun 2016 00:14:05 +0200 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- .etckeeper | 1 + autofs/auto.master | 2 +- autofs/auto.net | 9 +- autofs/auto.smb | 53 ++++++- autofs/autofs.conf | 371 +++++++++++++++++++++++++++++++++++++++++++++ conf.d/autofs | 130 +--------------- init.d/autofs | 4 +- 7 files changed, 433 insertions(+), 137 deletions(-) create mode 100644 autofs/autofs.conf diff --git a/.etckeeper b/.etckeeper index 469fed1..1fdd321 100755 --- a/.etckeeper +++ b/.etckeeper @@ -337,6 +337,7 @@ maybe chmod 0644 'autofs/auto.master' maybe chmod 0644 'autofs/auto.misc' maybe chmod 0755 'autofs/auto.net' maybe chmod 0755 'autofs/auto.smb' +maybe chmod 0644 'autofs/autofs.conf' maybe chmod 0600 'autofs/autofs_ldap_auth.conf' maybe chmod 0755 'bash' maybe chmod 0644 'bash/bash_logout' diff --git a/autofs/auto.master b/autofs/auto.master index 4b10001..8656474 100644 --- a/autofs/auto.master +++ b/autofs/auto.master @@ -1,4 +1,4 @@ -# $Id: autofs5-auto.master,v 1.1 2011/05/23 08:29:05 pva Exp $ +# $Id$ # Sample auto.master file # This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location diff --git a/autofs/auto.net b/autofs/auto.net index 86b8505..0384f61 100755 --- a/autofs/auto.net +++ b/autofs/auto.net @@ -11,13 +11,6 @@ key="$1" # add "nonstrict" to make it OK for some filesystems to not mount opts="-fstype=nfs,hard,intr,nodev,nosuid" -# Showmount comes in a number of names and varieties. "showmount" is -# typically an older version which accepts the '--no-headers' flag -# but ignores it. "kshowmount" is the newer version installed with knfsd, -# which both accepts and acts on the '--no-headers' flag. -#SHOWMOUNT="kshowmount --no-headers -e $key" -#SHOWMOUNT="showmount -e $key | tail -n +2" - for P in /bin /sbin /usr/bin /usr/sbin do for M in showmount kshowmount @@ -25,7 +18,7 @@ do if [ -x $P/$M ] then SMNT=$P/$M - break + break 2 fi done done diff --git a/autofs/auto.smb b/autofs/auto.smb index 2dfb8f8..6af5d85 100755 --- a/autofs/auto.smb +++ b/autofs/auto.smb @@ -2,6 +2,41 @@ # This file must be executable to work! chmod 755! +# Automagically mount CIFS shares in the network, similar to +# what autofs -hosts does for NFS. + +# Put a line like the following in /etc/auto.master: +# /cifs /etc/auto.smb --timeout=300 +# You'll be able to access Windows and Samba shares in your network +# under /cifs/host.domain/share + +# "smbclient -L" is used to obtain a list of shares from the given host. +# In some environments, this requires valid credentials. + +# This script knows 2 methods to obtain credentials: +# 1) if a credentials file (see mount.cifs(8)) is present +# under /etc/creds/$key, use it. +# 2) Otherwise, try to find a usable kerberos credentials cache +# for the uid of the user that was first to trigger the mount +# and use that. +# If both methods fail, the script will try to obtain the list +# of shares anonymously. + +get_krb5_cache() { + cache= + uid=${UID} + for x in $(ls -d /run/user/$uid/krb5cc_* 2>/dev/null); do + if [ -d "$x" ] && klist -s DIR:"$x"; then + cache=DIR:$x + return + fi + done + if [ -f /tmp/krb5cc_$uid ] && klist -s /tmp/krb5cc_$uid; then + cache=/tmp/krb5cc_$uid + return + fi +} + key="$1" opts="-fstype=cifs" @@ -16,7 +51,23 @@ done [ -x $SMBCLIENT ] || exit 1 -$SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- ' +creds=/etc/creds/$key +if [ -f "$creds" ]; then + opts="$opts"',uid=$UID,gid=$GID,credentials='"$creds" + smbopts="-A $creds" +else + get_krb5_cache + if [ -n "$cache" ]; then + opts="$opts"',multiuser,cruid=$UID,sec=krb5i' + smbopts="-k" + export KRB5CCNAME=$cache + else + opts="$opts"',guest' + smbopts="-N" + fi +fi + +$SMBCLIENT $smbopts -gL "$key" 2>/dev/null| awk -v "key=$key" -v "opts=$opts" -F '|' -- ' BEGIN { ORS=""; first=1 } /Disk/ { if (first) diff --git a/autofs/autofs.conf b/autofs/autofs.conf new file mode 100644 index 0000000..6d5a213 --- /dev/null +++ b/autofs/autofs.conf @@ -0,0 +1,371 @@ +# +# Define default options for autofs. +# +[ autofs ] +# +# master_map_name - default map name for the master map. +# +#master_map_name = auto.master +# +# timeout - set the default mount timeout in secons. The internal +# program default is 10 minutes, but the default installed +# configuration overrides this and sets the timeout to 5 +# minutes to be consistent with earlier autofs releases. +# +timeout = 300 +# +# negative_timeout - set the default negative timeout for +# failed mount attempts (default 60). +# +#negative_timeout = 60 +# +# mount_wait - time to wait for a response from mount(8). +# Setting this timeout can cause problems when +# mount would otherwise wait for a server that +# is temporarily unavailable, such as when it's +# restarting. The default setting (-1) of waiting +# for mount(8) usually results in a wait of around +# 3 minutes. +# +#mount_wait = -1 +# +# umount_wait - time to wait for a response from umount(8). +# +#umount_wait = 12 +# +# browse_mode - maps are browsable by default. +# +browse_mode = no +# +# mount_nfs_default_protocol - specify the default protocol used by +# mount.nfs(8). Since we can't identify +# the default automatically we need to +# set it in our configuration. +# +#mount_nfs_default_protocol = 3 +# +# append_options - append to global options instead of replace. +# +#append_options = yes +# +# logging - set default log level "none", "verbose" or "debug" +# +#logging = none +# +# force_standard_program_map_env - disable the use of the "AUTOFS_" +# prefix for standard environemt variables when +# executing a program map. Since program maps +# are run as the privileded user this opens +# automount(8) to potential user privilege +# escalation when the program map is written +# in a language that can load components from, +# for example, a user home directory. +# +# force_standard_program_map_env = no +# +# Define base dn for map dn lookup. +# +# Define server URIs +# +# ldap_uri - space seperated list of server uris of the form +# ://[/] where can be ldap +# or ldaps. The option can be given multiple times. +# Map entries that include a server name override +# this option. +# +# This configuration option can also be used to +# request autofs lookup SRV RRs for a domain of +# the form :///[]. Note that a +# trailing "/" is not allowed when using this form. +# If the domain dn is not specified the dns domain +# name (if any) is used to construct the domain dn +# for the SRV RR lookup. The server list returned +# from an SRV RR lookup is refreshed according to +# the minimum ttl found in the SRV RR records or +# after one hour, whichever is less. +# +#ldap_uri = "" +# +# ldap_timeout - timeout value for the synchronous API calls +# (default is LDAP library default). +# +#ldap_timeout = -1 +# +# ldap_network_timeout - set the network response timeout (default 8). +# +#ldap_network_timeout = 8 +# +# search_base - base dn to use for searching for map search dn. +# Multiple entries can be given and they are checked +# in the order they occur here. +# +#search_base = "" +# +# Define the LDAP schema to used for lookups +# +# If no schema is set autofs will check each of the schemas +# below in the order given to try and locate an appropriate +# basdn for lookups. If you want to minimize the number of +# queries to the server set the values here. +# +#map_object_class = nisMap +#entry_object_class = nisObject +#map_attribute = nisMapName +#entry_attribute = cn +#value_attribute= nisMapEntry +# +# Other common LDAP nameing +# +#map_object_class = automountMap +#entry_object_class = automount +#map_attribute = ou +#entry_attribute = cn +#value_attribute= automountInformation +# +#map_object_class = automountMap +#entry_object_class = automount +#map_attribute = automountMapName +#entry_attribute = automountKey +#value_attribute= automountInformation +# +# auth_conf_file - set the default location for the SASL +# authentication configuration file. +# +#auth_conf_file = /etc/autofs/autofs_ldap_auth.conf +# +# map_hash_table_size - set the map cache hash table size. +# Should be a power of 2 with a ratio of +# close to 1:8 for acceptable performance +# with maps up to around 8000 entries. +# See autofs.conf(5) for more details. +# +#map_hash_table_size = 1024 +# +# use_hostname_for_mounts - nfs mounts where the host name resolves +# to more than one IP address normally need +# to use the IP address to esure a mount to +# a host that isn't responding isn't done. +# If that behaviour is not wanted then set +# ths to "yes", default is "no". +# +#use_hostname_for_mounts = "no" +# +# Otions for the amd parser within autofs. +# +# amd configuration options that are aren't used, haven't been +# implemented or have different behaviour within autofs. +# +# A number of the amd configuration options are not used by autofs, +# some because they are not relevant within autofs, some because +# they are done differently in autofs and others that are not yet +# implemented. +# +# Since "mount_type" is always autofs (because there's no user space +# NFS server) the configuration entries relating to that aren't used. +# Also, server availability is done differently within autofs so the +# options that relate to the amd server monitoring sub-system are +# also not used. +# +# These options are mount_type, auto_attrcache, portmap_program, +# nfs_vers_ping, nfs_allow_any_interface, nfs_allow_insecure_port, +# nfs_proto, nfs_retransmit_counter, nfs_retransmit_counter_udp, +# nfs_retransmit_counter_tcp, nfs_retransmit_counter_toplvl, +# nfs_retry_interval, nfs_retry_interval_udp, nfs_retry_interval_tcp, +# nfs_retry_interval_toplvl and nfs_vers. +# +# +# Other options that are not used within the autofs implementation: +# +# log_file, truncate_log - autofs used either stderr when running in +# the foreground or sends its output to syslog so an alternate +# log file (or truncating the log) can't be used. +# +# print_pid - there's no corresponding option for this within autofs. +# +# use_tcpwrappers, show_statfs_entries - there's no user space NFS +# server to control access to so this option isn't relevant. +# The show_statfs_entries can't be implemented for the same +# reason. +# +# debug_mtab_file - there's no user space NFS server and autofs +# avoids using file based mtab whenever possible. +# +# sun_map_syntax - obviously, are provided by autofs itself. +# +# plock, show_statfs_entries, preferred_amq_port - not supported. +# +# ldap_cache_maxmem, ldap_cache_seconds - external ldap caching +# is not used by autofs. +# +# ldap_proto_version - autofs always attempts to use the highest +# available ldap protocol version. +# +# cache_duration, map_reload_interval, map_options - the map +# entry cache is continually updated and stale entries +# cleaned on re-load, which is done when map changes are +# detected so these configuration entries are not used +# by autofs. +# +# localhost_address - is not used within autofs. This +# configuration option was only used in the amd user +# space server code and is not relevant within autofs. +# +# +# Options that are handled differently within autofs: +# +# pid_file - must be given as a command line option on startup. +# +# print_version - program version and feature information is obtained +# by using the automount command line option "-V". +# +# debug_options, log_options - autofs has somewhat more limited +# logging and debug logging options. When the log_options +# options is encountered it is converted to the nearest +# matching autofs logging option. Since the configuration +# option debug_options would be handled the same way it +# is ignored. +# +# restart_mounts - has no sensible meaning within autofs because autofs +# always tries to re-connect to existing mounts. While this +# has its own set of problems not re-connecting to existing +# mounts always results in a non-functional automount tree if +# mounts were busy at the last shutdown (as is also the case +# with amd when using mount_type autofs). +# +# forced_unmounts - detaching mounts often causes serious problems +# for users of existing mounts. It is used by autofs in some +# cases, either at the explicit request of the user (with a +# command line or init option) and in some special cases during +# program operation but is avoided whenever possible. +# +# +# A number of configuration options are not yet implemented: +# +# fully_qualified_hosts - not yet implemented. +# +# unmount_on_exit - since autofs always tries to re-connect +# to mounts left mounted from a previous shutdown this +# is a sensible option to implement and that will be +# done. +# +# browsable_dirs - not yet implemented. +# +# exec_map_timeout - a timeout is not currently used for +# for program maps, might be implemented. +# +# tag - the tag option is not implemented within autofs. +# +# +# Supported options: +# +# arch, karch, os, osver - these options default to what is returned +# from uname(2) and can be overridden if required. +# +# full_os - has no default and must be set in the configuration +# if used in maps. +# +# cluster - if not set defaults to the host domain name. This option +# corresponds to the HP_UX cluster name (according to the amd +# source) and is probably not used in Linux but is set anyway. +# +# vendor - has a default value of "unknown", it must be set in the +# configuration if used in maps. +# +# auto_dir - is the base name of the mount tree used for external +# mounts that are sometimes needed by amd maps. Its default +# value is "/a". +# +# map_type - specifies the autofs map source, such as file, nis, +# ldap etc. and has no default value set. +# +# map_defaults - is used to override /defaults entries within maps +# and can be used to provide different defaults on specific +# machines without having to modify centrally managed maps. +# It is empty by default. +# +# search_path - colon seperated paths to search for maps that +# are not specified as a full path. +# +# dismount_interval - is equivalent to the autofs timeout option. It +# is only possible to use this with type "auto" mounts due +# to the way the autofs kernel module performs expiry. It +# takes its default value from the autofs internal default +# of 600 seconds. +# +# autofs_use_lofs - if set to "yes" autofs will attempt to use bind +# mounts for type "auto" when possible. +# +# nis_domain - allows setting of a domain name other than the system +# default. +# +# local_domain - is used to override (or set) the host domain name. +# +# normalize_hostnames - if set to "yes" then the contents of ${rhost} +# is translated in its official host name. +# +# domain_strip - if set to "yes" the domain name part of the host +# is strippped when normalizing hostnames. This can be useful +# when using of the same maps in a multiple domain environment. +# +# normalize_slashes - is set to "yes" by default and will collapse +# multiple unescaped occurrences of "/" to a single "/". +# +# selectors_in_defaults, selectors_on_default - has a default value +# of "no". If set to "yes" then any defaults entry will be +# checked for selectors to determine the values to be used. +# selectors_in_defaults is the preferred option to use. +# +# ldap_base - has no default value. It must be set to the base dn +# that is used for queries if ldap is to be used as a map +# source. +# +# ldap_hostports - has no default value set. It must be set to +# the URI of the LDAP server to be used for lookups when +# ldap is used a map source. It may contain a comma or +# space seperated list of LDAP URIs. +# +# hesiod_base - the base name used for hesiod map sources. +# +# Additional configuration options added: +# +# linux_ufs_mount_type - set the default system filesystem type that's +# used for mount type ufs. There's no simple way to determine +# what the system default filesystem is and am-utils needs to +# be continually updated to do this and can easily get it wrong +# anyway. +# +# +# Define global options for the amd parser within autofs. +# +[ amd ] +# +# Override the internal default with the same timeout that +# is used by the override in the autofs configuration, sanity +# only change. +# +dismount_interval = 300 +# +# map_type = file +# +# Overriding this can cause autofs to use less resources because +# it will use symlinks instead of bind mounts in certain cases. +# You should ensure that the autofs kernel module your using +# supports expration of symlinks for best results (although this +# appears to work reasonably well most of the time without the +# update). +# +# autofs_use_lofs = yes +# +# Several configuration options can be set per mount point. +# In particulr map_type, map_name, map_defaults, search_path, +# browsable_dirs, dismount_interval and selectors_in_defaults +# (not all of which are currently implemented, see above). +# +# Also, if a section for an amd mount point is defined here +# it isn't necessary to specify the format in the corresponding +# master map entry and the format will be inherited for type +# "auto" mounts. +# +# [ /expamle/mount ] +# dismount_interval = 60 +# map_type = nis diff --git a/conf.d/autofs b/conf.d/autofs index 86f7c30..2ca53ff 100644 --- a/conf.d/autofs +++ b/conf.d/autofs @@ -1,134 +1,14 @@ # -# Define default options for autofs. -# -# MASTER_MAP_NAME - default map name for the master map. -# -#MASTER_MAP_NAME="auto.master" -# -# TIMEOUT - set the default mount timeout (default 600). -# -TIMEOUT=300 -# -# NEGATIVE_TIMEOUT - set the default negative timeout for -# failed mount attempts (default 60). -# -#NEGATIVE_TIMEOUT=60 -# -# MOUNT_WAIT - time to wait for a response from mount(8). -# Setting this timeout can cause problems when -# mount would otherwise wait for a server that -# is temporarily unavailable, such as when it's -# restarting. The default setting (-1) of waiting -# for mount(8) usually results in a wait of around -# 3 minutes. -# -#MOUNT_WAIT=-1 -# -# UMOUNT_WAIT - time to wait for a response from umount(8). -# -#UMOUNT_WAIT=12 -# -# BROWSE_MODE - maps are browsable by default. -# -BROWSE_MODE="no" -# -# MOUNT_NFS_DEFAULT_PROTOCOL - specify the default protocol used by -# mount.nfs(8). Since we can't identify -# the default automatically we need to -# set it in our configuration. -# -#MOUNT_NFS_DEFAULT_PROTOCOL=3 -# -# APPEND_OPTIONS - append to global options instead of replace. -# -#APPEND_OPTIONS="yes" -# -# LOGGING - set default log level "none", "verbose" or "debug" -# -#LOGGING="none" -# -# Define server URIs -# -# LDAP_URI - space seperated list of server uris of the form -# ://[/] where can be ldap -# or ldaps. The option can be given multiple times. -# Map entries that include a server name override -# this option. -# -# This configuration option can also be used to -# request autofs lookup SRV RRs for a domain of -# the form :///[]. Note that a -# trailing "/" is not allowed when using this form. -# If the domain dn is not specified the dns domain -# name (if any) is used to construct the domain dn -# for the SRV RR lookup. The server list returned -# from an SRV RR lookup is refreshed according to -# the minimum ttl found in the SRV RR records or -# after one hour, whichever is less. -# -#LDAP_URI="" -# -# LDAP__TIMEOUT - timeout value for the synchronous API calls -# (default is LDAP library default). -# -#LDAP_TIMEOUT=-1 -# -# LDAP_NETWORK_TIMEOUT - set the network response timeout (default 8). -# -#LDAP_NETWORK_TIMEOUT=8 -# -# Define base dn for map dn lookup. -# -# SEARCH_BASE - base dn to use for searching for map search dn. -# Multiple entries can be given and they are checked -# in the order they occur here. -# -#SEARCH_BASE="" -# -# Define the LDAP schema to used for lookups -# -# If no schema is set autofs will check each of the schemas -# below in the order given to try and locate an appropriate -# basdn for lookups. If you want to minimize the number of -# queries to the server set the values here. -# -#MAP_OBJECT_CLASS="nisMap" -#ENTRY_OBJECT_CLASS="nisObject" -#MAP_ATTRIBUTE="nisMapName" -#ENTRY_ATTRIBUTE="cn" -#VALUE_ATTRIBUTE="nisMapEntry" -# -# Other common LDAP nameing -# -#MAP_OBJECT_CLASS="automountMap" -#ENTRY_OBJECT_CLASS="automount" -#MAP_ATTRIBUTE="ou" -#ENTRY_ATTRIBUTE="cn" -#VALUE_ATTRIBUTE="automountInformation" -# -#MAP_OBJECT_CLASS="automountMap" -#ENTRY_OBJECT_CLASS="automount" -#MAP_ATTRIBUTE="automountMapName" -#ENTRY_ATTRIBUTE="automountKey" -#VALUE_ATTRIBUTE="automountInformation" -# -# AUTH_CONF_FILE - set the default location for the SASL -# authentication configuration file. -# -#AUTH_CONF_FILE="/etc/autofs/autofs_ldap_auth.conf" -# -# MAP_HASH_TABLE_SIZE - set the map cache hash table size. -# Should be a power of 2 with a ratio roughly -# between 1:10 and 1:20 for each map. -# -#MAP_HASH_TABLE_SIZE=1024 -# -# General global options +# Init syatem options # # If the kernel supports using the autofs miscellanous device # and you wish to use it you must set this configuration option # to "yes" otherwise it will not be used. +# USE_MISC_DEVICE="yes" # +# Use OPTIONS to add automount(8) command line options that +# will be used when the daemon is started. +# #OPTIONS="" # diff --git a/init.d/autofs b/init.d/autofs index 939444e..0de4f49 100755 --- a/init.d/autofs +++ b/init.d/autofs @@ -1,7 +1,7 @@ -#!/sbin/runscript +#!/sbin/openrc-run # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs5.initd,v 1.4 2013/11/10 15:53:29 tomwij Exp $ +# $Id$ DAEMON=/usr/sbin/automount PIDFILE=/var/run/autofs.pid -- 2.39.5