项目作者: kpcyrd

项目描述 :
:construction: EXPERIMENTAL :construction: Secure hidden service webserver
高级语言: Rust
项目地址: git://github.com/kpcyrd/narnia.git
创建时间: 2021-04-04T02:19:23Z
项目社区:https://github.com/kpcyrd/narnia

开源协议:GNU General Public License v3.0

下载


narnia

narnia is a fast static webserver specifically designed for Tor hidden services. It’s also able to spawn a Tor thread and expose itself as a hidden service, simply by setting an additional commandline option.

narnia is hosting a mirror of its own source code on http://3wisi2bfpxplne5wlwz4l5ucvsbaozbteaqnm62oxzmgwhb2qqxvsuyd.onion/.

  1. # Start the http server and serve files in www/
  2. narnia -B '[::1]:1337' -w www/
  3. # Serve www/ and enable directory listing
  4. narnia -B '[::1]:1337' -Lw www/
  5. # Serve www/ on a unix domain socket
  6. # The path needs to start with either . or /
  7. narnia -B ./narnia.sock -w www/
  8. # Serve www/ on a hidden service
  9. # The hidden service address is in `data/hs/hostname`
  10. narnia -D data/ -w www/
  11. # Serve www/ but chroot into it beforehand, verbose logs
  12. narnia -vv -B '[::1]:1337' -w / -C www/

Comparison of http response headers

narnia

  1. < HTTP/1.1 200 OK
  2. < content-length: 1337
  3. < accept-ranges: bytes
  4. < date: Thu, 01 Jan 1970 00:00:00 GMT
  5. < content-type: text/html; charset=utf-8
  6. < x-content-type-options: nosniff
  7. < referrer-policy: no-referrer

onionshare

  1. < HTTP/1.0 200 OK
  2. < Content-Type: text/html; charset=utf-8
  3. < Content-Length: 1337
  4. < X-Frame-Options: DENY
  5. < X-Xss-Protection: 1; mode=block
  6. < X-Content-Type-Options: nosniff
  7. < Referrer-Policy: no-referrer
  8. < Server: OnionShare
  9. < Content-Security-Policy: default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self' data:;
  10. < Date: Mon, 05 Apr 2021 19:08:54 GMT

nginx

  1. < HTTP/1.1 200 OK
  2. < Server: nginx
  3. < Date: Mon, 05 Apr 2021 19:04:42 GMT
  4. < Content-Type: text/html
  5. < Content-Length: 1337
  6. < Last-Modified: Mon, 05 Apr 2021 19:04:33 GMT
  7. < Connection: keep-alive
  8. < ETag: "606b5f41-539"
  9. < Accept-Ranges: bytes

Static binary

Linux

  1. sudo pacman -S musl
  2. rustup target add x86_64-unknown-linux-musl
  3. cargo build --release --target x86_64-unknown-linux-musl --features=vendored
  4. strip target/x86_64-unknown-linux-musl/release/narnia
  5. ldd target/x86_64-unknown-linux-musl/release/narnia

Windows

  1. pacman -S mingw-w64
  2. rustup target add x86_64-pc-windows-gnu
  3. cargo build --release --target x86_64-pc-windows-gnu --features=vendored
  4. x86_64-w64-mingw32-strip target/x86_64-pc-windows-gnu/release/narnia.exe
  5. file target/x86_64-pc-windows-gnu/release/narnia.exe

Building

OpenBSD

You need to install rust, autoconf and automake. You’re getting asked for a version, select the latest one and take note of the first two numbers of the version. You can look this up with pkg_info if you forget them. This example output is from OpenBSD 6.8.

  1. $ doas pkg_add autoconf automake
  2. quirks-3.442 signed on 2021-04-08T13:45:25Z
  3. Ambiguous: choose package for autoconf
  4. a 0: <None>
  5. 1: autoconf-2.13p4
  6. 2: autoconf-2.52p6
  7. 3: autoconf-2.54p6
  8. 4: autoconf-2.56p5
  9. 5: autoconf-2.57p5
  10. 6: autoconf-2.58p5
  11. 7: autoconf-2.59p5
  12. 8: autoconf-2.60p5
  13. 9: autoconf-2.61p5
  14. 10: autoconf-2.62p2
  15. 11: autoconf-2.63p1
  16. 12: autoconf-2.64p1
  17. 13: autoconf-2.65p1
  18. 14: autoconf-2.67p1
  19. 15: autoconf-2.68p1
  20. 16: autoconf-2.69p3
  21. Your choice: 16
  22. autoconf-2.69p3:metaauto-1.0p4: ok
  23. autoconf-2.69p3: ok
  24. Ambiguous: choose package for automake
  25. a 0: <None>
  26. 1: automake-1.4.6p5
  27. 2: automake-1.8.5p9
  28. 3: automake-1.9.6p12
  29. 4: automake-1.10.3p9
  30. 5: automake-1.11.6p3
  31. 6: automake-1.12.6p2
  32. 7: automake-1.13.4p2
  33. 8: automake-1.14.1p1
  34. 9: automake-1.15.1
  35. 10: automake-1.16.2
  36. Your choice: 10
  37. automake-1.16.2: ok

Next, pass the versions to cargo build:

  1. AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.16 cargo build

Alpine

  1. doas apk add make autoconf automake openssl-dev

License

GPLv3+