Skip to content
This repository has been archived by the owner on Jun 1, 2018. It is now read-only.

Permission denied: '/home/mitmproxy/.mitmproxy/mitmproxy-ca.pem' #6

Closed
kuba-orlik opened this issue Aug 7, 2016 · 3 comments
Closed

Comments

@kuba-orlik
Copy link

I'm trying to run mitmproxy with the following command:

docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 8080:8080 mitmproxy/releases

This is the output I get:

Traceback (most recent call last):
  File "/usr/bin/mitmproxy", line 11, in <module>
    sys.exit(mitmproxy())
  File "/usr/lib/python2.7/site-packages/mitmproxy/main.py", line 56, in mitmproxy
    proxy_config = process_proxy_options(parser, options)
  File "/usr/lib/python2.7/site-packages/mitmproxy/proxy/config.py", line 229, in process_proxy_options
    add_upstream_certs_to_client_chain=options.add_upstream_certs_to_client_chain,
  File "/usr/lib/python2.7/site-packages/mitmproxy/proxy/config.py", line 100, in __init__
    CONF_BASENAME
  File "/usr/lib/python2.7/site-packages/netlib/certutils.py", line 209, in from_store
    key, ca = cls.create_store(path, basename)
  File "/usr/lib/python2.7/site-packages/netlib/certutils.py", line 233, in create_store
    with open(os.path.join(path, basename + "-ca.pem"), "wb") as f:
IOError: [Errno 13] Permission denied: '/home/mitmproxy/.mitmproxy/mitmproxy-ca.pem'

How can I fix it? :)

@Matthalp-zz
Copy link

Matthalp-zz commented Aug 29, 2016

+1 I am able to repeat the issue too

@mhils
Copy link
Member

mhils commented Aug 30, 2016

The problem here is that the Docker container does not have permissions to
write to your ~/. mitmproxy. A simple hacky workaround is to chmod a+wr
your .mitmproxy folder. If you have a good - less hacky - solution, I'm
happy to include that in the docs. :)

On Mon, 29 Aug 2016, 14:06 Matthew Halpern, notifications@github.com
wrote:

I am able to repeat the issue too


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#6 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA-NPtQ3PYxzGQzeEO-qm5OkDIpwyBtIks5qk0nBgaJpZM4JeeUm
.

maxcnunes added a commit to maxcnunes/docker-releases that referenced this issue Nov 7, 2016
Fix issue mitmproxy#6.

This approach is the same used by official Docker images such as mysql and postgres.

Running the container with "mitmproxy" arg it will set the required permissions for
mitmproxy directory and run the process also with the mitmproxy user.

Otherwise it will run the passed arg with the root user. Which allows the user to
test the container with any command. Just will not set the directory permission running this way.
maxcnunes added a commit to maxcnunes/docker-releases that referenced this issue Nov 7, 2016
Fix issue mitmproxy#6.

This approach is the same used by official Docker images such as mysql and postgres.

Running the container with any mitmproxy tool it will set the required permissions for
mitmproxy directory and run the process also with the mitmproxy user.

Otherwise it will run the passed arg with the root user. Which allows the user to
test the container with any command. Just will not set the directory permission running this way.
@mhils
Copy link
Member

mhils commented Nov 22, 2016

Fixed by #8. Thanks again, @maxcnunes! 😃

@mhils mhils closed this as completed Nov 22, 2016
rohfle pushed a commit to kubernetes-sigs/apisnoop that referenced this issue Apr 13, 2018
Fix issue mitmproxy/docker-releases#6.

This approach is the same used by official Docker images such as mysql and postgres.

Running the container with any mitmproxy tool it will set the required permissions for
mitmproxy directory and run the process also with the mitmproxy user.

Otherwise it will run the passed arg with the root user. Which allows the user to
test the container with any command. Just will not set the directory permission running this way.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants