Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncm-pam: Fix wrapping and indentation in pan #1772

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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