Categories
Cache Development Linux Plugins Ubuntu

mount failing on /etc/NetworkManager/dispatcher.d/

I have a script that tries to mount a cifs share when the VPN is connected (after I’ve already logged in to the desktop – so kerberos ticket is issued).
It’s in :
/etc/NetworkManager/dispatcher.d/

#!/bin/bash

INTERFACE="$1"
STATUS="$2"

if [ "$STATUS" = "up" ]; then
        if [ "$INTERFACE" = "vpn0" -o "$INTERFACE" = "cscotun0" ]; then
        mount /home/eekfonky/homeDrive
        fi
fi

It fails with the error in /var/syslog:

dispatcher: (82) zz-mount-dfs failed (failed): Script '/etc/NetworkManager/dispatcher.d/zz-mount-dfs' exited with error status 32.

The script is rooot:root with 755 permissions

Yet if I run the command :

mount /home/eekfonky/homeDrive

from my user OR as root it works fine.

/etc/fstab for reference:

# Active Directory Home Folder
//ant/home/ad-dir/eekfonky   /home/eekfonky/homeDrive  cifs  x-systemd.device-timeout=15,cruid=eekfonky,sec=krb5,noauto,users,noserverino,vers=2.1,rw 0   0

EDIT:
After enabling logging I found this;

