Linux SMB helper


There are too many knobs in different places at the moment: request-keys, idmap, cifscreds, /proc stuff. This goal of this project would be to write one CLI tool that would wrap everything under a common interface. It could handle getting/setting ACL as well. Ideally this would replace and unify all the little tools in cifs-utils.

Implementation

In order of preference:

  • Python + a C python module for the syscalls and other ioctl which would not be so practical from python.
  • Alternatively, all in C++. I'm just tired of plain C for non-critical stuff
  • C + glib maybe.
  • Go/Rust: interesting but will need to be learned

smbmount -- unified utility to manage linux smb mounts

Mounting

# smbmount //UNC /path [opts]
# or
# smbmount mount //UNC /path [opts]

Configuration

list things under "config"

# smbmount config

Debug

smbmount config debug [on|off]
  • make cifs.ko verbose/quiet
  • do something with ftrace?
   echo 'module cifs +p' > /sys/kernel/debug/dynamic_debug/control
   echo 'file fs/cifs/* +p' > /sys/kernel/debug/dynamic_debug/control
   echo 1 > /proc/fs/cifs/cifsFYI
   echo 1 > /sys/module/dns_resolver/parameters/debug

Trace

# smbmount config trace [on|off|???]
  • get/set traceSMB
  • should this be in "config debug"?

DNS

# smbmount config dns
# smbmount config dns cache
  • list entries
# smbmount config dns cache clear
  • clear cache
# smbmount config dns cache expire [time]
  • get/set expire time

DFS

# smbmount config dfs
# smbmount config dfs cache
  • list entries
# smbmount config dfs clear
  • clear cached entries

Credentials

XXX: is "auth" better?

# smbmount config credentials
  • allow to dump/edit in-kernel credentials
  • TODO: this might require kernel changes
  • we could entirely use the keyctl system for creds
  • usecase: password expire or changes and you want to let cifs.ko reconnect without unmount/remounting
# smbmount config kerberos
  • kerberos things
  • TODO: what exactly? figure out what this should include. tickets have to be renewed? how? etc
  • XXX: should this go under "credentials"?

SMB-specific file opts

We would have a verb per operation

# smbmount sid
# smbmount fileinfo
# smbmount acl
# smbmount streams
# smbmount setattr
# smbmount ...
  • TODO: complete

Global information

# smbmount show
  • list things under "show"



# smbmount show connection [-v] [-f filters?]
  • list tcp con, sess, tcon (read DebugData)



# smbmount show mount [-v]
  • list smb mount points with explained mount options



# smbmount show stats [???]
  • compile and list various stats from /proc/fs/cifs