|
| 1 | +# Radshift |
| 2 | +A custom authentication proxy for [AWS Redshift](https://aws.amazon.com/redshift/). Radshift accepts Postgres connections, authenticates users using [LinOTP](https://www.linotp.org/), then proxies through to Redshift. Appropriate Redshift database users are created/updated automatically on-demand. |
| 3 | + |
| 4 | +It uses [femebe](https://github.com/uhoh-itsmaciek/femebe) to do the heavy lifting of the Postgres protocol. |
| 5 | + |
| 6 | +## Motivation |
| 7 | +At the time we developed Radshift, AWS Redshift only supported username/password authentication (no certificate or LDAP-based authentication). We wanted to hook into other internal auth systems, so Radshift was born as a temporary solution. There is nothing Redshift-specific about the project except our initial use case. |
| 8 | + |
| 9 | +## Caveats |
| 10 | +This code should not be considered production-ready, but may be useful as an example for how to implement similar forms of Postgres proxy functionality. It is meant primarily for human users and has some race conditions if a single user creates multiple concurrent connections in quick succession. |
| 11 | + |
| 12 | +You may want to look at [PgBouncer](https://pgbouncer.github.io/) for a more production-ready proxy. |
| 13 | + |
| 14 | +## How it works |
| 15 | + |
| 16 | + |
| 17 | +## Building |
| 18 | +Building from source requires a working Go environment, but no other special tricks. Vendored dependencies are managed with [dep](https://github.com/golang/dep). |
| 19 | + |
| 20 | +``` |
| 21 | +go get -u github.com/SimpleFinance/radshift/... |
| 22 | +``` |
| 23 | + |
| 24 | +## Usage |
| 25 | +``` |
| 26 | +usage: radshift --ssl-cert=<path/to/ssl.crt> --ssl-key=<path/to/ssl.key> --redshift=<[...].redshift.amazonaws.com:5439> --redshift-ca-bundle=<path/to/redshift-ssl-ca-cert.pem> --redshift-user=<user> --redshift-password=<password> --linotp=<https://linotp/auth> --linotp-ca-bundle=<path/to/ca_bundle.pem> [<flags>] |
| 27 | +
|
| 28 | +An authenticating proxy for Redshift. |
| 29 | +
|
| 30 | +Flags: |
| 31 | + --help Show context-sensitive help (also try |
| 32 | + --help-long and --help-man). |
| 33 | + -v, --verbose enable verbose output. |
| 34 | + --insecure Disable authentication and weaken/disable SSL |
| 35 | + (dangerous!). |
| 36 | + --listen=127.0.0.1:5432 Interface/port on which to listen. |
| 37 | + --ssl-cert=<path/to/ssl.crt> |
| 38 | + Path to SSL certificate in PEM format (default: |
| 39 | + $SSL_CRT_PATH). |
| 40 | + --ssl-key=<path/to/ssl.key> |
| 41 | + Path to SSL private key in PEM format (default: |
| 42 | + $SSL_KEY_PATH). |
| 43 | + --redshift=<[...].redshift.amazonaws.com:5439> |
| 44 | + Hostname/IP and port of backend Redshift |
| 45 | + cluster. |
| 46 | + --redshift-ca-bundle=<path/to/redshift-ssl-ca-cert.pem> |
| 47 | + Path to Redshift Certificate Authority bundle |
| 48 | + in PEM format (see |
| 49 | + https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-ssl-support.html). |
| 50 | + --redshift-user=<user> Username for the radshift superuser on the |
| 51 | + backend Redshift cluster (default |
| 52 | + $REDSHIFT_USER). |
| 53 | + --redshift-password=<password> |
| 54 | + Password for the radshift superuser on the |
| 55 | + backend Redshift cluster (default: |
| 56 | + $REDSHIFT_PASSWORD). |
| 57 | + --user=<username> ... Allow <username> to connect (after |
| 58 | + authenticating to LinOTP). |
| 59 | + --superuser=<username> ... |
| 60 | + Treat <username> as a superuser on the backend. |
| 61 | + --linotp=<https://linotp/auth> |
| 62 | + URL of LinOTP endpoint for verifying user OTPs |
| 63 | + --linotp-realm="radshift" LinOTP realm for verifying user OTPs |
| 64 | + --linotp-ca-bundle=<path/to/ca_bundle.pem> |
| 65 | + Path to CA bundle for LinOTP in PEM format |
| 66 | + (default: $SSL_CA_BUNDLE_PATH). |
| 67 | + --version Show application version. |
| 68 | +``` |
0 commit comments