kubo/cmd/ipfs
Lars Gierth 09937f84b6 gateway: enforce allowlist for path prefixes
The gateway accepts an X-Ipfs-Path-Prefix header,
and assumes that it is mounted in a reverse proxy
like nginx, at this path. Links in directory listings,
as well as trailing-slash redirects need to be rewritten
with that prefix in mind.

We don't want a potential attacker to be able to
pass in arbitrary path prefixes, which would end up
in redirects and directory listings, which is why
every prefix has to be explicitly allowed in the config.

Previously, we'd accept *any* X-Ipfs-Path-Prefix header.

Example:

We mount blog.ipfs.io (a dnslink page) at ipfs.io/blog.

nginx_ipfs.conf:

    location /blog/ {
        rewrite "^/blog(/.*)$" $1 break;
        proxy_set_header Host blog.ipfs.io;
        proxy_set_header X-Ipfs-Gateway-Prefix /blog;
        proxy_pass http://127.0.0.1:8080;
    }

.ipfs/config:

    "Gateway": {
        "PathPrefixes": ["/blog"],
        // ...
    },

dnslink:

    > dig TXT _dnslink.blog.ipfs.io
    dnslink=/ipfs/QmWcBjXPAEdhXDATV4ghUpkAonNBbiyFx1VmmHcQe9HEGd

License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-04-04 16:31:57 -04:00
..
dist gobuilder improvements 2015-04-02 03:00:49 -07:00
.gitignore Remove dot and slash before files in cmd/ipfs/.gitignore 2014-11-22 21:55:12 +01:00
.gobuilder.yml added gobuilder no_go_fmt flag to right file 2015-10-31 04:36:13 -04:00
daemon.go gateway: enforce allowlist for path prefixes 2016-04-04 16:31:57 -04:00
equinox.yaml transitioned ipfs2 -> ipfs 2014-11-18 06:15:00 -08:00
init.go correct go-log dep 2016-01-30 09:34:10 -08:00
ipfs.go remove old update code 2016-01-12 08:22:55 -08:00
main_test.go Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs 2015-03-31 12:52:25 -07:00
main.go update utp and cleanup more godeps along the way 2016-03-29 19:18:14 -07:00
Makefile makefile fixes 2016-02-05 15:50:40 -08:00
README.md Fix typo. 2016-01-08 07:57:52 +02:00

go-ipfs/cmd/ipfs

This is the ipfs commandline tool. For now, it's the main entry point to using IPFS.

Install from source

go install
ipfs

Install from gobuilder.me

If you're viewing this in gobuilder, choose the binary that suits you best at the end of this page. Download it, unzip it, and move the binary into place.

Usage

# initialize an ipfs node
ipfs init

# list some commands
ipfs

# get help
ipfs <subcmd> --help