aws / efs-utils

Utilities for Amazon Elastic File System (EFS)
MIT License
285 stars 186 forks source link

AlmaLinux 9 rpmbuild incorrect permissions for /sbin/mount.efs and /usr/bin/amazon-efs-mount-watchdog #239

Open teemerson opened 5 days ago

teemerson commented 5 days ago

NAME="AlmaLinux" VERSION="9.4 (Seafoam Ocelot)"

The "make build" command produces a valid RPM. The RPM amazon-efs-utils-2.0.4-2.el9.x86_64.rpm installs properly with an exception: -rw-------. 1 root root 142737 Sep 11 19:41 /sbin/mount.efs -rw-------. 1 root root 79540 Sep 11 19:41 /usr/bin/amazon-efs-mount-watchdog

The efs-proxy has correct permissions: -rwxr-xr-x. 1 root root 4610128 Sep 11 19:43 /sbin/efs-proxy

Looking at the rpm build, I see:

efs-utils/build/rpmbuild/BUILDROOT/amazon-efs-utils-2.0.4-2.el9.x86_64/sbin -rwxr-xr-x 1 root root 4610128 Sep 13 00:39 efs-proxy -rw------- 1 root root 142737 Sep 13 00:36 mount.efs

efs-utils/build/rpmbuild/BUILDROOT/amazon-efs-utils-2.0.4-2.el9.x86_64/usr/bin -rw------- 1 root root 79540 Sep 13 00:36 amazon-efs-mount-watchdog

These 600 permission are also seen in the packaged RPM: -rw------- 1 root root 142737 Sep 13 00:36 /sbin/mount.efs -rw------- 1 root root 79540 Sep 13 00:36 /usr/bin/amazon-efs-mount-watchdog

The successful efs-proxy is a compiled binary. The incorrect permissions on mount.efs and amazon-efs-mount-watchdog, these are Python scripts. Which should matter not at all to the "install" command.

Our workaround will be to locally revise the spec file to ensure the two Python scripts install with the correct permissions.

I am truly baffled, the spec file looks correct, the build log looks correct.
If I find anything further regarding why "install -p -m 755" was successful for a binary but failed for a Python script, I'll post back.

Sincerely, Baffled.

teemerson commented 4 days ago

Am no long baffled, I missed this in the rpmbuild output:

mangling shebang in /usr/bin/amazon-efs-mount-watchdog from /usr/bin/env python3 to #!/usr/bin/python3 *** WARNING: ./usr/lib/systemd/system/amazon-efs-mount-watchdog.service is executable but has no shebang, removing executable bit

mangling shebang in /sbin/mount.efs from /usr/bin/env python3 to #!/usr/bin/python3

WARNING: ./etc/amazon/efs/efs-utils.conf is executable but has no shebang, removing executable bit WARNING: ./etc/amazon/efs/efs-utils.crt is executable but has no shebang, removing executable bit

We solved our immediate issue by adding to provisioning: ansible.builtin.shell: chmod 755 /sbin/mount.efs /usr/bin/amazon-efs-mount-watchdog