So I'm trying to start a service (let's call it the "kite agent" and it's a binary executable that runs as part of a tracing service) with systemd via ansible deployment on CentOS Linux release 8.2.2004.
This is the kite_agent.service file that systemd uses:
[Unit] Description=kite_agent After=network.target [Service] ExecStart=/kite_agent/kite-agent --config-file=/kite_agent/kite-agent.yml Restart=always StandardOutput=syslog SyslogIdentifier=kite-agent User=kite Group=kite [Install] WantedBy=multi-user.target The "/kite_agent" directory in the above .service file has the following permissions:
dr-x------. 2 kite kite unconfined_u:object_r:default_t:s0 117 Jul 21 10:42 kite_agent The files inside "/kite_agent" have the following permissions (as described by ls -laZ):
dr-x------. 2 kite kite unconfined_u:object_r:default_t:s0 117 Jul 21 10:42 . dr-xr-xr-x. 19 root root system_u:object_r:root_t:s0 256 Jul 21 10:41 .. -r--------. 1 kite kite system_u:object_r:default_t:s0 1769 Jul 21 10:42 agent.cert -rw-r--r--. 1 root root system_u:object_r:default_t:s0 1582 Jul 21 10:42 agent.csr -r--------. 1 kite kite system_u:object_r:default_t:s0 3243 Jul 21 10:42 agent.key -rwxrwxrwx. 1 kite kite system_u:object_r:default_t:s0 1696 Jul 21 10:42 ca.cert -r-xr-xr-x. 1 kite kite system_u:object_r:default_t:s0 25956781 Jul 21 10:41 kite-agent -r-xr-xr-x. 1 kite kite system_u:object_r:default_t:s0 256 Jul 21 10:42 kite-agent.yml Am I right in thinking that the "/kite_agent" directory should have permissions with a "system_u" context such as:
kite kite system_u:object_r:default_t:s0 I'm seeing messages such as the below via journalctl:
kite_agent.service: Failed at step EXEC spawning /kite_agent/kite-agent: Permission denied kite_agent.service: Main process exited, code=exited, status=203/EXEC EDIT:
Including some more basic diagnostic information below:
Running systemctl status auditd yields:
● auditd.service Loaded: masked (Reason: Unit auditd.service is masked.) Active: inactive (dead) Running cat /etc/audit/auditd.conf yields:
# # Controls the configuration of the audit daemon # local_events = yes write_logs = yes log_file = /var/log/audit/audit.log log_group = root log_format = ENRICHED flush = INCREMENTAL_ASYNC freq = 50 max_log_file = 8 num_logs = 5 priority_boost = 4 name_format = NONE ##name = mydomain max_log_file_action = ROTATE space_left = 75 space_left_action = SYSLOG verify_email = yes action_mail_acct = root admin_space_left = 50 admin_space_left_action = SUSPEND disk_full_action = SUSPEND disk_error_action = SUSPEND use_libwrap = yes ##tcp_listen_port = 60 tcp_listen_queue = 5 tcp_max_per_addr = 1 ##tcp_client_ports = 1024-65535 tcp_client_max_idle = 0 transport = TCP krb5_principal = auditd ##krb5_key_file = /etc/audit/audit.key distribute_network = no q_depth = 400 overflow_action = SYSLOG max_restarts = 10 plugin_dir = /etc/audit/plugins.d Running audit2allow -a yields:
#============= ifconfig_t ============== allow ifconfig_t vmware_log_t:file write; Running ausearch -m avc | grep kite yields nothing unfortunately.
Running systemctl status auditd yields:
● auditd.service - Security Auditing Service Loaded: loaded (/etc/systemd/system/auditd.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2020-09-15 16:03:04 CDT; 6min ago Docs: man:auditd(8) https://people.redhat.com/sgrubb/audit/ Process: 157748 ExecStartPost=/sbin/augenrules --load (code=exited, status=0/SUCCESS) Process: 157747 ExecStart=/sbin/auditd -n (code=exited, status=1/FAILURE) Main PID: 157747 (code=exited, status=1/FAILURE) Sep 15 16:03:04 my_app augenrules[157748]: enabled 1 Sep 15 16:03:04 my_app augenrules[157748]: failure 1 Sep 15 16:03:04 my_app augenrules[157748]: pid 2094 Sep 15 16:03:04 my_app augenrules[157748]: rate_limit 0 Sep 15 16:03:04 my_app augenrules[157748]: backlog_limit 8192 Sep 15 16:03:04 my_app augenrules[157748]: lost 0 Sep 15 16:03:04 my_app augenrules[157748]: backlog 0 Sep 15 16:03:04 my_app augenrules[157748]: backlog_wait_time 60000 Sep 15 16:03:04 my_app systemd[1]: auditd.service: Failed with result 'exit-code'. Sep 15 16:03:04 my_app systemd[1]: Failed to start Security Auditing Service.
audit2allowresults you show are relevant. If the audit daemon isn't running at the time the kite agent fails to start, you can't be sure anything will return appropriate avc information.