Skip to contentSkip to conversation

server41tests: Test READ and WRITE alongside machine-credential cleanup

PATCH New Chuck Lever 1 participant 1 message Dec 3

Subsystems (2)
lore
Share & tools
lore

Chuck Lever

author maintainer
#0 lore raw

PATCH 1/1 server41tests: Test READ and WRITE alongside machine-credential cleanup

RFC 8881 Section 18.35.3 lets a client ID that uses SP4_MACH_CRED send only the operations in spo_must_allow with the machine credential. A server that looks only for one spo_must_allow operation in a COMPOUND lets a READ or WRITE in the same COMPOUND bypass the export's sec= list. No test covers that case.

Add MACHCRED1 through MACHCRED8. Each opens a file with krb5p on an export that permits only krb5p. With the krb5i machine credential, each then sends PUTFH, a READ or WRITE, and a CLOSE, OPEN_DOWNGRADE, LOCKU, or DELEGRETURN, and expects NFS4ERR_WRONGSEC. PUTFH followed by the spo_must_allow operation alone has to succeed. MACHCRED7 and MACHCRED8 report UNSUPPORTED when the server does not grant a delegation. Add a --krb5pdir option to name the directory. The tests report UNSUPPORTED without --krb5pdir or --security=krb5i.

---
 nfs4.1/server41tests/__init__.py     |   1 +
 nfs4.1/server41tests/st_mach_cred.py | 210 +++++++++++++++++++++++++++
 nfs4.1/testserver.py                 |  11 ++
 3 files changed, 222 insertions(+)
 create mode 100644 nfs4.1/server41tests/st_mach_cred.py
nfs4.1/server41tests/__init__.py +1 -0
index c654212c617e..9141c1ea1933 100644
@@ -7,6 +7,7 @@ __all__ = ["st_exchange_id.py", # draft 21
            "st_reclaim_complete.py",
            "st_secinfo_no_name.py",
            "st_secinfo.py",
+           "st_mach_cred.py",
            "st_sequence.py",
            "st_trunking.py",
            "st_open.py",
nfs4.1/server41tests/st_mach_cred.py new file +210 -0

210 lines not on this page · raw message

nfs4.1/testserver.py +11 -0
index f38279b36cba..a769fe360547 100755
@@ -151,6 +151,9 @@ def scan_options(p):
                  help="Use SERVER:/DIRPATH for ROFS tests")
     g.add_option("--usefh", default=None, metavar="FH",
                  help="Use FH for certain specialized tests")
+    g.add_option("--krb5pdir", default=None, metavar="DIRPATH",
+                 help="Use SERVER:/DIRPATH, on an export that permits "
+                 "only sec=krb5p, for the SP4_MACH_CRED tests")
     p.add_option_group(g)
 
     g = OptionGroup(p, "Inter-server copy options",
@@ -296,6 +299,14 @@ def main():
                     p.error(e)
             setattr(opt, attr, [comp for comp in path if comp])
 
+    # --krb5pdir has no default, so the tests that need it can skip
+    if opt.krb5pdir is not None:
+        try:
+            path = nfs4lib.path_components(os.fsencode(opt.krb5pdir))
+        except Exception as e:
+            p.error(e)
+        opt.krb5pdir = [comp for comp in path if comp]
+
     # Check that --security option is valid
     # FIXME STUB
     tempd = {'none' : (rpc.AUTH_NONE, 0),
Signature · 1 line
2.56.0