GithubHelp home page GithubHelp logo

quay / jwtproxy Goto Github PK

View Code? Open in Web Editor NEW
408.0 26.0 42.0 7.45 MB

An HTTP-Proxy that adds AuthN through JWTs

License: Apache License 2.0

Go 98.82% Dockerfile 1.18%
proxy jwt tls authentication http-proxy

jwtproxy's Introduction

JWT Proxy

Docker Repository on Quay

The JWT proxy is intended to be used as a complementary service for authenticating, and possibly authorizing requests made between services. There is a forward proxy component, which can be configured to sign outgoing requests to another service, and a reverse proxy component, which can be used to authenticate incoming requests from another service.

JWT Forward Proxy

The JWT forward proxy is used to sign outgoing requests with a JWT using a private key.

Features

  • Append a JWT Authorization header containing claims about which service the request originated from, and who is the intended recipient
  • Autogenerate private signing keys, and publish the public portion to a server following the key server specification
  • Ability to use a preshared private key if we don't want to use autogenerated keys (useful when originating service is HA)
  • Ability to sign SSL requests using MITM SSL with configurable certificate authority

Potential Features

  • Ability to append static claims via config
  • Ability to read dynamic claims out of a request header and turn them into JWT claims

Limitations

  • When the proxy is configured to use MITM SSL, the CONNECT tunneling mechanism is only available to forward HTTPS requests. By default, most clients exclusively use CONNECT for HTTPS requests, which is 100% supported.

JWT Reverse Proxy

The JWT reverse proxy is used to verify incoming requests that were signed by the forward proxy.

Features

  • Ability to decode and verify JWT Authorization headers on incoming requests
  • Ability to verify the signature based on the specified signing key against a public key fetched from a key server
  • Ability to verify from a single issuer using a pre-shared public key (likely only useful for testing)
  • Ability to verify SSL requests by doing SSL termination on behalf of the upstream
  • Pluggable claims verifier interface, with bundled static claims verifier implementation

Potential Features

  • Ability to parse and write claims as an unforgeable header sent to the upstream
  • Load balancing among multiple upstreams
  • Ability to dial a unix socket for communication with upstream server
  • Ability to bind a unix socket for use behind another proxy/load balancer/server
  • Implementation of the claims verifier interface which loads a lua file

Usage

Run with:

jwtproxy -config config.yaml

The configuration yaml file contains a jwtproxy top level config flag, which allows a single yaml file to be used to configure multiple services. The presence or absence of a signer config or verifier config block will enable the forward and reverse proxy respectively.

jwtproxy:
  <Signer Config>

  verifier_proxies:
  - <Verifier Config>
  - <Verifier Config>

Examples

Usage examples are provided in the examples folder.

Signer Config

Configures and enables the JWT forward signing proxy.

jwtproxy:
  signer_proxy:
    enabled: <bool|true>

    # Addr at which to bind proxy server
    listen_addr: <string|:8080>
    shutdown_timeout: <time.Duration|1m>

    # Optional key and CA certificate to forge MITM SSL certificates
    ca_key_file: <path|nil>
    ca_crt_file: <path|nil>

    # Certificates to be trusted by the proxy when its MITM mechanism communicates with remotes.
    # This is optional. Specifying it currently replaces system root certificates entirely.
    trusted_certificates: <[]string|system root certificates>

    # Whether the remotes' certificate chain and host name should be verified.
    insecure_skip_verify: <bool|false>

    signer:
      # Signing service name
      issuer: <string|nil>

      # Validity duration
      expiration_time: <time.Duration|5m>

      # How much time skew we allow between signer and verifier
      max_skew: <time.Duration|1m>

      # Length of random nonce values
      nonce_length: <int|32>

      # Registerable private key source type
      private_key:
        type: <string|nil>
        options: <map[string]interface{}>

Autogenerated Private Key

Configures a private key source which generates key pairs automatically and publishes them to a key server.

private_key:
  type: autogenerated
  options:
    # How often we publish a new key
    rotate_every: <time.Duration|12h>

    # Folder in which to store autogenerated keys on disk
    key_folder: <string|~/.config/jwtproxy/>

    # Registerable key server and config at which to publish public keys
    key_server:
      type: <string|nil>
      options: <map[string]interface{}>

Key Registry Key Server

Configures a key server which talks to a server which implements the key registry protocol.

key_server:
  type: keyregistry
  options:
    # Base URL from which to access key registry endpoints.
    registry: <string|nil>

Preshared Private Key

Configures a private key source which simply uses the key files specified.

private_key:
  type: preshared
  options:
    # Unique identifier for the private key
    key_id: <string|nil>

    # Location of PEM encoded private key file
    private_key_path: <path|nil>

Verifier Config

Configures and enables one or more JWT verifying reverse proxyies.

jwtproxy:
  verifier_proxies:
  - enabled: <bool|true>

    # Addr at which to listen for requests
    # It can either be an HTTP(s) URL or an UNIX socket path prefixed by 'unix:'
    listen_addr: <string|:8081>
    shutdown_timeout: <time.Duration|1m>

    # Optional PEM private key and certificate files for SSL termination
    key_file: <path|nil>
    crt_file: <path|nil>

    verifier:
      # Upstream server to which to forward requests
      # It can either be an HTTP(s) URL or an UNIX socket path prefixed by 'unix:'
      upstream: <string|nil>

      # Required value for audience claim,
      # Usually our advertised protocol and hostname
      audience: <string|nil>

      # How much time skew we allow between signer and verifier
      max_skew: <time.Duration|1m>

      # Maximum total amount of time for which a JWT can be signed
      max_ttl: <time.Duration|5m>

      # Registerable key server type and options used to fetch
      # public keys for verifying signatures
      key_server:
         type: <string|nil>
         options: <map[string]interface{}>

      # Registerable type and options where we track used nonces
      nonce_storage:
        type: <string|nil>
        options: <map[string]interface{}>

Key Registry Key Server

Configures a key server which fetches public keys from a server which implements the key registry protocol.

key_server:
  type: keyregistry
  options:
    # Base URL from which to access key registry endpoints.
    registry: <string|nil>

    # Optional cache config to alleviate load on the key server.
    cache:
      # How long the keys stay valid in the cache
      duration: <time.Duration|10m>

      # How often expired keys are removed from memory
      purge_interval: <time.Duration|1m>

Preshared Key Server (Testing Only)

Configures a local preshared mock key server which can return one and only one public key. This should probably be used only for testing.

key_server:
  type: preshared
  options:
    # Configures the only issuer we will allow
    issuer: <string|nil>

    # Unique ID of the only key from which we validate requests
    key_id: <string|nil>

    # File path to the PEM encoded public key to verify signatures
    public_key_path: <path|nil>

Local Nonce Storage

Configures nonce storage which stores previously seen nonces in a TTL cache in memory.

nonce_storage:
  type: local
  options:
    # How often we run the cache janitor to clean up expired nonces
    purge_interval: <time.Duration|0>

Generate keys

Generate forward proxy's CA certificate and private key

When it comes to sign HTTPs requests, the forward proxy must hijack connections and act as a man-in-the-middle. Therefore, the proxy requires a CA certificate and private key in order to forge TLS/SSL certificates on behalf on the remote HTTPs server. If none are specified, the forward proxy will throw a warning at startup and refuse to proxy HTTPs requests.

The following commands generate both, valid for a year, without any passphrase (otherwise, the proxy would require us to type it).

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ca.key -out ca.crt

The certificate then has to be distributed and trusted by every clients that goes through the forward proxy. The private key must remain secret.

The CA certificate and private key should be specified using the ca_key_file and ca_crt_file parameters in the Signer configuration.

Generate reverse proxy's key pair

To confirm reverse proxy's authenticity and to guarantee confidentiality and integrity of the exchanged data, the reverse proxy can terminate TLS/SSL using a public/private key pair. The key pair could either be provided by a trusted certificate authority or self-signed using the commands below:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout reverseProxy.key -out reverseProxy.crt

