/usr/bin/pyspf: Permission denied

Bug #2085774 reported by Per von Zweigbergk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyspf (Ubuntu)
New
Undecided
Unassigned

Bug Description

Steps to reproduce:

1. Install python3-spf
2. Install spf-tools-python
3. Run the "pyspf" command.

Expected output:

The command-line help for pyspf.

Actual output:

-bash: /usr/bin/pyspf: Permission denied

Some terminal output to illustrate:

$ pyspf
-bash: /usr/bin/pyspf: Permission denied
$ ls -l /usr/bin/pyspf
lrwxrwxrwx 1 root root 35 Jun 3 2022 /usr/bin/pyspf -> ../lib/python3/dist-packages/spf.py
$ ls -l /usr/lib/python3/dist-packages/spf.py
-rw-r--r-- 1 root root 79629 Jun 3 2022 /usr/lib/python3/dist-packages/spf.py
$ pyspf
-bash: /usr/bin/pyspf: Permission denied
$ sudo chmod +x /usr/lib/python3/dist-packages/spf.py
$ pyspf
/usr/bin/pyspf:1724: SyntaxWarning: invalid escape sequence '\d'
  """Quote the value for a key-value pair in Received-SPF header field
To check an incoming mail request:
    % python spf.py [-v] {ip} {sender} {helo}
    % python spf.py 69.55.226.139 <email address hidden> mx1.wayforward.net

To test an SPF record:
    % python spf.py [-v] "v=spf1..." {ip} {sender} {helo}
    % python spf.py "v=spf1 +mx +ip4:10.0.0.1 -all" 10.0.0.1 <email address hidden> a

To fetch an SPF record:
    % python spf.py {domain}
    % python spf.py wayforward.net

To test this script (and to output this usage message):
    % python spf.py

$

Suggested solution:

It appears that the /usr/lib/python3/dist-packages/spf.py file is provided by the package, and the symlink from pyspf comes from spf-tools-python.

I suggest one of the three possible solutions:

1. The python3-spf package could be updated to deploy the /usr/lib/python3/dist-packages/spf.py with an the executable bit set.
2. The spf-tools-python package could replace the symlink with a sort of a "shim script", which exec's python3 with the script path instead, preserving the same arguments, in order to work around the missing executable bit.
3. The spf-tools-python package could have some kind of post-install script to ensure that the executable bit is set on /usr/lib/python3/dist-packages/spf.py (very messy in my opinion).

Workaround:

sudo chmod +x /usr/lib/python3/dist-packages/spf.py

Versions:

Ubuntu 24.04.1 LTS
python3-spf 2.0.14-3
spf-tools-python 2.0.14-3

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.