Skip to content

Enforce SELinux on EL and Enable Apparmor in Ubuntu/Debian/SUSE#225

Draft
weizhouapache wants to merge 5 commits into
masterfrom
enforce-selinux-apparmor
Draft

Enforce SELinux on EL and Enable Apparmor in Ubuntu/Debian/SUSE#225
weizhouapache wants to merge 5 commits into
masterfrom
enforce-selinux-apparmor

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces shared Ansible task snippets to enforce SELinux on Enterprise Linux hosts and enable/enforce AppArmor on Ubuntu/Debian/SUSE, and then wires those snippets into the MySQL, KVM, CloudStack manager, and Marvin roles (replacing prior “permissive/disable” logic).

Changes:

  • Add Ansible/tasks/configure_selinux.yml to switch SELinux to enforcing (runtime + persistent).
  • Add Ansible/tasks/configure_apparmor.yml to install AppArmor tooling and enforce AppArmor profiles.
  • Replace per-role SELinux/AppArmor handling with include calls to the shared task files across multiple distro-specific role task files.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
Ansible/tasks/configure_selinux.yml New shared SELinux enforcement tasks used by EL roles.
Ansible/tasks/configure_apparmor.yml New shared AppArmor enable/enforce tasks used by Debian/Ubuntu/SUSE roles.
Ansible/roles/mysql/tasks/suse.yml Switch SUSE MySQL role to include shared AppArmor configuration.
Ansible/roles/mysql/tasks/el9.yml Switch EL9 MySQL role to include shared SELinux enforcement.
Ansible/roles/mysql/tasks/centos8.yml Switch CentOS 8 MySQL role to include shared SELinux enforcement.
Ansible/roles/mysql/tasks/centos.yml Switch CentOS MySQL role to include shared SELinux enforcement.
Ansible/roles/marvin/tasks/main.yml Replace Marvin role SELinux permissive setup with shared SELinux enforcement include.
Ansible/roles/kvm/tasks/ubuntu.yml Replace libvirt AppArmor disable steps with shared AppArmor enforcement include.
Ansible/roles/kvm/tasks/suse.yml Switch SUSE KVM role to include shared AppArmor configuration.
Ansible/roles/kvm/tasks/el9.yml Switch EL9 KVM role to include shared SELinux enforcement.
Ansible/roles/kvm/tasks/debian.yml Replace libvirt AppArmor disable steps with shared AppArmor enforcement include.
Ansible/roles/kvm/tasks/centos8.yml Switch CentOS 8 KVM role to include shared SELinux enforcement.
Ansible/roles/kvm/tasks/centos.yml Switch CentOS KVM role to include shared SELinux enforcement.
Ansible/roles/cloudstack-manager/tasks/ubuntu.yml Add shared AppArmor configuration include before DB setup.
Ansible/roles/cloudstack-manager/tasks/suse.yml Switch SUSE mgmt role from SELinux permissive handling to shared AppArmor configuration.
Ansible/roles/cloudstack-manager/tasks/el9.yml Switch EL9 mgmt role to include shared SELinux enforcement.
Ansible/roles/cloudstack-manager/tasks/debian.yml Add shared AppArmor configuration include before DB setup.
Ansible/roles/cloudstack-manager/tasks/centos8.yml Switch CentOS 8 mgmt role to include shared SELinux enforcement.
Ansible/roles/cloudstack-manager/tasks/centos.yml Switch CentOS mgmt role to include shared SELinux enforcement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Ansible/roles/mysql/tasks/el9.yml
Comment thread Ansible/roles/mysql/tasks/centos8.yml
Comment thread Ansible/roles/mysql/tasks/suse.yml
Comment thread Ansible/roles/kvm/tasks/centos.yml
Comment thread Ansible/roles/kvm/tasks/centos8.yml
Comment thread Ansible/roles/kvm/tasks/suse.yml
Comment thread Ansible/tasks/configure_apparmor.yml Outdated
Comment thread Ansible/tasks/configure_selinux.yml Outdated
Comment thread Ansible/roles/kvm/tasks/el9.yml
@andrijapanicsb

Copy link
Copy Markdown
Contributor

@wei do these copilot stuff have any sense, or do we just say "when kvm tag included" at a much higher level ("wrapper" script which when tag KVM - invokes these specific Ubuntu/EL sub tasks) ?

@weizhouapache

Copy link
Copy Markdown
Member Author

@wei do these copilot stuff have any sense, or do we just say "when kvm tag included" at a much higher level ("wrapper" script which when tag KVM - invokes these specific Ubuntu/EL sub tasks) ?

@andrijapanicsb
I can add the tags. but I think it does not matter if we enable selinux/apparmor multiple times.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Comment thread Ansible/tasks/configure_apparmor.yml Outdated
Comment thread Ansible/tasks/configure_selinux.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Comment thread Ansible/tasks/configure_apparmor.yml Outdated
Comment thread Ansible/tasks/configure_apparmor.yml
Comment thread Ansible/tasks/configure_selinux.yml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Comment thread Ansible/tasks/configure_apparmor.yml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Comment thread Ansible/tasks/configure_apparmor.yml
Comment thread Ansible/roles/mysql/tasks/suse.yml
Comment thread Ansible/roles/cloudstack-manager/tasks/suse.yml
Comment thread Ansible/roles/kvm/tasks/suse.yml
@weizhouapache weizhouapache force-pushed the enforce-selinux-apparmor branch from 41ae2cf to 70e354a Compare June 16, 2026 14:30
@weizhouapache weizhouapache requested a review from Copilot June 16, 2026 14:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@weizhouapache weizhouapache force-pushed the enforce-selinux-apparmor branch 2 times, most recently from c7859d9 to 237c550 Compare June 19, 2026 08:14
To fix smoke test failures caused by error

```
import mysql.connector

conn = mysql.connector.connect(
    host="10.0.35.28",
    port=3306,
    user="root",
    password="Pxxxxx",
    database="cloud",
    use_unicode=True,
)

mysql.connector.errors.ProgrammingError: Character set 'utf8' unsupported

```
@weizhouapache weizhouapache force-pushed the enforce-selinux-apparmor branch from 237c550 to f91758e Compare June 19, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants