saslauthd policy, dovecot patches
Hi,
I'm trying to get postfix+SASL working, and to do that I had to write a policy for saslauthd, which is attached. I haven't had a chance to test it with Kerberos yet, so that's incomplete. But it does seem to authenticate via the PAM mechanism (smtp PLAIN) correctly.
Also, I've fixed up a few things in the Dovecot policy - the sub- binaries are bin_t on Fedora, it needed a few more capabilities, and I allowed it access to Kerberos configuration.
#DESC saslauthd - Authentication daemon for SASL
#
# Author: Colin Walters <[email protected]>
#
daemon_domain(saslauthd, `, auth_chkpwd')
allow saslauthd_t self:fifo_file { read write };
allow saslauthd_t self:unix_dgram_socket create_socket_perms; allow saslauthd_t self:unix_stream_socket create_stream_socket_perms; allow saslauthd_t saslauthd_var_run_t:sock_file create_file_perms;
allow saslauthd_t etc_t:dir { getattr search };
allow saslauthd_t etc_t:file r_file_perms;
allow saslauthd_t net_conf_t:file r_file_perms;
allow saslauthd_t krb5_conf_t:file r_file_perms;
dontaudit saslauthd_t krb5_conf_t:file { write };
allow saslauthd_t self:file r_file_perms;
allow saslauthd_t proc_t:file { read };
allow saslauthd_t urandom_device_t:chr_file { getattr read };
# Needs investigation
dontaudit saslauthd_t home_root_t:dir { getattr };
ifdef(kerberos.te',
# Incompletecan_network(saslauthd_t)
')
# saslauthd /usr/sbin/saslauthd -- system_u:object_r:saslauthd_exec_t /var/run/saslauthd system_u:object_r:saslauthd_var_run_t
* added files
domains/program/.arch-ids/saslauthd.te.id
domains/program/saslauthd.te
file_contexts/program/.arch-ids/saslauthd.fc.id
file_contexts/program/saslauthd.fc
{arch}/policy/policy--main/policy--main--0/[email protected]/patch-log/patch-7* modified files
domains/program/postfix.te +6 -0
@@ -167,6 +167,12 @@ r_dir_file(postfix_smtpd_t,usr_t) allow postfix_smtpd_t etc_aliases_t:file r_file_perms; +ifdef(`saslauthd.te',` +allow postfix_smtpd_t saslauthd_var_run_t:dir { search getattr }; +allow postfix_smtpd_t saslauthd_var_run_t:sock_file { read write }; +can_unix_connect(postfix_smtpd_t,saslauthd_t) +') + # for prng_exch allow postfix_smtpd_t postfix_spool_t:file rw_file_perms;
* finding or making patch-4
* finding or making patch-5
* computing changeset
A {arch}/policy/policy--main/policy--main--0/[email protected]/patch-log/patch-5 M domains/program/dovecot.te
* changeset report
* added files
{arch}/policy/policy--main/policy--main--0/[email protected]/patch-log/patch-5* modified files
domains/program/dovecot.te +13 -1
@@ -11,15 +11,24 @@ type dovecot_cert_t, file_type, sysadmfile; -allow dovecot_t self:capability { chown net_bind_service setgid setuid sys_chroot }; +allow dovecot_t self:capability { chown net_bind_service setgid setuid sys_chroot dac_override dac_read_search }; allow dovecot_t self:process { setrlimit }; can_network(dovecot_t) allow dovecot_t self:unix_dgram_socket create_socket_perms; allow dovecot_t self:unix_stream_socket create_stream_socket_perms; can_unix_connect(dovecot_t, self) allow dovecot_t etc_t:file { getattr read }; + +# For SSL certificates +allow dovecot_t usr_t:file { getattr read }; + allow dovecot_t initrc_var_run_t:file { getattr }; + +# Dovecot sub-binaries are lib_t on Debian and bin_t on Fedora allow dovecot_t lib_t:file { execute execute_no_trans }; +allow dovecot_t bin_t:dir { getattr search }; +can_exec(dovecot_t, bin_t) + allow dovecot_t pop_port_t:tcp_socket name_bind; allow dovecot_t urandom_device_t:chr_file { read }; allow dovecot_t dovecot_cert_t:file { getattr read };
@@ -27,6 +36,9 @@ allow dovecot_t { self proc_t }:file { getattr read }; allow dovecot_t self:fifo_file rw_file_perms; +dontaudit dovecot_t krb5_conf_t:file { write }; +allow dovecot_t krb5_conf_t:file { getattr read }; + daemon_sub_domain(dovecot_t, dovecot_auth, `, auth') allow dovecot_auth_t self:process { fork signal_perms }; allow dovecot_auth_t dovecot_t:unix_stream_socket { getattr accept read write ioctl };
Quoted 6 lines · Colin Walters
Hi,
I'm trying to get postfix+SASL working, and to do that I had to write a policy for saslauthd, which is attached. I haven't had a chance to test it with Kerberos yet, so that's incomplete. But it does seem to authenticate via the PAM mechanism (smtp PLAIN) correctly.
Ok, with my later patch to extend the meaning of auth_chkpwd, I have Postfix successfully sending mail via GSSAPI SMTP AUTH using saslauthd. Here's an updated saslauthd.te which removes the now unnecessary kerberos bits.
#DESC saslauthd - Authentication daemon for SASL
#
# Author: Colin Walters <[email protected]>
#
daemon_domain(saslauthd, `, auth_chkpwd')
allow saslauthd_t self:fifo_file { read write };
allow saslauthd_t self:unix_dgram_socket create_socket_perms; allow saslauthd_t self:unix_stream_socket create_stream_socket_perms; allow saslauthd_t saslauthd_var_run_t:sock_file create_file_perms;
allow saslauthd_t etc_t:dir { getattr search };
allow saslauthd_t etc_t:file r_file_perms;
allow saslauthd_t net_conf_t:file r_file_perms;
allow saslauthd_t self:file r_file_perms;
allow saslauthd_t proc_t:file { read };
allow saslauthd_t urandom_device_t:chr_file { getattr read };
# Needs investigation
dontaudit saslauthd_t home_root_t:dir { getattr };