Note that to the question Common Name (e.g. server FQDN or YOUR name), you must write the host that you expect to use for the reverse proxy.

The key pair should be specified using the key_file and crt_file parameters in the Verifier configuration. Also, because the key pair is self-signed, the certificate must be trusted by the forward proxy. This can be done by trusting the certificate system-wide or by specifying it using the trusted_certificates list parameter in the Signer configuration.

Build Linux Binary

docker build -t jwtproxy .
docker run -it --rm -v "$PWD/bin":/go/bin -w /go --entrypoint /bin/bash jwtproxy -c "go install -v github.com/quay/jwtproxy/cmd/jwtproxy"

jwtproxy's People

Contributors

alexgelman avatar denderello avatar ecordell avatar ericchiang avatar harishsurf avatar josephschorr avatar jzelinskie avatar mikelduke avatar philhug avatar quentin-m avatar zapient 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jwtproxy's Issues

provide trivial example

Having a really trivial example makes it easy for people to dive into the project. I get what this thing does from a high level but it is unclear how I can configure and start using it.

An example way of doing this is etcd's Procfile that lets you spin up a 3 members cluster and a proxy with one command and poke around at it: https://github.com/coreos/etcd/blob/master/Procfile

Help configuring jwtproxy

I have a REST API authentication which has endpoints for user authentication with JWT and to verify tokens (https://github.com/GetBlimp/django-rest-framework-jwt).

I also want for (client side) users to be able to transparently authenticate against another web service with the same JWT (couchdb):

browser <- webtoken -> REST API (creates and signs webtokens)
browser	-- webtoken -> second web service

Would i be able to implement this with jwtproxy, probably with a preshared key between the web services ?

I've read the documentation and examples, but i'm a bit lost on how to configure jwtproxy for this setup, and if i would also be possible to transparently utilise the REST API JWT verifier endpoints to verify jwtproxy incoming JWTs, so that a preshared key wouldnt be required. Could i get a nudge in the right direction ?

jti replay protection should be optional

When using jwtproxy as a generic oauth2-proxy which verifies access tokens, a client will reuse the same access token it received from the IdP as long as it remains valid.

I can prepare a PR if this sounds reasonable to you.

Write tests

At least, we need to test corner cases for jwt sign/verify.

Double close of channel if the proxy server can't start up

WARN[0000] Key registry is not configured to use a cache. This could introduce undesired latency during signature verification.
WARN[0000] No CA keypair specified, the proxy will not be able to forward requests to TLS endpoints.
INFO[0000] Starting reverse proxy (Listening on ':8081')
INFO[0000] Starting forward proxy (Listening on ':8080')
ERRO[0000] Failed to start reverse proxy: listen tcp :8081: bind: address already in use
INFO[0000] Received stop signal. Stopping gracefully...
ERRO[0000] Failed to start forward proxy: listen tcp :8080: bind: address already in use
panic: close of closed channel

goroutine 23 [running]:
panic(0x3aad00, 0xc82000e250)
    /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
main.startProxy.func1(0x4ecaa8, 0x7, 0xc82010a6a8, 0x5, 0xc8201155a0, 0x0, 0x0, 0x0, 0x0, 0xdf8475800, ...)
    /Users/jake/Projects/coreos/jwtproxy/src/github.com/coreos/jwtproxy/cmd/jwtproxy/main.go:137 +0x387
created by main.startProxy
    /Users/jake/Projects/coreos/jwtproxy/src/github.com/coreos/jwtproxy/cmd/jwtproxy/main.go:139 +0xb8
exit status 2

Support for HMAC single-key signing

This may already be supported and I'm just missing it, but can the reverse proxy currently be used to just verify signatures on unencrypted JWTs? I'd like to use this project with a private-key only HMAC+SHA256 JWT system, but it seems that the project may only work with public-key-encrypted tokens.

Feature: Verify JWT by JWK discovered by well known OpenId Connect Discovery endpoint

We maintain an identity server (IdentityServerr4 for .NET) which provides an well known endpoint to discover all other endpoints.
Among other things there is an URL for the currently used JWKs (jwks_uri).

Example:

{
   "issuer":"http://id.company.com",
   "jwks_uri":"http://id.company.com/.well-known/openid-configuration/jwks",
   "authorization_endpoint":"http://id.company.com/connect/authorize",
   "token_endpoint":"http://id.company.com/connect/token",
   "userinfo_endpoint":"http://id.company.com/connect/userinfo",
   "end_session_endpoint":"http://id.company.com/connect/endsession",
   "check_session_iframe":"http://id.company.com/connect/checksession",
   "revocation_endpoint":"http://id.company.com/connect/revocation",
   "introspection_endpoint":"http://id.company.com/connect/introspect",
   "device_authorization_endpoint":"http://id.company.com/connect/deviceauthorization",
   "frontchannel_logout_supported":true,
   "frontchannel_logout_session_supported":true,
   "backchannel_logout_supported":true,
   "backchannel_logout_session_supported":true,
   "scopes_supported":[
      "openid",
      "profile",
      "tenant",
      "roles",
      "offline_access"
   ],
   "claims_supported":[
      "sub",
      "tenant_id",
      "email",
      "name",
      "family_name",
      "given_name",
      "preferred_username",
      "locale",
      "tenant_name",
      "role"
   ],
   "grant_types_supported":[
      "authorization_code",
      "client_credentials",
      "refresh_token",
      "implicit",
      "password",
      "urn:ietf:params:oauth:grant-type:device_code"
   ],
   "response_types_supported":[
      "code",
      "token",
      "id_token",
      "id_token token",
      "code id_token",
      "code token",
      "code id_token token"
   ],
   "response_modes_supported":[
      "form_post",
      "query",
      "fragment"
   ],
   "token_endpoint_auth_methods_supported":[
      "client_secret_basic",
      "client_secret_post"
   ],
   "id_token_signing_alg_values_supported":[
      "RS256"
   ],
   "subject_types_supported":[
      "public"
   ],
   "code_challenge_methods_supported":[
      "plain",
      "S256"
   ],
   "request_parameter_supported":true
}

Example response of jwks_uri:

{
  "keys" : [ {
    "kty" : "RSA",
    "kid" : "1438289820780",
    "use" : "sig",
    "alg" : "RS256",
    "n" : "idWPro_QiAFOdMsJD163lcDIPogOwXogRo3Pct2MMyeE2GAGqV20Sc8QUbuLDfPl-7Hi9IfFOz--JY6QL5l92eV-GJXkTmidUEooZxIZSp3ghRxLCqlyHeF5LuuM5LPRFDeF4YWFQT_D2eNo_w95g6qYSeOwOwGIfaHa2RMPcQAiM6LX4ot-Z7Po9z0_3ztFa02m3xejEFr2rLRqhFl3FZJaNnwTUk6an6XYsunxMk3Ya3lRaKJReeXeFtfTpShgtPiAl7lIfLJH9h26h2OAlww531DpxHSm1gKXn6bjB0NTC55vJKft4wXoc_0xKZhnWmjQE8d9xE8e1Z3Ll1LYbw",
    "e" : "AQAB"
  }, {
    "kty" : "RSA",
    "kid" : "1438289856256",
    "use" : "sig",
    "alg" : "RS256",
    "n" : "zo5cKcbFECeiH8eGx2D-DsFSpjSKbTVlXD6uL5JAy9rYIv7eYEP6vrKeX-x1z70yEdvgk9xbf9alc8siDfAz3rLCknqlqL7XGVAQL0ZP63UceDmD60LHOzMrx4eR6p49B3rxFfjvX2SWSV3-1H6XNyLk_ALbG6bGCFGuWBQzPJB4LMKCrOFq-6jtRKOKWBXYgkYkaYs5dG-3e2ULbq-y2RdgxYh464y_-MuxDQfvUgP787XKfcXP_XjJZvyuOEANjVyJYZSOyhHUlSGJapQ8ztHdF-swsnf7YkePJ2eR9fynWV2ZoMaXOdidgZtGTa4R1Z4BgH2C0hKJiqRy9fB7Gw",
    "e" : "AQAB"
  } ]
}

It would be great if this proxy supports this well known endpoint to validate JWTs.

Configurable error message

I think it makes sense to have the error message on verification failure be configurable.

Right now it returns a 403 with jwtproxy: unable to verify request: No JWT found (text/plain). You could always transform the 403 to whatever error response, but then you'd have to inspect the response body to see if it came from jwt or if it came from an upstream service or another proxy

Crypto Go :we are a research group to help developers build secure applications.

Hi, we are a research group to help developers build secure applications. We designed a cryptographic misuse detector (i.e., CryptoGo) on Go language. We found your great public repository from Github, and several security issues detected by CryptoGo are shown in the following.
Note that the cryptographic algorithms are categorized with two aspects: security strength and security vulnerability based on NIST Special Publication 800-57 and other public publications. Moreover, CryptoGo defined certain rules derived from the APIs of Go cryptographic library and other popular cryptographic misuse detectors. The specific security issues we found are as follows:
(1) Location: jwt/keyserver/keyregistry/keyregistry.go:71;
Broken rule: HTTP is insecure;
(2) Location: proxy/proxy.go:224;
Broken rule: SSL/TLS use insecure verification;
We wish the above security issues could truly help you to build a secure application. If you have any concern or suggestion, please feel free to contact us, we are looking forward to your reply. Thanks.

Switch public key lookaside cache to real http client cache

This will let the keyserver specify the expiration policy, giving us nice properties such as: "cache this key until it would be expiring anyway", and end up with perfect caching. The downside is of course key invalidation becomes much tricker, unless we set a max expiration policy on the key server to: min(actual expiration, max_expiration_default_5m) or something

Reverse proxy unix socket support

We need support for UNIX sockets in two places:

  • Listen for incoming requests on a unix socket
  • Send requests to the backend which is itself listening on a UNIX socket

This will simplify securing the actual traffic on the box and reducing the performance impact of the proxy.

Log failed requests

Should probably log failed incoming (reverse proxy) requests at a level above debug

Write JWK format when caching keys to disk

Right now the format saved to disk is a json serialization of the format in go-oidc:

{
    "KeyID": "rqcOAUsTdSjsXuDMGb7EBsfwHuyckNVDXllG2h5SsPI2d4OPaezdIw21t0krXyktji9K7GnlT3zkqnfquoi1T1PnWJA-V04LDsGEwxmxe5bFV-MnPOSLvZqdMYZ_A1KOxjsNf21OmwC2UR8eExQdu6eQ1KdMw9o6KZn7Y36wXYY_2uPOQlb9z191MDilIhF4-fVBJmt63xKkbKGaXZh7tsIBbdtVL7O-cSML11ZgJ_y-qjBua4xOfDYUeSB9wYzCKdar4t0vUwp7439bOSzIlHooV1Mx-i4n5F8joFiZVn-awvYJkbeCP1G5EvY1L9ALKmY89TwMOAy4kKN3x_lL1w==",
    "PrivateKey": {
        "N": 22047842810491776016612944468137650229686216356599353818821799229385947435439847242795550380546040597323289481867310895462305938400898158780724726178959081806763945043395601372556813085493055824384441400106858381413786815383586977276963584464367443401750946200535045120379235732880512741295217567021028248620306485868841721873955907416643538260687280999603573921142541450347167944873486944785391906532662323862197635444226105029751206447154862729409065614431728166741774662881551845255492294176836741435699811263410932353264933697003845601532214244874343994128601624679371652710056676956691306823886892964469028768727,
        "E": 65537,
        "D": 9001543099017783097738873539129943500552574744854493036455969635178293109694737212192815379591229507950917140948222189448478264091930238407248600002600182368792939523111160198445193520126610841098226933528529070776640581949412343424320836008866437021844913064188415738986941887860046682314358857451235986516404186285644569118139794214872671510588835601889942943160721368087342274621137943058016486307046155861632238950456485463416332967039612629205484061150272324573906897292427764382644198905620834110549066116127221199524469204664109714184231016760456726778106397490413216329499979035504262771828695183514253887673,
        "Primes": [140093153411592146053428913269248262016650992781486765847787795243197897148607607131732213802660221387750412805895944737374298987702642263543428720438864900182610267953550923096701405342243181647788561993456420130856553102817490110234434052333728298465619799407365435334536923257528032869900574289845207598451, 157379873845193961728105686537190443807957852206054316563797408127846018429909147640084685699883482423477680309367022129805759211858129466118288203347222972968696990964408651188751166007756746800541434042065373090471499095286188868040615781529289593975320317168361901548392642062961798852990796148108380088077],
        "Precomputed": {
            "Dp": 32880859450037542008237233073036250764302997863265474957210001471395853547459941909155208702145650935904555438611645665048620886351862967450829616518769853588185469912591670340013443047047997621286962488111244860961525547820904723677099418542157997573861540114501657480748996041126328663271291541059233460173,
            "Dq": 24049917398715496997222613953491345266592884780255946723018005743326332828410517930565148348022232883274012669153466387384297091822316654762571621473708562709332138555450396595134701429233620995886635975575395753560157825950092032186806949540196153068691471633445907563775459820567960320318336564433914072693,
            "Qinv": 133838487953338150539275990130645595567220486963492738755532246498759041379006605727543786481473501187477897613536690463358747926723198821787331116511600976674415523421228358575940783536049507275898211503526060885138239359064641125372485172727594985489510272638219349123020538092925258675789646090001273864160,
            "CRTValues": []
        }
    }
}

We should instead save/load from JWK:

{
  "kty": "RSA",
  "n": "AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR",
  "e": "AQAB",
  "d": "C0G3QGI6OQ6tvbCNYGCqq043YI_8MiBl7C5dqbGZmx1ewdJBhMNJPStuckhskURaDwk4-8VBW9SlvcfSJJrnZhgFMjOYSSsBtPGBIMIdM5eSKbenCCjO8Tg0BUh_xa3CHST1W4RQ5rFXadZ9AeNtaGcWj2acmXNO3DVETXAX3x0",
  "p": "APXcusFMQNHjh6KVD_hOUIw87lvK13WkDEeeuqAydai9Ig9JKEAAfV94W6Aftka7tGgE7ulg1vo3eJoLWJ1zvKM",
  "q": "AOjX3OnPJnk0ZFUQBwhduCweRi37I6DAdLTnhDvcPTrrNWuKPg9uGwHjzFCJgKd8KBaDQ0X1rZTZLTqi3peT43s",
  "dp": "AN9kBoA5o6_Rl9zeqdsIdWFmv4DB5lEqlEnC7HlAP-3oo3jWFO9KQqArQL1V8w2D4aCd0uJULiC9pCP7aTHvBhc",
  "dq": "ANtbSY6njfpPploQsF9sU26U0s7MsuLljM1E8uml8bVJE1mNsiu9MgpUvg39jEu9BtM2tDD7Y51AAIEmIQex1nM",
  "qi": "XLE5O360x-MhsdFXx8Vwz4304-MJg-oGSJXCK_ZWYOB_FGXFRTfebxCsSYi0YwJo-oNu96bvZCuMplzRI1liZw"
}

Fail the whole proxy process if one of the configured proxies can't bind

Right now it starts with one half broken.

WARN[0000] Key registry is not configured to use a cache. This could introduce undesired latency during signature verification.
WARN[0000] No CA keypair specified, the proxy will not be able to forward requests to TLS endpoints.
INFO[0000] Starting reverse proxy (Listening on ':9081')
INFO[0000] Starting forward proxy (Listening on ':9080')
ERRO[0000] Failed to start forward proxy: listen tcp :9080: bind: address already in use
INFO[0000] Received stop signal. Stopping gracefully...
DEBU[0000] Adding rotation policy: 12h0m0s
DEBU[0000] Adding expiration time: 2016-04-06 10:42:45.90423738 -0400 EDT
DEBU[0000] Adding rotation time: 12h0m0s
DEBU[0000] Monitoring publish status                     keyID=8sS8C7usox signingKeyID=8sS8C7usox
DEBU[0001] Key not yet approved, waiting                 keyID=8sS8C7usox signingKeyID=8sS8C7usox
DEBU[0002] Key not yet approved, waiting                 keyID=8sS8C7usox signingKeyID=8sS8C7usox
DEBU[0003] Key not yet approved, waiting                 keyID=8sS8C7usox signingKeyID=8sS8C7usox
DEBU[0004] Key not yet approved, waiting                 keyID=8sS8C7usox signingKeyID=8sS8C7usox
DEBU[0005] Successfully published key                    activeKey=8sS8C7usox pendingKey=<nil>

Passthrough mode if verifier not configured?

If the user disables the verifier, do we still bind to the port, do SSL termination, and pass through requests unverified? Or do we not bind to the port and require the upstream app to compensate?

Clean up socket on shutdown

Right now if jwtproxy shuts itself down (because it can't publish a key, for example), it leaves the socket it was listening on behind, which causes an error when it restarts later. (Right now I'm manually cleaning it up in the init file)

Also I noticed that we're calling close on the file descriptor rather then on the "socket" object (which does a tiny bit of additional cleanup)

rename this repo

In preparation for an open source release we can rename this repo to github.com/coreos/jwtproxy and keep it private.

A fixed 1s poll period on key publication may be too aggressive

Starting up a large number of instances that autopublish may overwhelm the key server. We may want to make it configurable. Exponential backoff seems like a really bad fit here though, since you want the response to an approval to be relatively immediate.

Error - "Failed to create JWT signer: no private key provider specified"

Hello Team,

I have quay running with clair-jwt proxy as well for security scanning engine.

However when i started the container for clair-jwt:v2.01 i got an error as below.

level=error msg="Failed to create JWT signer: no private key provider specified"

Can someone help me what could be this issue? and why this issue occurs.

Thanks and Regards,
Arjun.M

Race condition when loading private key from file

If there's a private key stored on disk, jwtproxy finds it and loads it. In order for the private key to be "verified" it must pull the public key - but if the the keyserver doesn't respond, that verification fails and a new key is autogenerated instead.

This means that it's a gamble on startup as to whether you'll end up with the pre-approved boot-generated key or an unapproved autogenerated key, depending on where in the process the keyserver becomes reachable. (after stored key verification fails but before new key publishing occurs - this actually happened on the majority of test starts I did)

I think a good solution would be to simply fail the load process (kill jwtproxy) if the stored private key can't be verified (or at the very least; if it can't be verified because the public key is unreachable).

rotation_policy claim

By providing the rotation policy claim, we'll be able to know frequently the proxy plans to rotate its keys on the Key Server side.

docker build fails missing "sirupsen/logrus"

$ docker build -t jwtproxy .
Sending build context to Docker daemon  10.9 MB
Step 1/10 : FROM golang:1.7-alpine
Trying to pull repository docker.io/library/golang ... 
1.7-alpine: Pulling from docker.io/library/golang
...snip...
Step 9/10 : RUN go install -v github.com/coreos/jwtproxy/cmd/jwtproxy
 ---> Running in 23858c504131

proxy/proxy.go:31:2: cannot find package "github.com/sirupsen/logrus" in any of:
	/go/src/github.com/coreos/jwtproxy/vendor/github.com/sirupsen/logrus (vendor tree)
	/usr/local/go/src/github.com/sirupsen/logrus (from $GOROOT)
	/go/src/github.com/sirupsen/logrus (from $GOPATH)
The command '/bin/sh -c go install -v github.com/coreos/jwtproxy/cmd/jwtproxy' returned a non-zero code: 1

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.