Commit Graph
37 Commits
Author SHA1 Message Date
Jakub Nyckowski 9379243390 Use pre-generated RSA keys in tests (#18750)
Many of our tests (db package, I'm looking at you) generate many RSA keys. This has two main side effects; makes our tests slow and flaky as CPU usage spikes in random moments when the tests are run in parallel.
This change pre-generates RSA keys at the beginning of each test module and reuse them in randomized order to reduce the situation that one key has been used multiple times in one test.
I had to move a few files to avoid circular dependencies.
2022-12-05 19:33:49 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Gabriel Corado a3a65e863b TLS routing ping for database protocols (#14887) 2022-08-26 16:42:23 +00:00
Zac Bergquist 663e3d04c5 Remove calls to depreated pool.Subjects() method
This deprecation was kind of a pain, because x509.CertPool becomes
a black box - there is no public API to determine how many certs
have been added to the pool. To account for this, some of our method
signatures needed to be updated to report the number of certs that
were added.
2022-04-14 09:25:41 -06:00
Zac Bergquist f6bb323103 Decrease validity period for self-signed HTTPS certs
As of Go 1.18, certificates are verified with the platform verifier
instead of via the Go verifier on macOS. The mac verifier enforces
a maximum validity period of 825 days. Our default of 10 years is too
long, resulting in an error:

    x509: certificate is not standards compliant
2022-04-14 09:25:41 -06:00
Zac Bergquist 5e93905792 Don't set deprecated PreferServerCipherSuites field 2022-04-14 09:25:41 -06:00
rosstimothy c730778960 Replace golint with revive (#8613) 2021-10-19 14:00:24 -04:00
Roman Tkachenko e1c3f80aa0 Fixes for cert checker and Postgres config builder (#8251) 2021-09-17 13:28:40 -07:00
inertial-frame 8922af0c61 docs: port of 6871 (#7091) 2021-06-04 14:16:05 -05:00
Sasha Klizhentas c0bb732545 Adds ACME - auto cert management
This commit fixes #5177

Initial implementation uses dir backend as a cache and is OK
for small clusters, but will be a problem for many proxies.

This implementation uses Go autocert that is quite limited
compared to Caddy's certmagic or lego.

Autocert has no OCSP stapling and no locking for cache for example.
However, it is much simpler and has no dependencies.
It will be easier to extend to use Teleport backend as a cert cache.

```yaml
proxy_service:
  public_addr: ['example.com']
  # ACME - automatic certificate management environment.
  #
  # It provisions certificates for domains and
  # valid subdomains in public_addr section.
  #
  # The sudomains are valid if there is a registered application.
  # For example, app.example.com will get a cert if app is a regsitered
  # application access app. The sudomain cookie.example.com is not.
  #
  # Teleport acme is using TLS-ALPN-01 challenge:
  #
  # https://letsencrypt.org/docs/challenge-types/#tls-alpn-01
  #
  acme:
    # By default acme is disabled.
    enabled: true
    # Use a custom URI, for example staging is
    #
    # https://acme-staging-v02.api.letsencrypt.org/directory
    #
    # Default is letsencrypt.org production URL:
    #
    # https://acme-v02.api.letsencrypt.org/directory
    uri: ''
    # Set email to receive alerts and other correspondence
    # from your certificate authority.
    email: 'alice@example.com'
```
2020-12-22 17:33:20 -08:00
Andrew Lytvynov b1eae4ac4c Remove unused functions and methods throughout lib/...
This code is not caught by linters because it's exported and they assume
there's some external users.
Since teleport is relatively self-contained, we can tell for sure
whether something is called or not.
2020-05-06 00:02:53 +00:00
Russell Jones 3e826e5c92 Update default ciphersuites.
Drop TLS_RSA_WITH_AES_128_GCM_SHA{256,384} from default ciphersuites
due to being banned by HTTP2 which breaks GRPC clients. For more
information see: https://tools.ietf.org/html/rfc7540#appendix-A.

This has a nice side effect of Teleport now only supporting ciphersuites
that support PFS.

Note that both ciphersuites can still be be added back in file
configuration.
2019-10-24 15:15:55 -07:00
Sasha Klizhentas ba1fcf5d77 Fix teleport parsing to support IPV6
This commit fixes #2124
2019-07-23 20:36:34 -07:00
Russell Jones ae074ede36 Always validate certificate (or key) algorithm.
Added utils.CertChecker that wraps a ssh.CertChecker. The new
certificate checker first checks if the certificate is a valid
certificate for Teleport. At the moment that is 2048-bit RSA then calls
the underlying certificate checker to perform the requested validation.
2019-03-19 17:47:53 -07:00
Russell Jones 6439f7f973 Support configurable cipher suites. 2018-07-23 10:29:28 -07:00
Russell Jones 5d5c3de588 Updated TLS ciphersuites and updated SSH ciphers, KEX, and MAC
algorithms in forwarding server.
2018-05-25 21:29:33 +00:00
Sasha Klizhentas 68b65f5b24 Teleport signal handling and live reload.
This commit introduces signal handling.
Parent teleport process is now capable of forking
the child process and passing listeners file descriptors
to the child.

Parent process then can gracefully shutdown
by tracking the amount of current connections and
closing listeners once the amount goes to 0.

Here are the signals handled:

* USR2 signal will cause the parent to fork
a child process and pass listener file descriptors to it.
Child process will close unused file descriptors
and will bind to the used ones.

At this moment two processes - the parent
and the forked child process will be serving requests.
After looking at the traffic and the log files,
administrator can either shut down the parent process
or the child process if the child process is not functioning
as expected.

* TERM, INT signals will trigger graceful process shutdown.
Auth, node and proxy processes will wait until the amount
of active connections goes down to 0 and will exit after that.

* KILL, QUIT signals will cause immediate non-graceful
shutdown.

* HUP signal combines USR2 and TERM signals in a convenient
way: parent process will fork a child process and
self-initate graceful shutdown. This is a more convenient
than USR2/TERM sequence, but less agile and robust
as if the connection to the parent process drops, but
the new process exits with error, administrators
can lock themselves out of the environment.

Additionally, boltdb backend has to be phased out,
as it does not support read/writes by two concurrent
processes. This had required refactoring of the dir
backend to use file locking to allow inter-process
collaboration on read/write operations.
2018-02-13 15:18:47 -08:00
Sasha Klizhentas 0130c6aa41 Mutual TLS Auth server and clients.
This commit introduced mutual TLS authentication
for auth server API server.

Auth server multiplexes HTTP over SSH - existing
protocol and HTTP over TLS - new protocol
on the same listening socket.

Nodes and users authenticate with 2.5.0 Teleport
using TLS mutual TLS except backwards-compatibility
cases.
2017-12-27 11:37:19 -08:00
sokoow 56f778a19d Fixes for https://github.com/gravitational/teleport/pull/1426 2017-11-01 21:03:20 +00:00
sokoow a737326042 Adding disable-tls flag, fixing https://github.com/gravitational/teleport/issues/1304 2017-11-01 21:03:20 +00:00
Sasha Klizhentas 8b81a0c384 Migrate to golang/dep for dependency management
Update following packages:

* Replace Sirupsen/log with sirupsen/log everywhere
* Update etcd client to 3.2.4
* Update docker/term to moby/term
* Update kr/pty to v1.0.0 release
* Update K8s client to 2.0
2017-08-22 15:30:30 -07:00
Ev Kontsevoy 0ae6270c05 Proxy HTTPS fixes
- Self-signed cert is now compatible with Golang HTTP client
- Fixes #296
- Changed the expiration date for self-signed cert
  from 1 to 10 years.
2016-06-01 14:38:27 -07:00
Ev Kontsevoy ed0948659b Changed how self-signed HTTPS cert is generated
Fixes #434

Changes:

- Certificate is not "CA" anymore
- Added "*" for CN field
2016-05-31 18:36:51 -07:00
klizhentas d68e693cad migrate to trace errors 2016-04-12 11:07:14 -07:00
Ev Kontsevoy 757c34a755 Added the ability to stop teleport without restarting the process 2016-04-03 12:17:28 -07:00
klizhentas 94dd0f7fd9 use custom certificate pool instead of insecure connections for localhost proxies 2016-03-23 18:08:17 -07:00
Ev Kontsevoy 72c61b7d0c Merge remote-tracking branch 'origin/master' into ev/auto-tls
Conflicts:
	lib/service/service.go
	lib/utils/tls.go
2016-03-07 20:25:09 -08:00
Ev Kontsevoy b440c74f67 Fixed browser hang on self-signed https cert
The problem was:

- Self-signed cert was also used as CA cert.
- This means a browser would add it to its list of CA certs.
- Then I'd delete /var/lib/teleport/*
- And a new CA would be created for the same name, confusing the browser

To fix:

- Certificate isn't marked as CA
- Org name is set to "Acme Co" instead of "Teleport"

Fixes #206
2016-03-07 18:44:34 -08:00
Ev Kontsevoy 804fcece35 Experimental commit for automatic https on localhost
The idea:

- When creating client's TLS configuration, supply self-signed server
  cert from /var/lib/teleport/.cert

This way if a user is connecting to a proxy running on localhost, he
doesn't need to specify --insecure flag.
2016-03-06 00:33:02 -08:00
Ev Kontsevoy fb7768bc53 Experiment... 2016-03-05 23:51:12 -08:00
Ev Kontsevoy 07d85fd477 Nodes can be reached out by any IP/hostname as long as its routable
Refs #183

Also fixed a bug introduced in the previous commit.
2016-03-04 21:21:12 -08:00
Ev Kontsevoy 6151ab208a Bugfix: --proxy=localhost did not work
`web.SSHAgentLogin(proxyAddr string)` expects proxyAddr string to be a
URL, while everywhere else we address servers by host:port pair.

Because of that, `--proxy=host` sytax was broken.
2016-03-04 20:14:41 -08:00
Ev Kontsevoy 2d66f99f48 Adding new host does not require a name 2016-03-04 18:13:00 -08:00
klizhentas 5e8ecd53b0 only support TLS in web proxy 2016-03-02 15:07:59 -08:00
Alex Lyulkov a56b5236ac Moved to go1.5 vendoring 2016-01-20 18:52:25 +03:00
klizhentas 00ef621e6b Apply apache license to teleport 2015-10-31 11:56:49 -07:00
klizhentas ebd770e0ce moving the code from telescope, so we can use telescope features like a library 2015-10-23 16:46:01 -07:00