Giter Site home page Giter Site logo

slt's Introduction

slt is a dead-simple TLS reverse-proxy with SNI multiplexing (TLS virtual hosts).

That means you can send TLS/SSL connections for multiple different applications to the same port and forward them all to the appropriate backend hosts depending on the intended destination.

Features

SNI Multiplexing

slt multiplexes connections to a single TLS port by inspecting the name in the SNI extension field of each connection.

Simple YAML Configuration

You configure slt with a simple YAML configuration file:

bind_addr: ":443"

frontends:
  v1.example.com:
    backends:
      -
        addr: ":4443"

  v2.example.com:
    backends:
      -
        addr: "192.168.0.2:443"
      -
        addr: "192.168.0.1:443"

Optional TLS Termination

Sometimes, you don't actually want to terminate the TLS traffic, you just want to forward it elsewhere. slt only terminates the TLS traffic if you specify a private key and certificate file like so:

frontends:
  v1.example.com:
    tls_key: /path/to/v1.example.com.key
    tls_crt: /path/to/v1.example.com.crt

Round robin load balancing among arbitrary backends

slt performs simple round-robin load balancing when more than one backend is available (other strategies will be available in the future):

frontends:
  v1.example.com:
    backends:
      -
        addr: ":8080"
      -
        addr: ":8081"

Running it

Running slt is also simple. It takes a single argument, the path to the configuration file:

./slt /path/to/config.yml

Building it

Just cd into the directory and "go build". It requires Go 1.1+.

Testing it

Just cd into the directory and "go test".

Stability

I run slt in production handling hundreds of thousands of connections daily.

License

Apache

slt's People

Contributors

inconshreveable avatar scele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slt's Issues

mysterious occasional hanging in browser

I put slt into production yesterday reverse-proxying and terminating tls in front of single golang http server backend. Over the course of the next day I got some user reports of occasional mysterious hanging pages in their browser. Testing it myself I have seen it happen a few times today, though I can't find a sequence of steps that repeats it. @inconshreveable I know you are using slt in production. Are you proxying https with it? Have you ever seen this hanging behavior? Any ideas where I might look to track it down and fix? I love the simplicity of slt and would like to make it work.

Race condition in testsuite causes deadlocks

From: https://bugs.debian.org/851876

There is a race condition in the testsuite related to closing the listener mux.

Due to golang/go#10527 (which may or may not be a bug), calling Listener.Close does not actually close the socket if any goroutines are still blocked in Listener.Accept. This means that after TestSimple finishes, TestMany may run immediately afterwards and try to bind to port 55111 but it can't because the socket from TestSimple hasn't been closed yet.

This can happen by chance on any system, but on uniprocessor systems this is 100% reproducible because the go scheduler always schedules TaskMany first. If you are on Linux, I found that it's easy to reproduce this by hotplugging all but one CPU out.

Error: Host not found

when i connect it,show me this:

slt 2015/02/03 23:16:57 server.go:104: Failed to mux connection from 183.206.192.151:32656, error: Host not found:

i can't understand what happened.

Not appearing IPv4 listen ports

$ netstat -tulnp | grep -ie slt
tcp6       0      0 :::443                  :::*                    LISTEN      3376/slt

Why netstat only detects slt is listening on IPv6 port?

Feature: Add support for Let's Encrypt enrollment when terminating TLS

Currently, to terminate TLS with slt you have to manage the cert on your own. It would be nice to support on-the-fly autoenrollment for a valid cert via Let's Encrypt. There's already great support for this via golang.org/x/crypto/acme/autocert, it just needs to be integrated.

PR to follow

Hot reloading of configuration file.

Having hot reload functionality to change the backends in the configuration file and have those take effect without restarting "slt" can take this package really to the next level.

Reusing Connections?

Cool project. I was looking at the source code and it looks like you establish a new connection to each backend each time a new connection to the frontend is made. Is that right?

I noticed the DefaultRoundTripper in net/http has some mechanism for re-using connections... have you considered adding this capability? Perhaps it's a non-issue if you leverage persistent connections with the real web server?

Extra default backend for non-SNI

When client is not using SNI, in some scenarios the backend can return unwanted content.
There should be 2 differenced default frontends: default SNI and default without SNI. In second case if a SNI could be added to communication to backend this would be very good.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.