$ sudo dmesg
[  576.237469] audit: type=1400 audit(1575188953.283:35): apparmor="ALLOWED" operation="open" profile="/usr/sbin/sssd" name="/sys/devices/virtual/net/vpn0/type" pid=1600 comm="sssd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[  576.239247] audit: type=1400 audit(1575188953.287:36): apparmor="ALLOWED" operation="open" profile="/usr/sbin/sssd" name="/sys/devices/virtual/net/vpn0/type" pid=1600 comm="sssd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[  576.916780] /build/linux-WKYm23/linux-4.15.0/fs/cifs/cifsfs.c: Devname: //ant/home/ad-dir/eekfonky flags: 0
[  576.916803] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: Username: root
[  576.919659] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: file mode: 0x1ed  dir mode: 0x1ed
[  576.919662] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 0 with uid: 0
[  576.919663] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: UNC: \\ant\home
[  576.919677] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: Socket created
[  576.919679] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x6d6
[  577.116792] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: Demultiplex PID: 10008
[  577.116794] /build/linux-WKYm23/linux-4.15.0/fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0x00000000ddc65715/0x00000000371ab3e3)
[  577.116797] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 1 with uid: 0
[  577.116798] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: Existing smb sess not found
[  577.116803] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2pdu.c: Negotiate protocol
[  577.116808] /build/linux-WKYm23/linux-4.15.0/fs/cifs/transport.c: Sending smb: smb_len=102
[  577.314065] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: RFC1002 header 0xf8
[  577.314072] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2misc.c: smb2_check_message length: 0xfc, smb_buf_length: 0xf8
[  577.314074] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2misc.c: SMB2 data length 120 offset 128
[  577.314076] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2misc.c: SMB2 len 252
[  577.314087] /build/linux-WKYm23/linux-4.15.0/fs/cifs/transport.c: cifs_sync_mid_result: cmd=0 mid=0 state=4
[  577.314089] /build/linux-WKYm23/linux-4.15.0/fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  577.314091] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2pdu.c: mode 0x1
[  577.314092] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2pdu.c: negotiated smb2.1 dialect
[  577.314095] /build/linux-WKYm23/linux-4.15.0/fs/cifs/asn1.c: OID len = 10 oid = 0x1 0x3 0x6 0x1
[  577.314096] /build/linux-WKYm23/linux-4.15.0/fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0xbb92
[  577.314097] /build/linux-WKYm23/linux-4.15.0/fs/cifs/asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0x1bb92
[  577.314097] /build/linux-WKYm23/linux-4.15.0/fs/cifs/asn1.c: OID len = 8 oid = 0x1 0x2 0x348 0x1bb92
[  577.314098] /build/linux-WKYm23/linux-4.15.0/fs/cifs/asn1.c: OID len = 10 oid = 0x1 0x3 0x6 0x1
[  577.314100] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: Security Mode: 0x1 Capabilities: 0x300007 TimeAdjust: 0
[  577.314100] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2pdu.c: Session Setup
[  577.314101] /build/linux-WKYm23/linux-4.15.0/fs/cifs/smb2pdu.c: sess setup type 5
[  577.314105] /build/linux-WKYm23/linux-4.15.0/fs/cifs/cifs_spnego.c: key description = ver=0x2;host=ant;ip4=10.1.103.201;sec=krb5;uid=0x0;creduid=0x25a9dede;user=root;pid=0x26fe
[  577.342612] CIFS VFS: Send error in SessSetup = -126
[  577.342617] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 1) rc = -126
[  577.342620] /build/linux-WKYm23/linux-4.15.0/fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0x00000000ddc65715/0x00000000371ab3e3)
[  577.342625] /build/linux-WKYm23/linux-4.15.0/fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 0) rc = -126
[  577.342625] CIFS VFS: cifs_mount failed w/return code = -126
[  577.412402] audit: type=1400 audit(1575188954.459:37): apparmor="ALLOWED" operation="open" profile="/usr/sbin/sssd" name="/run/systemd/users/631889630" pid=10027 comm="krb5_child" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[  577.582719] audit: type=1400 audit(1575188954.631:38): apparmor="ALLOWED" operation="file_mmap" profile="/usr/sbin/sssd" name="/usr/lib/x86_64-linux-gnu/krb5/plugins/authdata/sssd_pac_plugin.so" pid=10027 comm="krb5_child" requested_mask="m" denied_mask="m" fsuid=631889630 ouid=0
[  577.614868] audit: type=1400 audit(1575188954.663:39): apparmor="ALLOWED" operation="exec" profile="/usr/sbin/sssd" name="/usr/sbin/adcli" pid=10043 comm="sssd_be" requested_mask="x" denied_mask="x" fsuid=0 ouid=0 target="/usr/sbin/sssd//null-/usr/sbin/adcli"
[  577.615669] audit: type=1400 audit(1575188954.663:40): apparmor="ALLOWED" operation="file_inherit" profile="/usr/sbin/sssd//null-/usr/sbin/adcli" name="/var/log/sssd/ldap_child.log" pid=10043 comm="adcli" requested_mask="a" denied_mask="a" fsuid=0 ouid=0
[  577.615672] audit: type=1400 audit(1575188954.663:41): apparmor="ALLOWED" operation="file_inherit" profile="/usr/sbin/sssd//null-/usr/sbin/adcli" name="/var/log/sssd/krb5_child.log" pid=10043 comm="adcli" requested_mask="a" denied_mask="a" fsuid=0 ouid=0
[  577.615673] audit: type=1400 audit(1575188954.663:42): apparmor="ALLOWED" operation="file_inherit" profile="/usr/sbin/sssd//null-/usr/sbin/adcli" name="/var/log/sssd/gpo_child.log" pid=10043 comm="adcli" requested_mask="a" denied_mask="a" fsuid=0 ouid=0
[  577.615969] audit: type=1400 audit(1575188954.663:43): apparmor="ALLOWED" operation="file_mmap" profile="/usr/sbin/sssd//null-/usr/sbin/adcli" name="/usr/sbin/adcli" pid=10043 comm="adcli" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
[  577.615972] audit: type=1400 audit(1575188954.663:44): apparmor="ALLOWED" operation="file_mmap" profile="/usr/sbin/sssd//null-/usr/sbin/adcli" name="/lib/x86_64-linux-gnu/ld-2.27.so" pid=10043 comm="adcli" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0

Leave a Reply

Your email address will not be published. Required fields are marked *