Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1756347

Summary: TestOnly: nftables manpage needlessly requires shebang line in scripts
Product: Red Hat Enterprise Linux 8 Reporter: Tomas Dolezal <todoleza>
Component: nftablesAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Jiri Peska <jpeska>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: jpeska, todoleza
Target Milestone: rcKeywords: ManPageChange, TestOnly
Target Release: 8.2Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: nftables-0.9.3-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:41:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Dolezal 2019-09-27 12:56:30 UTC
Description of problem:
Configuration scripts provided as /etc/nftables/*.nft are now equipped with shebang and could be executed directly, if they had 0700 mode. Current mode is 0600 which was requested by previous bug 1685238 to strip Group and Other privileges. eXecute bit is continuously lacking.

Version-Release number of selected component (if applicable):
nftables-0.9.0-14.el8.x86_64

How reproducible:
always

Steps to Reproduce:
/etc/nftables/netdev-ingress.nft
bash: /etc/nftables/netdev-ingress.nft: Permission denied

Expected results:
/etc/nftables/*.nft have 0700 mode

Additional info:
official documentation refers to the configuration files as to scripts, which also IMO implies that they should be directly executable

Comment 1 Phil Sutter 2019-11-04 13:27:14 UTC
Hi Tomas,

Upstream doesn't set executable bit on them either. Do you think there's an
actual benefit to users by doing that? IMO, these are really just config files
for nftables.service.

Cheers, Phil

Comment 2 Tomas Dolezal 2019-11-04 16:08:38 UTC
Hello Phil,

I wanted to bring this up for a review.

(In reply to Phil Sutter from comment #1)
> Upstream doesn't set executable bit on them either. Do you think there's an
> actual benefit to users by doing that? IMO, these are really just config
> files for nftables.service.

I think the benefit is quite low when looking back. The shebang in the script does not imply it must be executable. Also it is currently aligned with documentation which suggests adding executable bit manually if needed [1].

On a different note related to this issue the nft documentation should be changed unless the shebang line is not required.
from man:nft(8) in nftables-0.9.2-4.el8.x86_64:
>nft scripts must start #!/usr/sbin/nft -f

[1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/getting-started-with-nftables_configuring-and-managing-networking#running-nftables-scripts_writing-and-executing-nftables-scripts

Tomas

Comment 3 Tomas Dolezal 2019-11-04 16:12:00 UTC
(In reply to Tomas Dolezal from comment #2)
> On a different note related to this issue the nft documentation should be
> changed unless the shebang line is not required.
> from man:nft(8) in nftables-0.9.2-4.el8.x86_64:
> >nft scripts must start #!/usr/sbin/nft -f

correction: unless the line is really required.
now it is possible to `nft -f script.nft` without the above as first line.

Comment 4 Phil Sutter 2019-11-06 19:27:44 UTC
Fix sent upstream: https://lore.kernel.org/netfilter-devel/20191105131439.31826-1-phil@nwl.cc/

This removes the incorrect statement from nft.8.

Comment 5 Phil Sutter 2019-12-03 17:16:27 UTC
Manpage change implicitly backported by rebase to 0.9.3.

Comment 8 errata-xmlrpc 2020-04-28 16:41:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:1774