Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider silly "security" practicies #594

Closed
dsvi opened this issue Jun 25, 2017 · 5 comments
Closed

Reconsider silly "security" practicies #594

dsvi opened this issue Jun 25, 2017 · 5 comments

Comments

@dsvi
Copy link

dsvi commented Jun 25, 2017

According to the issue:
#591
The WebUI has weird "security protection mechanism" in the form of hardcoded 'localhost' strings in it's javascript.
This really is a weak security feature (to put it mildly) and causes more problems than it solves. In fact, it solves none.
I do believe this should be reconsidered.

@daviddias
Copy link
Member

daviddias commented Jun 25, 2017

Hi @dsvi, there is, in fact, a conversation happening about API tokens for apps like the WebUI and others, see: ipfs/kubo#1532

Consider joining the conversation. The current mechanism is not the best, but it is not creating issues other than the one that it is there for, limiting access to the webui from an outside node.

Remember, Webui is just a webpage, you can always change that value and also change the value in go-ipfs and use that special node for yourself :)

@dsvi
Copy link
Author

dsvi commented Jun 25, 2017

Hi!
"it is there for, limiting access to the webui from an outside node."
You don't seem to get the point. The web UI is accessible from an outside node anyways. Even now with the hardcoded localhost in it. (if you have configured the go-ipfs appropriately) The problem is, the Web UI is useless this way. Which renders ipfs browser extensions useless, if you don't run ipfs on the same computer, on which you are browsing.
The API tokens are unrelated issue. API is already accessible outside. No reason to make the WebUI unusable.

@DiagonalArg
Copy link

DiagonalArg commented Apr 28, 2018

Yes, this is really an issue for me. I am VPN'ing through the server on which IPFS is running. localhost refers to my laptop, so I need to get to the ui via http://ServerIP:5001/webui.

As a comparison, the torrent client transmission provides a "-a" option for allowed IP's. I give it localhost and the IP address of the server. It also allows a "-t" option to set a username ("-u") and a password ("-v"). You might want to consider this approach.

This issue also appears in #628, #637, and #591.

@myfingerhurt
Copy link

myfingerhurt commented Sep 2, 2018

  1. Change your API address has your wish like this,
    10.9.8.9 is my VPN remote address which hosts the IPFS.
 "Addresses": {
    "API": "/ip4/10.9.8.9/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ]
  },
  1. Then run this in your console:
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"

# The following two lines are not necessary, but you know in case you need it.
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]"
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]"
  1. Open a browser you will be finally able to access your IFPS
http://10.9.8.9:5001/webui

But see 0 peers?

  1. Restore "API": "/ip4/127.0.0.1/tcp/5001",

  2. This is still needed.

$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"
  1. Redirect port 5001 to localhost
    10.9.8.11 is your VPN address on remote VPS, here I'm using zerotier.
sudo iptables -t nat -A PREROUTING -d 10.9.8.11 -p tcp --dport 5001 -j DNAT --to-destination 127.0.0.1:5001

# The following line is just for the reference
sudo iptables -t nat -A OUTPUT -d 10.9.8.11 -p tcp --dport 5001 -j DNAT --to-destination 127.0.0.1:5001
  1. Forward zt0 to localhost
sudo sysctl net.ipv4.ip_forward=1
sudo sysctl -w net.ipv4.conf.zt0.route_localnet=1 
  1. Open a browser http://10.9.8.9:5001/webui
    everything should be working.

@olizilla
Copy link
Member

Closing in favour of #836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants