Giter VIP home page Giter VIP logo

bjoernbessert / haproxy-cert-otf Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 2.0 183 KB

Create SSL certificates on the fly with HAProxy. Certs are generated dynamically and transparently on the first request.

License: MIT License

Dockerfile 9.83% Makefile 5.79% Shell 40.79% Lua 39.25% Python 4.33%
haproxy haproxy-lua haproxy-docker ssl ssl-certificates ssl-termination https-certificate https tls

haproxy-cert-otf's Introduction

  • master (Github Actions): Build Status

haproxy-cert-otf

Create SSL certificates on the fly with HAProxy. With the help of Lua the certificate is generated dynamically and transparently on the first request.

Motivation

  • Internal Domains (HTTPS-only)

    • No wildcard certs possible, because of domain structure with multiple different (sub)levels
  • Internal Root-CA which creates certs and is imported in clients (browsers etc.)

Details

  • Tested with (at least) the following HAProxy LTS releases: 2.4.0, 2.2.0

  • HAProxy configs: Link

  • LUA script(s): Link

Using/Demo

  • Install docker and docker-compose

  • Build all container-images from dockerfiles/ (make build)

  • Choose your certificate generation method:

    • export GET_CERT_METHOD=localca or export GET_CERT_METHOD=http
    • "get_cert_method"
      • localca: Import the Root CA (ca.crt) Link into your client/browser or replace the ca-files with your own (and rebuild haproxy container)
      • http: Set an URL in get_cert_via_http() Link where you can get the certs in *.pem-format
  • docker-compose up -d

  • docker-compose logs -f haproxy

  • Direct your domain(s) to 127.0.0.1

  • Certificates should now be generated on the fly, client/browser should not display any warning

TODO

  • Concurrency testing (Vegeta)
  • DOC: Using a Intermediate CA with X.509 Name Constraints
  • HAProxy multiple instances example for non-docker systems (maybe trough systemd)

Possible Improvements

  • Locking mechanism

  • Load an index of all existing certs in memory on HAProxy startup (Lua + HAProxy stick-tables or Lua + HAProxy maps). Would save the filesystem lookups (maybe not an improvement at all because of already existing filesystem cache)

  • Use 'luaossl" directly instead of openssl binary

  • Do not start HAProxy as root (execute supervisortcl via sudo as haproxy user)

  • Docker-specific: Mount (host-)volume for certs. If container is destroyed, certs doesnt have to generated again

  • Auth-header (token or something) for HTTP-method

  • Implement haproxy reload? (through supervisor?) - maybe faster than restart

    • maybe try supervisor + "-W" from haproxy
  • Docker-specific: Two separate containers for the HAProxys (then maybe mount a volume with the certs into both containers)

Testing

  • Install bats:

    • sudo apt-get update && sudo apt-get -y install bats
  • make test

  • Run specific test

    • bats tests/$FILE.bats

Acknowledgments

haproxy-cert-otf's People

Contributors

bjoernbessert avatar oppodelldog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

oppodelldog vixns

haproxy-cert-otf's Issues

not open vm ip

i installed bjoernbessert from one vm instaled complete my vm ip is 192.168.1.100 but not return anything . aslo in vm terminal curl 127.0.0.1 return curl: (52) Empty reply from server

vahid@haproxy:~/haproxy-cert-otf-master$ docker-compose up -d
/snap/docker/2285/lib/python3.6/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography.hazmat.backends import default_backend
Starting haproxy-cert-otf-master_apache_1 ... done
Starting haproxy-cert-otf-master_ca-api_1 ... done
Starting haproxy-cert-otf-master_haproxy_1 ... done

please help

hi
I have a saas system in which the user can define other domains. And by setting the saas server ip on any domain with ssl, it can see saas.
After much research, I came to the conclusion that haproxy can solve this problem . do this package can solve my problem??

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.