Skip to content

Latest commit

 

History

History
162 lines (127 loc) · 9.74 KB

demo.md

File metadata and controls

162 lines (127 loc) · 9.74 KB

2018/10/31 06:47:27 Found Labels: [] 2018/10/31 06:47:27 SAM Bridge connection established. 2018/10/31 06:47:27 Destination keys generated, tunnel name: eephttpd 2018/10/31 06:47:27 Serving /opt/eephttpd/www on HTTP port: 7880 and on 5n2nm5nidfptjc2nc4zaqkwonmzc4fc2qynwdqueyvvt4pzwjnaq.b32.i2p 2018/10/31 06:47:47 SAM stream session established. 2018/10/31 06:47:47 Starting Listener. 2018/10/31 06:47:47 SAM Listener created, 5n2nm5nidfptjc2nc4zaqkwonmzc4fc2qynwdqueyvvt4pzwjnaq.b32.i2p 2018/10/31 06:48:19 Accepted connection &{UrwAU7TryeMuQ4iBSVAcSPpp66LoPU6BzEUE5UfCx-Z8sjKugSyYawmsePruyze7xgLLMiR26syKe2mO3rM1CRZQ1bbv4FgABulP5cqMXxFYXi3yop8sJ1Uz6jSDUaBecsOLB6CatM2y6En6LxCw2QztkMq5ztdzMQ-pVJkolCjtvSfBRjkwRYRspbyO0imtveb7U2-Hov3b52A44eUQg0~-aDxkQ3IE8Ie9AqN4JMeOwlwtGGWJonss-jdxzrpt6PojcISRNDcQno1aN3EX3fbdUND8JScK1ZZuXoErS3jTd9cVwEhsJmFof6IlGbUcgVBq21bqvYw1YkaVOHi2hzzn9FbNlUW9vmxDoYDmji8pwl3zyAs4Z6scMPYtiVQrhxQSVIkYWfWumHJ9KryIj1huKhb3SwTfvrmVyyeDL33fI3whvzDUQy2NjL4jjzbYQpeTAOCjuw7nQfBL30fjC69hnO4TzYwTLwEUtYvdwnUqPmuIjTgJpSuYB5AAAA uZvtgfiQ6c7h0qt2Tg9mvPTLNJarXidhRqR-RW4z-VHcKN91pdROLLctSkTY9Qoq9ncuWxr5zmfS-3APRLZjn56KCoih4-830oUHdTSgQtZk-8VJ-OoQ6WvjME9jQdZirVNrdDCVTx14F4t2-3RPMGbJfFX2l81ADZrxmkGWHq0C61GGRL-BZy7wW8qME5q9KnfHNfl7tnH54Vyw7piIVbuxXBKhfF7rj-xgLLd-HsdkKUnFd2iEUu7XbDv2FgAjIchyYOmEbY3bIvv2ymHjG3JLbGRyeYzn6CS2LkRjZgrZJHSnB2QpBwmSlYJ2AuPkEez0ntXP33oLMH3DL41VnQGmfjFXmskCHv-zWLXnZkQ3P3hAd-u1q3cR4jtZTbLwUIawdTrP7j5BbnGjJGuc8RmjxuKFSE-XpxmMKB8r5Ydg93uX5ROityhKJ9WE7dWPxsilgDcg-jtSD8bqrf0O3Ad6VDAUUyMFIABeWS69fun4Mkib5atH5eWIAAAA 0xc42000c098} 2018/10/31 06:48:19 Forwarding modified request: GET / HTTP/1.1

Host: 5n2nm5nidfptjc2nc4zaqkwonmzc4fc2qynwdqueyvvt4pzwjnaq.b32.i2p

Connection: close

Accept-Encoding: gzip, deflate

Connection: close

Upgrade-Insecure-Requests: 1

User-Agent: MYOB/6.66 (AN/ON)

X-I2p-Dest-Base32: ub2lkd2mckm2dsmt7zgrosrcnpbogowj7jiv5uipyj4s4gimt2za.b32.i2p

X-I2p-Dest-Base64: uZvtgfiQ6c7h0qt2Tg9mvPTLNJarXidhRqR-RW4z-VHcKN91pdROLLctSkTY9Qoq9ncuWxr5zmfS-3APRLZjn56KCoih4-830oUHdTSgQtZk-8VJ-OoQ6WvjME9jQdZirVNrdDCVTx14F4t2-3RPMGbJfFX2l81ADZrxmkGWHq0C61GGRL-BZy7wW8qME5q9KnfHNfl7tnH54Vyw7piIVbuxXBKhfF7rj-xgLLd-HsdkKUnFd2iEUu7XbDv2FgAjIchyYOmEbY3bIvv2ymHjG3JLbGRyeYzn6CS2LkRjZgrZJHSnB2QpBwmSlYJ2AuPkEez0ntXP33oLMH3DL41VnQGmfjFXmskCHv-zWLXnZkQ3P3hAd-u1q3cR4jtZTbLwUIawdTrP7j5BbnGjJGuc8RmjxuKFSE-XpxmMKB8r5Ydg93uX5ROityhKJ9WE7dWPxsilgDcg-jtSD8bqrf0O3Ad6VDAUUyMFIABeWS69fun4Mkib5atH5eWIAAAA

X-I2p-Dest-Hash: ub2lkd2mckm2dsmt7zgrosrcnpbogowj7jiv5uipyj4s4gimt2za.b32.i2p

2018/10/31 06:48:19 Forwarding modified response: HTTP/1.1 200 OK

Connection: close

Content-Length: 4255

Accept-Ranges: bytes

Content-Type: text/html; charset=utf-8

Date: Wed, 31 Oct 2018 06:48:19 GMT

Last-Modified: Wed, 31 Oct 2018 06:18:14 GMT

X-I2p-Dest-Base32: 5n2nm5nidfptjc2nc4zaqkwonmzc4fc2qynwdqueyvvt4pzwjnaq.b32.i2p

X-I2p-Dest-Base64: UrwAU7TryeMuQ4iBSVAcSPpp66LoPU6BzEUE5UfCx-Z8sjKugSyYawmsePruyze7xgLLMiR26syKe2mO3rM1CRZQ1bbv4FgABulP5cqMXxFYXi3yop8sJ1Uz6jSDUaBecsOLB6CatM2y6En6LxCw2QztkMq5ztdzMQ-pVJkolCjtvSfBRjkwRYRspbyO0imtveb7U2-Hov3b52A44eUQg0~-aDxkQ3IE8Ie9AqN4JMeOwlwtGGWJonss-jdxzrpt6PojcISRNDcQno1aN3EX3fbdUND8JScK1ZZuXoErS3jTd9cVwEhsJmFof6IlGbUcgVBq21bqvYw1YkaVOHi2hzzn9FbNlUW9vmxDoYDmji8pwl3zyAs4Z6scMPYtiVQrhxQSVIkYWfWumHJ9KryIj1huKhb3SwTfvrmVyyeDL33fI3whvzDUQy2NjL4jjzbYQpeTAOCjuw7nQfBL30fjC69hnO4TzYwTLwEUtYvdwnUqPmuIjTgJpSuYB5AAAA

eephttpd

So, basically everything I put on i2p is a bunch of static files. Until now, I tried to host them using darkhttpd(a fork of lighttpd from Alpine which functions as a static Web Server) and by adding tunnel configuration information to tunnels.conf for i2pd. This is easier than manipulating a web interface, but still tedious and kind of error-prone. So instead, this serves simple static sites directly to i2p via the SAM API.

to build:

    git clone https://github.com/eyedeekay/eephttpd && cd eephttpd
    go get -u "github.com/eyedeekay/sam-forwarder"
    go get -u "github.com/eyedeekay/sam-forwarder/config"
    go build

to run:

    ./eephttpd

will serve the files from ./www, and store i2p keys in the working directory.

eephttpd - Static file server automatically forwarded to i2p

usage:

eephttpd is a static http server which automatically runs on i2p with the help of the SAM bridge. By default it will only be available from the localhost and it's i2p tunnel. It can be masked from the localhost using a container.

Usage of ./eephttpd:
  -a string
        hostname to serve on (default "127.0.0.1")
  -c    Use an encrypted leaseset(true or false)
  -d string
        the directory of static files to host(default ./www) (default "./www")
  -f string
        Use an ini file for configuration (default "none")
  -g    Uze gzip(true or false) (default true)
  -i    save i2p keys(and thus destinations) across reboots (default true)
  -ib int
        Set inbound tunnel backup quantity(0 to 5) (default 4)
  -il int
        Set inbound tunnel length(0 to 7) (default 3)
  -iq int
        Set inbound tunnel quantity(0 to 15) (default 8)
  -iv int
        Set inbound tunnel length variance(-7 to 7)
  -l string
        Type of access list to use, can be "whitelist" "blacklist" or "none". (default "none")
  -m string
        Certificate name to use (default "cert")
  -n string
        name to give the tunnel(default eephttpd) (default "eephttpd")
  -ob int
        Set outbound tunnel backup quantity(0 to 5) (default 4)
  -ol int
        Set outbound tunnel length(0 to 7) (default 3)
  -oq int
        Set outbound tunnel quantity(0 to 15) (default 8)
  -ov int
        Set outbound tunnel length variance(-7 to 7)
  -p string
        port to serve locally on (default "7880")
  -r    Reduce tunnel quantity when idle(true or false)
  -rc int
        Reduce idle tunnel quantity to X (0 to 5) (default 3)
  -rt int
        Reduce tunnel quantity after X (milliseconds) (default 600000)
  -s string
        the directory to save the keys in(default ./) (default ".")
  -sh string
        sam host to connect to (default "127.0.0.1")
  -sp string
        sam port to connect to (default "7656")
  -t    Generate or use an existing TLS certificate
  -z    Allow zero-hop, non-anonymous tunnels(true or false)

build in docker

docker build --build-arg user=eephttpd \
    --build-arg path=example/www \
    -f Dockerfile -t \
    eyedeekay/eephttpd .

Run in docker

docker run -i -t -d \
    --name eephttpd-volume \
    --volume eephttpd:/opt/eephttpd/ \
    eyedeekay/eephttpd
docker run -i -t -d \
    --network si \
    --env samhost=sam-host \
    --env samport=7656 \
    --env args=-r # Additional arguments to pass to eephttpd\
    --network-alias eephttpd \
    --hostname eephttpd \
    --name eephttpd \
    --restart always \
    --volumes-from eephttpd-volume \
    eyedeekay/eephttpd

instance

a running instance of eephttpd with the example index file is availble on http://566niximlxdzpanmn4qouucvua3k7neniwss47li5r6ugoertzuq.b32.i2p

