Skip to content

Commit

Permalink
Merge pull request #1772 from jrha/cleanup-pam
Browse files Browse the repository at this point in the history
ncm-pam: Fix wrapping and indentation in pan
  • Loading branch information
jrha authored Dec 5, 2024
2 parents aeaa536 + 3f0e351 commit 934cfac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
14 changes: 8 additions & 6 deletions ncm-pam/src/main/pan/components/pam/config.pan
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ncm-pam/src/main/pan/components/pam/schema.pan
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ${license-info}

# ${developer-info}
# ${author-info}

Expand Down Expand Up @@ -33,7 +34,6 @@ type pam_component_options = extensible {
};

type pam_component_listfile_acl = {

"filename" : string
"items" : string[]
};
Expand Down Expand Up @@ -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 = {
Expand Down
21 changes: 14 additions & 7 deletions ncm-pam/src/test/resources/simple.pan
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 934cfac

Please sign in to comment.