From 3f0e35141d350acafb423a71181e754ced224f01 Mon Sep 17 00:00:00 2001 From: James Adams Date: Thu, 28 Nov 2024 14:22:32 +0000 Subject: [PATCH] ncm-pam: Fix wrapping and indentation in pan --- .../src/main/pan/components/pam/config.pan | 14 +++++++------ .../src/main/pan/components/pam/schema.pan | 4 ++-- ncm-pam/src/test/resources/simple.pan | 21 ++++++++++++------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ncm-pam/src/main/pan/components/pam/config.pan b/ncm-pam/src/main/pan/components/pam/config.pan index f16d22c755..23ce2c5846 100644 --- a/ncm-pam/src/main/pan/components/pam/config.pan +++ b/ncm-pam/src/main/pan/components/pam/config.pan @@ -51,10 +51,12 @@ function pam_add = { options = ARGV[4]; }; }; - ret[service][pamtype][tail] = dict("control", control, - "module", module, - "options", options, - "options_list", options_list); + ret[service][pamtype][tail] = dict( + "control", control, + "module", module, + "options", options, + "options_list", options_list, + ); ret; }; @@ -197,11 +199,11 @@ function pam_add_access_acl = { if(!ret[key]["allowpos"] && permission == "+") { error("PAM access policy for " + key + "does not permit positive acls, discarding " + entry_string); - }; + }; if(!ret[key]["allowneg"] && permission == "-") { error("PAM access policy for " + key + "does not permit negative acls, discarding " + entry_string); - }; + }; tail = length(ret[key][acl]); ret[key][acl][tail] = dict("permission", permission, "users", users, "origins", origins); diff --git a/ncm-pam/src/main/pan/components/pam/schema.pan b/ncm-pam/src/main/pan/components/pam/schema.pan index 5f4e9d9644..6ce55e64e1 100644 --- a/ncm-pam/src/main/pan/components/pam/schema.pan +++ b/ncm-pam/src/main/pan/components/pam/schema.pan @@ -1,4 +1,5 @@ # ${license-info} + # ${developer-info} # ${author-info} @@ -33,7 +34,6 @@ type pam_component_options = extensible { }; type pam_component_listfile_acl = { - "filename" : string "items" : string[] }; @@ -64,7 +64,7 @@ type pam_component_module = { type pam_component_access_entry = { "permission" : string with match(SELF, "^[-+]$") "users" : string - "origins" : string + "origins" : string }; type pam_component_access = { diff --git a/ncm-pam/src/test/resources/simple.pan b/ncm-pam/src/test/resources/simple.pan index ca8e6da681..a46389e24a 100644 --- a/ncm-pam/src/test/resources/simple.pan +++ b/ncm-pam/src/test/resources/simple.pan @@ -12,13 +12,20 @@ prefix "/software/components/pam"; "modules/limits/path" = "/lib/security/$ISA/pam_limits.so"; # configure /etc/pam.d/sshd -"services/sshd/auth" = append(dict("control", "required", "module", "env")); -"services/sshd/password" = append(dict("control", "required", - "module", "include", - "options", dict("service", "/etc/pam.d/system-auth"))); - -"services/sshd/session" = append(dict("control", "required", - "module", "limits")); +"services/sshd/auth" = append(dict( + "control", "required", + "module", "env", +)); +"services/sshd/password" = append(dict( + "control", "required", + "module", "include", + "options", dict("service", "/etc/pam.d/system-auth"), +)); + +"services/sshd/session" = append(dict( + "control", "required", + "module", "limits", +)); # declare an ACL "access/access/acl/0/origins" = "ALL";