[1] | 1 | # Morty
|
---|
| 2 |
|
---|
[86] | 3 | [](https://travis-ci.org/asciimoo/morty)
|
---|
[84] | 4 | [](https://www.gnu.org/licenses/agpl-3.0)
|
---|
[105] | 5 | [](https://hub.docker.com/r/dalf/morty)
|
---|
[81] | 6 |
|
---|
[1] | 7 | Web content sanitizer proxy as a service
|
---|
| 8 |
|
---|
[19] | 9 | Morty rewrites web pages to exclude malicious HTML tags and attributes. It also replaces external resource references to prevent third party information leaks.
|
---|
[1] | 10 |
|
---|
[6] | 11 | The main goal of morty is to provide a result proxy for [searx](https://asciimoo.github.com/searx/), but it can be used as a standalone sanitizer service too.
|
---|
[1] | 12 |
|
---|
[6] | 13 | Features:
|
---|
[1] | 14 |
|
---|
[19] | 15 | - HTML sanitization
|
---|
| 16 | - Rewrites HTML/CSS external references to locals
|
---|
[6] | 17 | - JavaScript blocking
|
---|
[19] | 18 | - No Cookies forwarded
|
---|
| 19 | - No Referrers
|
---|
| 20 | - No Caching/Etag
|
---|
[6] | 21 | - Supports GET/POST forms and IFrames
|
---|
[1] | 22 | - Optional HMAC URL verifier key to prevent service abuse
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | ## Installation and setup
|
---|
[82] | 26 | Requirement: Go version 1.10 or higher.
|
---|
[1] | 27 |
|
---|
| 28 | ```
|
---|
[140] | 29 | $ go install github.com/asciimoo/morty@latest
|
---|
[1] | 30 | $ "$GOPATH/bin/morty" --help
|
---|
| 31 | ```
|
---|
| 32 |
|
---|
[138] | 33 | ### Usage
|
---|
| 34 |
|
---|
| 35 | ```
|
---|
| 36 | -debug
|
---|
| 37 | Debug mode (default true)
|
---|
| 38 | -followredirect
|
---|
| 39 | Follow HTTP GET redirect
|
---|
[140] | 40 | -hashparam string
|
---|
| 41 | User-defined requesting string HASH parameter name (ie: '/?hash=...' or '/?h=...') (default "mortyhash")
|
---|
[138] | 42 | -ipv6
|
---|
| 43 | Allow IPv6 HTTP requests (default true)
|
---|
| 44 | -key string
|
---|
| 45 | HMAC url validation key (base64 encoded) - leave blank to disable validation
|
---|
| 46 | -listen string
|
---|
| 47 | Listen address (default "127.0.0.1:3000")
|
---|
| 48 | -proxy string
|
---|
| 49 | Use the specified HTTP proxy (ie: '[user:pass@]hostname:port'). Overrides -socks5, -ipv6.
|
---|
| 50 | -proxyenv
|
---|
| 51 | Use a HTTP proxy as set in the environment (HTTP_PROXY, HTTPS_PROXY and NO_PROXY). Overrides -proxy, -socks5, -ipv6.
|
---|
| 52 | -socks5 string
|
---|
| 53 | Use a SOCKS5 proxy (ie: 'hostname:port'). Overrides -ipv6.
|
---|
| 54 | -timeout uint
|
---|
| 55 | Request timeout (default 5)
|
---|
[140] | 56 | -urlparam string
|
---|
| 57 | User-defined requesting string URL parameter name (ie: '/?url=...' or '/?u=...') (default "mortyurl")
|
---|
[138] | 58 | -version
|
---|
| 59 | Show version
|
---|
| 60 | ```
|
---|
| 61 |
|
---|
[101] | 62 | ### Environment variables
|
---|
[1] | 63 |
|
---|
[138] | 64 | Morty can additionally be configured using the following environment variables:
|
---|
[101] | 65 | - `MORTY_ADDRESS`: Listen address (default to `127.0.0.1:3000`)
|
---|
| 66 | - `MORTY_KEY`: HMAC url validation key (base64 encoded) to prevent direct URL opening. Leave blank to disable validation. Use `openssl rand -base64 33` to generate.
|
---|
[140] | 67 | - `MORTY_URL_PARAM`: User-defined requesting string URL parameter name (ie: `/?url=...` or `/?u=...`) (default `mortyurl`)
|
---|
| 68 | - `MORTY_HASH_PARAM`: User-defined requesting string HASH parameter name (ie: `/?hash=...` or `/?h=...`) (default `mortyhash`)
|
---|
[101] | 69 | - `DEBUG`: Enable/disable proxy and redirection logs (default to `true`). Set to `false` to disable.
|
---|
| 70 |
|
---|
| 71 | ### Docker
|
---|
| 72 |
|
---|
| 73 | ```
|
---|
[138] | 74 | docker run -e DEBUG=false -e MORTY_ADDRESS=0.0.0.0:3000 dalf/morty
|
---|
[101] | 75 | ```
|
---|
| 76 |
|
---|
| 77 | ```
|
---|
[138] | 78 | docker run -e DEBUG=false dalf/morty -listen 0.0.0.0:3000
|
---|
[101] | 79 | ```
|
---|
| 80 |
|
---|
| 81 |
|
---|
[48] | 82 | ### Test
|
---|
| 83 |
|
---|
| 84 | ```
|
---|
| 85 | $ cd "$GOPATH/src/github.com/asciimoo/morty"
|
---|
| 86 | $ go test
|
---|
| 87 | ```
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | ### Benchmark
|
---|
| 91 |
|
---|
| 92 | ```
|
---|
| 93 | $ cd "$GOPATH/src/github.com/asciimoo/morty"
|
---|
| 94 | $ go test -benchmem -bench .
|
---|
| 95 | ```
|
---|
| 96 |
|
---|
| 97 |
|
---|
[1] | 98 | ## Bugs
|
---|
| 99 |
|
---|
[101] | 100 | Bugs or suggestions? Visit the [issue tracker](https://github.com/asciimoo/morty/issues).
|
---|