Skip to content

Commit de58d6e

Browse files
authored
Merge pull request #216 from cisagov/bugfix/disable-unix-chkpwd-apparmor-profile
Disable `unix-chkpwd` AppArmor profile
2 parents e940403 + a473457 commit de58d6e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,46 @@ 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+
# TODO: Remove the apt-get install command when possible. See
275+
# cisagov/skeleton-ansible-role#215 for more details.
276+
- name: Re-enable unix-chkpwd AppArmor profile
277+
run: |
278+
sudo aa-enforce /usr/sbin/unix_chkpwd
279+
sudo apt-get install firefox passt
280+
if: ${{ startsWith(matrix.platform, 'fedora') }}
246281
- name: Setup tmate debug session
247282
uses: mxschmitt/action-tmate@v3
248283
if: env.RUN_TMATE

0 commit comments

Comments
 (0)