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

Add --kerberos-access option #142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions tests/test_kerberosaccess.podman.cil
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(block my_container
(blockinherit container)
(blockinherit kerberos_container)
(allow process process ( capability ( audit_write chown dac_override fowner fsetid kill mknod net_bind_service net_raw setfcap setgid setpcap setuid sys_chroot )))

)
14 changes: 14 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,20 @@ def test_ttyaccess_podman(self):
self.assert_templates(output, ["base_container", "tty_container"])
self.assert_policy(test_file("test_ttyaccess.podman.cil"))

def test_kerberosaccess_podman(self):
"""podman run fedora"""
output = self.run_udica(
[
"udica",
"-j",
"tests/test_default.podman.json",
"--kerberos-access",
"my_container",
]
)
self.assert_templates(output, ["base_container", "kerberos_container"])
self.assert_policy(test_file("test_kerberosaccess.podman.cil"))

def test_append_more_rules_podman(self):
"""podman run fedora"""
output = self.run_udica(
Expand Down
7 changes: 7 additions & 0 deletions udica/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ def get_args():
dest="VirtAccess",
action="store_true",
)
parser.add_argument(
"--kerberos-access",
help="Allow container to use Kerberos authentication ",
required=False,
dest="KerberosAccess",
action="store_true",
)
parser.add_argument(
"-s",
"--stream-connect",
Expand Down
4 changes: 4 additions & 0 deletions udica/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ def create_policy(
policy.write(" (blockinherit tty_container)\n")
add_template("tty_container")

if opts["KerberosAccess"]:
policy.write(" (blockinherit kerberos_container)\n")
add_template("kerberos_container")

if ports:
policy.write(" (blockinherit restricted_net_container)\n")
add_template("net_container")
Expand Down
Loading