2018/10/31 06:48:37 Accepted connection &{UrwAU7TryeMuQ4iBSVAcSPpp66LoPU6Bz~EUE5UfCx-Z8sjKugSyYawmsePruyze7xgLLM~iR26syKe2mO3rM1CRZQ1bbv4FgABulP5cqMXxFYXi3yop8sJ1Uz6jSDUaBe~csOL~B6CatM2y6En6LxCw2QztkMq5ztdzMQ-pVJkolCjtvSf~BRjkwRYRspbyO0imtveb7U~2-Hov3b52A44eUQg0~-aDxkQ3IE8Ie9AqN4JMeOwlwtGGWJonss-jdxzrpt6PojcISRNDcQno1aN3EX3fbdUND8JScK1ZZuXoErS3jTd9cVwEhsJmFof6IlGbUcgVBq21bqvYw1YkaVOHi2hzzn9FbNlUW9vmxDoYDmji8pwl3zyAs4Z6scMPYtiVQrhxQSVIkYWfWumHJ9KryIj1huKhb3SwTfvrmVyyeDL33fI3whvzDUQy2NjL4jjzbYQpeTAOCjuw7nQfBL30fjC69hnO4TzYwTLwEUtYvdwnUqPmuIjTgJpSuYB5AAAA uZvt~gfiQ6c7h0qt2Tg9mvPTLNJarXidhRqR-RW4z-VHcKN91pdROLLctSkTY9Qoq9ncuWxr5zmfS-3A~PRLZjn56KCoih4-830oU~HdTSgQtZk-~8VJ-OoQ6WvjME~9jQdZirVNrdDCVTx14F4t2-3RPMGbJfFX2l81ADZrxmkGWHq0C61GGRL-BZy7wW8qME5q9KnfHNfl7tnH54Vyw7piIVbuxXBKhfF~7rj-xgLLd-HsdkKUnFd2iEUu7XbDv2FgAjIchyYOmEbY3bIvv2ymHjG3JLbGRyeYzn6CS2LkRjZg~rZJHSnB2QpBwmSlYJ2AuPkEez0ntXP33oLMH3DL41VnQGmfjFXmskCHv-zWLXnZkQ3P3hAd-u1q3cR4jtZTbLwUIawdTrP7j5BbnGjJGuc8RmjxuKFSE-XpxmMKB8r5Ydg~93uX5ROityhKJ9WE7dWPxsilgDcg-jtSD8bqrf0O3Ad6VDAUUyMFIABeWS69fun4Mkib5atH5eWIAAAA 0xc4201a2010} 2018/10/31 06:48:37 Forwarding modified request: GET / HTTP/1.1

Host: 5n2nm5nidfptjc2nc4zaqkwonmzc4fc2qynwdqueyvvt4pzwjnaq.b32.i2p

Connection: close

Accept-Encoding: gzip, deflate

Connection: close

Upgrade-Insecure-Requests: 1

User-Agent: MYOB/6.66 (AN/ON)

X-I2p-Dest-Base32: ub2lkd2mckm2dsmt7zgrosrcnpbogowj7jiv5uipyj4s4gimt2za.b32.i2p

X-I2p-Dest-Base64: uZvtgfiQ6c7h0qt2Tg9mvPTLNJarXidhRqR-RW4z-VHcKN91pdROLLctSkTY9Qoq9ncuWxr5zmfS-3APRLZjn56KCoih4-830oUHdTSgQtZk-8VJ-OoQ6WvjME9jQdZirVNrdDCVTx14F4t2-3RPMGbJfFX2l81ADZrxmkGWHq0C61GGRL-BZy7wW8qME5q9KnfHNfl7tnH54Vyw7piIVbuxXBKhfF7rj-xgLLd-HsdkKUnFd2iEUu7XbDv2FgAjIchyYOmEbY3bIvv2ymHjG3JLbGRyeYzn6CS2LkRjZgrZJHSnB2QpBwmSlYJ2AuPkEez0ntXP33oLMH3DL41VnQGmfjFXmskCHv-zWLXnZkQ3P3hAd-u1q3cR4jtZTbLwUIawdTrP7j5BbnGjJGuc8RmjxuKFSE-XpxmMKB8r5Ydg93uX5ROityhKJ9WE7dWPxsilgDcg-jtSD8bqrf0O3Ad6VDAUUyMFIABeWS69fun4Mkib5atH5eWIAAAA

X-I2p-Dest-Hash: ub2lkd2mckm2dsmt7zgrosrcnpbogowj7jiv5uipyj4s4gimt2za.b32.i2p

2018/10/31 06:48:37 Response Error: [] read tcp 127.0.0.1:50366->127.0.0.1:7880: use of closed network connection