Commit graph

77 commits

Author SHA1 Message Date
Russell Jones a62102c3e8 Add ability to detect when a proxy has been removed forever to discovery
protocol.
2018-06-21 23:14:52 +00:00
Sasha Klizhentas 03069a2aad Kubernetes proxy integration tests.
This PR contains Kubernetes proxy
integration tests and associated internal changes.
2018-06-14 16:47:52 -07:00
Sasha Klizhentas 074961892a Precompute keys only for auth and proxies.
This commit fixes #1886

Previously the code was precomputing keys
even for SSH nodes, that do not need precomputed
private keys pool.
2018-05-04 13:41:13 -07:00
Sasha Klizhentas 3e144cb900 Teleport certificate authority rotation.
This commit implements #1860

During the the rotation procedure issuing TLS and SSH
certificate authorities are re-generated and all internal
components of the cluster re-register to get new
credentials.

The rotation procedure is based on a distributed
state machine algorithm - certificate authorities have
explicit rotation state and all parts of the cluster sync
local state machines by following transitions between phases.

Operator can launch CA rotation in auto or manual modes.

In manual mode operator moves cluster bewtween rotation states
and watches the states of the components to sync.

In auto mode state transitions are happening automatically
on a specified schedule.

The design documentation is embedded in the code:

lib/auth/rotate.go
2018-04-30 12:58:57 -07:00
Russell Jones 6be8af16c5 Removed depreciated code and re-factored tests to use
golang.org/x/crypto.
2018-04-05 23:14:20 +00:00
Russell Jones 9454d0133a Create context once either "session" or "direct-tcpip" channel has been
opened in the forwarding server.
2018-04-02 15:04:48 -07:00
Sasha Klizhentas bad1b0498d External events and sessions storage.
Updates #1755

Design
------

This commit adds support for pluggable events and
sessions recordings and adds several plugins.

In case if external sessions recording storage
is used, nodes or proxies depending on configuration
store the session recordings locally and
then upload the recordings in the background.

Non-print session events are always sent to the
remote auth server as usual.

In case if remote events storage is used, auth
servers download recordings from it during playbacks.

DynamoDB event backend
----------------------

Transient DynamoDB backend is added for events
storage. Events are stored with default TTL of 1 year.

External lambda functions should be used
to forward events from DynamoDB.

Parameter audit_table_name in storage section
turns on dynamodb backend.

The table will be auto created.

S3 sessions backend
-------------------

If audit_sessions_uri is specified to s3://bucket-name
node or proxy depending on recording mode
will start uploading the recorded sessions
to the bucket.

If the bucket does not exist, teleport will
attempt to create a bucket with versioning and encryption
turned on by default.

Teleport will turn on bucket-side encryption for the tarballs
using aws:kms key.

File sessions backend
---------------------

If audit_sessions_uri is specified to file:///folder
teleport will start writing tarballs to this folder instead
of sending records to the file server.

This is helpful for plugin writers who can use fuse or NFS
mounted storage to handle the data.

Working dynamic configuration.
2018-03-15 12:42:43 -07: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
Russell Jones cefe4ff7f1 Increased delay when in TestTwoClusters and some more debugging logs in
integration tests.
2018-02-13 12:36:52 -08:00
Russell Jones 9a3aa9999c Wait for *Ready events for all Start* functions for TeleInstance.
Increase delay to 250 millisecond between runCommands.
2018-02-12 17:26:44 -08:00
Russell Jones 1af26fe9c1 Wrap connection used in HTTP CONNECT proxy to first read any buffered
data then ready from the underlying connection.
2018-02-09 21:33:08 +00:00
Russell Jones f2b8bbd1c1 Added *Ready events that indicate a service has started. Wait on these
events in integration events before starting a test.
2018-02-06 16:52:46 -08:00
Sasha Klizhentas bb9b00e451 Cache recently accessed items.
Introduce cache for items that were accessed
by proxies and nodes within 2 second window to reduce
load on database under high load.
2018-01-31 16:35:18 -08:00
Russell Jones b3d4d36fde Added cert_format to role as well as tsh to control how a certificate is
generated.
2018-01-09 14:57:35 -08:00
Sasha Klizhentas ef473d809e Join address for web, reverse tunnel, fixes #1544
Support configuration for web and reverse tunnel
proxies to listen on the same port.

