thruster-dilolabs 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6ac259b7de0372f6568f28d90fac147559ce1a74dc1850d2d14820ef133a1f2a
4
+ data.tar.gz: 67d746bc119be929084e1db7afe2c9c9cecb97dbdcc9ef6b19a3286ae12cfce5
5
+ SHA512:
6
+ metadata.gz: 37d73bce0539d9330e7ba57d12e639dc5593d25196a9bf210a72789ad983f81163d5982dfdb0eb06c2b11b4154d2d857ccc417b0bb34d382e0d35f4cfedd9045
7
+ data.tar.gz: 1fc249999a2baf44185645c8b7a029091891e9e194d1027ed4b7d9a5669df0eeacc851995cb0f45881cee2c98bd62a3e49069ded49e46e10e596fa1ab5901b35
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 37signals, LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Thruster
2
+
3
+ Thruster is an HTTP/2 proxy for simple production-ready deployments of Rails
4
+ applications. It runs alongside the Puma webserver to provide a few additional
5
+ features that help your app run efficiently and safely on the open Internet:
6
+
7
+ - HTTP/2 support
8
+ - Automatic TLS certificate management with Let's Encrypt
9
+ - Basic HTTP caching of public assets
10
+ - X-Sendfile support and compression, to efficiently serve static files
11
+
12
+ Thruster aims to be as zero-config as possible. It has no configuration file,
13
+ and most features are automatically enabled with sensible defaults. The goal is
14
+ that simply running your Puma server with Thruster should be enough to get a
15
+ production-ready setup.
16
+
17
+ The only exception to this is TLS provisioning: in order for Thruster to
18
+ provision TLS certificates, it needs to know which domain those certificates
19
+ should be for. So to use TLS, you need to set the `TLS_DOMAIN` environment
20
+ variable. If you don't set this variable, Thruster will run in HTTP-only mode.
21
+
22
+ Thruster also wraps the Puma process so that you can use it without managing
23
+ multiple processes yourself. This is particularly useful when running in a
24
+ containerized environment, where you typically won't have a process manager
25
+ available to coordinate the processes. Instead you can use Thruster as your
26
+ `CMD`, and it will manage Puma for you.
27
+
28
+ Thruster was originally created for the [ONCE](https://once.com) project, where
29
+ we wanted a no-fuss way to serve a Rails application from a single container,
30
+ directly on the open Internet. We've since found it useful for simple
31
+ deployments of other Rails applications.
32
+
33
+
34
+ ## Installation
35
+
36
+ Thruster is distributed as a Ruby gem. Because Thruster is written in Go, we
37
+ provide several pre-built platform-specific binaries. Installing the gem will
38
+ automatically fetch the appropriate binary for your platform.
39
+
40
+ To install it, add it to your application's Gemfile:
41
+
42
+ ```ruby
43
+ gem 'thruster'
44
+ ```
45
+
46
+ Or install it globally:
47
+
48
+ ```sh
49
+ $ gem install thruster
50
+ ```
51
+
52
+
53
+ ## Usage
54
+
55
+ To run your Puma application inside Thruster, prefix your usual command string
56
+ with `thrust`. For example:
57
+
58
+ ```sh
59
+ $ thrust bin/rails server
60
+ ```
61
+
62
+ Or with automatic TLS:
63
+
64
+ ```sh
65
+ $ TLS_DOMAIN=myapp.example.com thrust bin/rails server
66
+ ```
67
+
68
+
69
+ ## Custom configuration
70
+
71
+ In most cases, Thruster should work out of the box with no additional
72
+ configuration. But if you need to customize its behavior, there are a few
73
+ environment variables that you can set.
74
+
75
+ | Variable Name | Description | Default Value |
76
+ |-----------------------------|---------------------------------------------------------|---------------|
77
+ | `TLS_DOMAIN` | Comma-separated list of domain names to use for TLS provisioning. If not set, TLS will be disabled. | None |
78
+ | `TARGET_PORT` | The port that your Puma server should run on. Thruster will set `PORT` to this value when starting your server. | 3000 |
79
+ | `CACHE_SIZE` | The size of the HTTP cache in bytes. | 64MB |
80
+ | `MAX_CACHE_ITEM_SIZE` | The maximum size of a single item in the HTTP cache in bytes. | 1MB |
81
+ | `GZIP_COMPRESSION_ENABLED` | Whether to enable gzip compression for responses. Set to `0` or `false` to disable. | Enabled |
82
+ | `GZIP_COMPRESSION_DISABLE_ON_AUTH` | If set to `true`, disable gzip compression for authenticated requests with `Cookie`, `Authorization`, or `X-Csrf-Token` headers. | `false` |
83
+ | `GZIP_COMPRESSION_JITTER` | The amount of random jitter (in bytes) to add to the compressed response size to mitigate BREACH attacks. Set to `0` to disable. | 32 |
84
+ | `X_SENDFILE_ENABLED` | Whether to enable X-Sendfile support. Set to `0` or `false` to disable. | Enabled |
85
+ | `MAX_REQUEST_BODY` | The maximum size of a request body in bytes. Requests larger than this size will be refused; `0` means no maximum size is enforced. | `0` |
86
+ | `STORAGE_PATH` | The path to store Thruster's internal state. Provisioned TLS certificates will be stored here, so that they will not need to be requested every time your application is started. | `./storage/thruster` |
87
+ | `BAD_GATEWAY_PAGE` | Path to an HTML file to serve when the backend server returns a 502 Bad Gateway error. If there is no file at the specific path, Thruster will serve an empty 502 response instead. Because Thruster boots very quickly, a custom page can be a useful way to show that your application is starting up. | `./public/502.html` |
88
+ | `HTTP_PORT` | The port to listen on for HTTP traffic. | 80 |
89
+ | `HTTPS_PORT` | The port to listen on for HTTPS traffic. | 443 |
90
+ | `HTTP_IDLE_TIMEOUT` | The maximum time in seconds that a client can be idle before the connection is closed. | 60 |
91
+ | `HTTP_READ_TIMEOUT` | The maximum time in seconds that a client can take to send the request headers and body. | 30 |
92
+ | `HTTP_WRITE_TIMEOUT` | The maximum time in seconds during which the client must read the response. | 30 |
93
+ | `H2C_ENABLED` | Set to `1` or `true` to enable h2c (http/2 cleartext) | Disabled |
94
+ | `ACME_DIRECTORY` | The URL of the ACME directory to use for TLS certificate provisioning. | `https://acme-v02.api.letsencrypt.org/directory` (Let's Encrypt production) |
95
+ | `EAB_KID` | The EAB key identifier to use when provisioning TLS certificates, if required. | None |
96
+ | `EAB_HMAC_KEY` | The Base64-encoded EAB HMAC key to use when provisioning TLS certificates, if required. | None |
97
+ | `FORWARD_HEADERS` | Whether to forward X-Forwarded-* headers from the client. | Disabled when running with TLS; enabled otherwise |
98
+ | `LOG_REQUESTS` | Log all requests. Set to `0` or `false` to disable request logging | Enabled |
99
+ | `DEBUG` | Set to `1` or `true` to enable debug logging. | Disabled |
100
+
101
+ To prevent naming clashes with your application's own environment variables,
102
+ Thruster's environment variables can optionally be prefixed with `THRUSTER_`.
103
+ For example, `TLS_DOMAIN` can also be written as `THRUSTER_TLS_DOMAIN`. Whenever
104
+ a prefixed variable is set, it will take precedence over the unprefixed version.
105
+
106
+ ## Security
107
+
108
+ ### BREACH Mitigation
109
+
110
+ Thruster includes built-in mitigation for the [BREACH attack](https://breachattack.com/), which allows attackers to extract secrets from compressed encrypted traffic.
111
+
112
+ 1. **Random Jitter (Enabled by Default)**: Thruster adds a random amount of "jitter" (padding) to the size of compressed responses. This makes it significantly harder for attackers to infer the content based on the compressed size. The default jitter is 32 bytes, controlled by `GZIP_COMPRESSION_JITTER`.
113
+ 2. **Compression Guard (Optional)**: For higher security, you can disable compression entirely for authenticated requests (requests containing `Cookie`, `Authorization`, or `X-Csrf-Token` headers) by setting `GZIP_COMPRESSION_DISABLE_ON_AUTH=true`. This eliminates the side-channel entirely for sensitive traffic but may increase bandwidth usage.
114
+
115
+ By default, Thruster prioritizes performance while providing baseline protection via jitter. Operators with strict security requirements should consider enabling the Compression Guard.
data/exe/thrust ADDED
@@ -0,0 +1,11 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ PLATFORM = [ :cpu, :os ].map { |m| Gem::Platform.local.send(m) }.join("-")
4
+ EXECUTABLE = File.expand_path(File.join(__dir__, PLATFORM, "thrust"))
5
+
6
+ if File.exist?(EXECUTABLE)
7
+ exec(EXECUTABLE, *ARGV)
8
+ else
9
+ STDERR.puts("ERROR: Unsupported platform: #{PLATFORM}")
10
+ exit 1
11
+ end
@@ -0,0 +1,3 @@
1
+ module Thruster
2
+ VERSION = "0.1.19"
3
+ end
data/lib/thruster.rb ADDED
@@ -0,0 +1,4 @@
1
+ module Thruster
2
+ end
3
+
4
+ require_relative "thruster/version"
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thruster-dilolabs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.19
5
+ platform: ruby
6
+ authors:
7
+ - Kevin McConnell
8
+ - Cyril Blaecke
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A zero-config HTTP/2 proxy for lightweight production deployments
14
+ email: cyril@dilolabs.fr
15
+ executables:
16
+ - thrust
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - MIT-LICENSE
21
+ - README.md
22
+ - exe/thrust
23
+ - lib/thruster.rb
24
+ - lib/thruster/version.rb
25
+ homepage: https://github.com/dilolabs/thruster
26
+ licenses:
27
+ - MIT
28
+ metadata:
29
+ homepage_uri: https://github.com/dilolabs/thruster
30
+ rubygems_mfa_required: 'true'
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 4.0.6
46
+ specification_version: 4
47
+ summary: Zero-config HTTP/2 proxy
48
+ test_files: []