Allow systemd-journal-upload through SELinux (#577)
systemd-journal-upload never ships logs on SELinux-enforcing hosts: policy denies `systemd_journal_upload_t` `name_connect` to `http_port_t` (443), so uploads to VictoriaLogs fail. - add local `journal_upload_local` SELinux module to `victorialogs::client::journald` on enforcing hosts - order the module before `Service[systemd-journal-upload]` Reviewed-on: #577 Co-authored-by: unkin-agent <unkin-agent@unkin.net> Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #577.
This commit is contained in:
@@ -26,6 +26,27 @@ class victorialogs::client::journald (
|
||||
content => template('victorialogs/client.journald.conf.erb')
|
||||
}
|
||||
|
||||
if $facts['os']['selinux']['config_mode'] == 'enforcing' {
|
||||
$journal_upload_te = @("EOF")
|
||||
module journal_upload_local 1.0;
|
||||
|
||||
require {
|
||||
type systemd_journal_upload_t;
|
||||
type http_port_t;
|
||||
class tcp_socket name_connect;
|
||||
}
|
||||
|
||||
allow systemd_journal_upload_t http_port_t:tcp_socket name_connect;
|
||||
| EOF
|
||||
|
||||
selinux::module { 'journal_upload_local':
|
||||
ensure => 'present',
|
||||
content_te => $journal_upload_te,
|
||||
builder => 'simple',
|
||||
before => Service['systemd-journal-upload'],
|
||||
}
|
||||
}
|
||||
|
||||
service {'systemd-journal-upload':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
|
||||
Reference in New Issue
Block a user