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

[BUG] service fails to start in Centos 8 #49

Open
campbellmc opened this issue Apr 27, 2020 · 1 comment
Open

[BUG] service fails to start in Centos 8 #49

campbellmc opened this issue Apr 27, 2020 · 1 comment
Labels

Comments

@campbellmc
Copy link

Bug details

Describe the bug

Just noticed this when we changed from Centos 7 to Centos 8.
With selinux enforcing, the consul binary moved from /tmp retains the context tmp_t. selinux denies execution of the consul binary so startup fails.

Steps to reproduce the bug

In pillar, set:

consul:
  service: True

Install and try to run consul on a Centos 8 minion.
salt-call state.apply consul

state will fail.

Check the audit log:

grep consul /var/log/audit/audit.log

Expected behaviour

service should start

Attempts to fix the bug

We use the following in install.sls after file.rename fixes the context;

{% if grains['os_family'] == 'RedHat' %}
consul_bin_restorecon:
  module.run:
    - file.restorecon:
        - /usr/local/bin/consul-{{consul.version}}
    - watch:
      - file: consul_install
{% endif %}

Use the module function file.restorecon to change the context of the consul binary to match destination location of the file - which then permits execution by systemd.

@campbellmc campbellmc added the bug label Apr 27, 2020
@ehanks-habana
Copy link

We are seeing a similar issue on Rocky 8. Modified @campbellmc fix like so and inserted after consul-install in install.sls:

{% if grains['os_family'] == 'RedHat' %}

consul-bin-restorecon:
  module.run:
    - file.restorecon:
        - {{ consul.bin_dir ~ 'consul-' ~ consul.version }}
    - watch:
      - file: consul-install

{% endif %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants