question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

macOS transparent proxy PermissionError

See original GitHub issue
Steps to reproduce the problem:

Trying to proxy all traffic from macOS through to mitmproxy. Followed the steps to set up transparent proxy on macOS where host listens to its own traffic.

  1. When I try to enable pf (step 4),
    ❯ sudo pfctl -e
    Password:
    No ALTQ support in kernel
    ALTQ related functions disabled
    pf enabled
    
    Are the ALTQ warnings OK/expected?
  2. After sudo -u nobody mitmproxy --mode transparent --showhost:
Traceback (most recent call last):
  File "/usr/local/bin/mitmproxy", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3105, in <module>
    @_call_aside
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3089, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3118, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 569, in _build_master
    ws = cls()
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 562, in __init__
    self.add_entry(entry)
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 618, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1965, in find_on_path
    for dist in factory(fullpath):
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2035, in distributions_from_metadata
    root, entry, metadata, precedence=DEVELOP_DIST,
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2474, in from_location
    py_version=py_version, platform=platform, **kw
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2849, in _reload_version
    md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2438, in _version_from_file
    line = next(iter(version_lines), '')
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2628, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1411, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1407, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1519, in _get
    with open(path, 'rb') as stream:
PermissionError: [Errno 13] Permission denied: '/usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/idna-2.7-py3.7.egg-info/PKG-INFO'
Any other comments? What have you tried so far?

Poked around GitHub, StackOverflow, and the forums for this error, but couldn’t find any related issues.

System information
Mitmproxy: 4.0.4
Python:    3.7.2
OpenSSL:   OpenSSL 1.0.2q  20 Nov 2018
Platform:  Darwin-18.2.0-x86_64-i386-64bit

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
adamyonkcommented, Apr 8, 2019
❯ sudo -u nobody ls -al /usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/idna-2.7-py3.7.egg-info/SOURCES.txt
-rwx------  1 adam  staff  529 Jul 31  2018 /usr/local/Cellar/mitmproxy/4.0.4/libexec/lib/python3.7/site-packages/idna-2.7-py3.7.egg-info/SOURCES.txt

Sorry, I’m not sure how to debug this farther. Do I just need to change permissions on that file, or is there some reason it’s getting installed with the wrong permissions? This was a homebrew install.

0reactions
iliaskarimcommented, Sep 6, 2019

@adamyonk @OmarKhattab install with pip: pip3 install mitmproxy

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to start Transparent Proxy | Apple Developer Forums
I am building a transparent proxy using NETransparentProxyProvider. When I try to "enable" the proxy, I get the following error.
Read more >
mitmproxy transparent mode OSX permission denied
I want to run mitmproxy on osx 12.1 in transparent mode on the same device as the client I want to capture traffic...
Read more >
Miria Administrator's Documentation for macOS
Archiving and retrieval actions transparent to the user, as the graphical ... A One-To-One configuration does not require you to define a storage...
Read more >
Troubleshooting - Anaconda Documentation
PermissionError on macOS Catalina¶. MacOS Catalina users may experience permission errors where the system does not prompt you for permission to folders ...
Read more >
Changelog — Python 3.11.1 documentation
gh-96005: On WASI ENOTCAPABLE is now mapped to PermissionError . ... bpo-42627: Fix incorrect parsing of Windows registry proxy settings ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found