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

Allow ssh generator work with systemd unit files #2510

Merged
merged 3 commits into from
Jan 8, 2025
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
18 changes: 18 additions & 0 deletions policy/modules/services/ssh.if
Original file line number Diff line number Diff line change
Expand Up @@ -1166,3 +1166,21 @@ interface(`ssh_getattr_unit_file',`
systemd_search_unit_dirs($1)
allow $1 sshd_unit_file_t:file getattr_file_perms;
')

#######################################
## <summary>
## Allow caller to create vsock socket for sshd
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`ssh_create_vsock_socket',`
gen_require(`
type sshd_t;
')

allow $1 sshd_t:vsock_socket create_stream_socket_perms;
')
3 changes: 3 additions & 0 deletions policy/modules/services/ssh.te
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ optional_policy(`
allow sshd_t self:netlink_route_socket r_netlink_socket_perms;
allow sshd_t self:key { search link write };
allow sshd_t self:process setcurrent;
allow sshd_t self:vsock_socket rw_socket_perms;

allow sshd_t sshd_keytab_t:file read_file_perms;

Expand Down Expand Up @@ -642,6 +643,8 @@ logging_send_audit_msgs(sshd_sandbox_t)
# sshd [net] child local policy
#

allow sshd_net_t sshd_t:vsock_socket rw_socket_perms;

allow sshd_t sshd_net_t:process signal;

allow sshd_net_t self:process setrlimit;
Expand Down
1 change: 1 addition & 0 deletions policy/modules/system/init.te
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ optional_policy(`

optional_policy(`
ssh_getattr_server_keys(init_t)
ssh_create_vsock_socket(init_t)
')

optional_policy(`
Expand Down
1 change: 1 addition & 0 deletions policy/modules/system/systemd.te
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,7 @@ init_exec_script_files(systemd_rc_local_generator_t)
### ssh generator
allow systemd_ssh_generator_t self:vsock_socket create;
allow systemd_ssh_generator_t vsock_device_t:chr_file { read_chr_file_perms };
allow systemd_ssh_generator_t systemd_unit_file_t:file { create_file_perms rw_file_perms };

kernel_read_sysctl(systemd_ssh_generator_t)

Expand Down
Loading