* Default config are not changed for backwards compatibility.
* If administrator configures web and reverse tunnel
addresses to be on the same port, multiplexing is turned on
* In trusted clusters configuration reverse_tunnel_addr
defaults to web_addr.
2018-01-05 16:20:56 -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
Russell Jones 3bfe61dc0b Added integration tests and minor fixes. 2017-12-19 17:40:05 -08:00
Russell Jones 37ab1596c4 Updated reverse tunnel to allow use to forwarding server. 2017-12-09 19:29:20 +00:00
Russell Jones 7018852c5d Added forwarding SSH server. 2017-12-04 17:01:52 -08:00
Russell Jones 4765e32473 Updated ClusterConfig to V3. 2017-10-26 12:34:51 -07:00
Russell Jones 432a7ad787 Added services.ClusterConfig resource which controls where (and if) a
session is recorded.
2017-10-25 21:09:21 +00:00
Sasha Klizhentas e461b4e6bd fix tests 2017-10-12 16:51:18 -07:00
Sasha Klizhentas 0290cccb57 integration tests for proxies 2017-10-12 10:35:46 -07:00
Ev Kontsevoy 93f7dd3bf9 Better handling of "development mode"
Instead of quietly changing behavior because `DEBUG` envar was set to
true, Teleport now explicitly requires scary --insecure flag to enable
this behavior.
2017-09-10 13:45:14 -07:00
Russell Jones c543067001 Removed namespaces and expires from user interface. 2017-08-30 18:11:13 +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
Russell Jones b4c805fe23 Re-factored cluster configuration. 2017-08-07 17:20:16 -07:00
Russell Jones 6299d349c1 Introduced and migrated to RoleV3. 2017-07-18 11:20:48 -07:00
Russell Jones 7e17b6f9a7 Added --compat=oldssh flag to generate user certificates without roles. 2017-06-20 16:57:56 -07:00
Russell Jones 5f670ef7d9 Moved tests from lib/srv and lib/utils into integrations. 2017-06-01 17:35:09 -07:00
Sasha Klizhentas 8ecfe3acc1 fix and complete tests 2017-05-20 12:52:03 -07:00
Sasha Klizhentas bf211f5764 integration test 2017-05-19 19:03:28 -07:00
Sasha Klizhentas 123a158f2e fix tests 2017-05-19 10:06:48 -07:00
Sasha Klizhentas 3c2570fa35 Sasha High Availability. 2017-04-07 16:54:15 -07:00
Russell Jones fde0ae4178 Added TTL to UpsertRole. Dynamic roles for OIDC users now have TTL. 2017-04-04 17:06:28 -07:00
Sasha Klizhentas 80350d067b fix integration test 2017-03-21 15:16:11 -07:00
Russell Jones 54c7f1cd32 Added dynamic_config and removed seed_config. 2017-03-01 16:44:34 -08:00
Russell Jones 6295213815 Host certificate now presents two principals: hostUUID.clusterName and nodeName.clusterName. 2017-02-08 18:34:29 -08:00
Ev Kontsevoy bd80127fac Fixed tests 2017-01-28 18:06:12 -08:00
Ev Kontsevoy ac205ad530 Finished cleaning up storage back-ends
I hope this closes #688
2017-01-15 23:23:37 -08:00
Ev Kontsevoy 7040331660 Fixed all tests
Also replaced mailgun.FrozenTime with `clockwork` in a few places
(mailgun's frozen time still remains elsewhere)
2017-01-15 16:28:18 -08:00
Sasha Klizhentas 5eedbea1ad fix integration tests 2016-12-30 14:47:52 -08:00
Sasha Klizhentas 5abf6d44d5 continue fixing tests and code 2016-12-18 16:58:53 -08:00
Ev Kontsevoy 7964bfc54e Client profiles for TSH 2016-10-22 12:54:16 -07:00
Ev Kontsevoy 155c53965e Small changes to the "integration" package
This is to support Teleconsole/Telecast features, namely:

- When a user is added programmatically, it's actually returned.
- When a server is being created, it will not create users if
  they exist already, instead it will just sign their public keys
2016-09-11 19:33:52 -07:00
Ev Kontsevoy c7b4934553 Implemented a new Teleport option: "no recording"
Teleport configuration now has a new field: NoAudit (false by default,
which means audit is always on).

When this option is set, Teleport will not record events and will not
record sessions.

It's implemented by adding "DiscardLogger" which implements the same
interface as teh real logger, and it's plugged into the system instead.

NOTE: this option is not exposed in teleport in any way: no config file,
no switch, etc. I quickly needed it for Telecast.
2016-09-05 22:12:57 -07:00
Ev Kontsevoy 2659e4e350 Fixed severe timer leak
Without this leak Teleport CPU utilization is very slowly increasing
over time.
2016-08-28 17:31:57 -07:00
Ev Kontsevoy 853ce11b74 Minor changes
- Improved integration testing
- Added more logging around weird tunnel connectivity issue
2016-08-28 14:01:57 -07:00
Ev Kontsevoy 2646002a51 Improvement to help aid debugging
- Added more trace.Wrap() calls
- Added callback to control shell creation/destruction
2016-08-21 21:49:24 -07:00
Ev Kontsevoy 2f60436d5f Minor bug with integration tests 2016-08-17 17:06:59 -07:00