Skip to content

Commit 3e3ea4c

Browse files
committed
Disable unix-chkpwd AppArmor profile
This is necessary when running Molecule tests against Fedora 40 and 41; otherwise, the privileged container cannot successfully sudo and hence Ansible is unable to do anything. Note that this change is reverted after the Molecule tests are run. For now, disabling the unix-chkpwd AppArmor profile also requires an apt-get purge of the firefox and passt packages. It should be possible to remove this purge (and the ensuing systemctl reload apparmor.service) at a future date. See #215 for more details.
1 parent e940403 commit 3e3ea4c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,43 @@ jobs:
238238
uses: docker/setup-qemu-action@v3
239239
- name: Set up Docker Buildx
240240
uses: docker/setup-buildx-action@v3
241+
# Disabling the unix-chkpwd AppArmor profile is necessary when
242+
# running Molecule tests against Fedora 40 and 41; otherwise,
243+
# the privileged container cannot successfully run sudo and
244+
# hence Ansible is unable to do anything. See
245+
# fedora-cloud/docker-brew-fedora#117 for more details.
246+
#
247+
# Purging firefox is currently necessary because the
248+
# installation available on the GitHub runner instance provides
249+
# two conflicting AppArmor profiles:
250+
# /etc/apparmor.d/usr.bin.firefox and /etc/apparmor.d/firefox.
251+
# This conflict causes the aa-disable /usr/sbin/unix_chkpwd
252+
# command to fail.
253+
#
254+
# Purging passt is currently necessary because the installation
255+
# available on the GitHub runner instance contains a wonky
256+
# AppArmor file (/etc/apparmor.d/abstractions/passt) that causes
257+
# the aa-disable command to fail.
258+
#
259+
# TODO: Remove the apt-get purge and systemctl reload commands
260+
# when possible. See cisagov/skeleton-ansible-role#215 for more
261+
# details.
262+
- name: Disable unix-chkpwd AppArmor profile
263+
run: |
264+
sudo apt-get purge firefox passt
265+
sudo systemctl reload apparmor.service
266+
sudo apt-get install apparmor-utils
267+
sudo aa-disable /usr/sbin/unix_chkpwd
268+
if: ${{ startsWith(matrix.platform, 'fedora') }}
241269
- name: Run molecule tests
242270
run: >-
243271
molecule test
244272
--platform-name ${{ matrix.platform }}-${{ matrix.architecture }}
245273
--scenario-name ${{ matrix.scenario }}
274+
- name: Re-enable unix-chkpwd AppArmor profile
275+
run: >-
276+
sudo aa-enforce /usr/sbin/unix_chkpwd
277+
if: ${{ startsWith(matrix.platform, 'fedora') }}
246278
- name: Setup tmate debug session
247279
uses: mxschmitt/action-tmate@v3
248280
if: env.RUN_TMATE

0 commit comments

Comments
 (0)