Commit graph

69 commits

Author SHA1 Message Date
Russell Jones b139f72cab Create single instance of keygen per process. Use cache of precomputed
certificates when using recording proxy.
2018-02-15 21:23:30 +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
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
Sasha Klizhentas 8eaa342dff Add limits to SearchEvents, fixes #1632
SearchEvents and SearchSessionEvents set
default limits of fetched events of 500 up to 10K events
per interval.

No UI changes are required, as users will be able
to refine the search interval to fetch more sessions.
2018-02-02 08:52:24 -08:00
Russell Jones 6a814e8a85 Use a discard session server and audit logger when the proxy is in
recording mode and on a Teleport node.
2018-01-16 01:38:24 +00:00
Sasha Klizhentas b82336ae06 Use gzip for session recordings, fixes #1579
* Session recordings are created with gzip compression.
* Migration compresses old recordings and converts to new format.
2018-01-15 13:34:01 -08:00
dhilipkumars cc7b5ead00 Actually test a & b 2018-01-13 18:51:08 +05:30
Russell Jones 1c65651658 In-memory forwarding servers now have a random server_id. 2018-01-12 19:33:23 +00:00
Sasha Klizhentas ef20e45208 Enforce trusted cluster resource name, fixes #1543
This commit makes sure that trusted cluster resource
name is the same name as the cluster name it conects to.

If user supplies name of the trusted cluster resource
that is different from the cluster name, the warning
will be issued and trusted cluster will be renamed.

Upgrade procedure renames existing trusted clusters
in place.

If user supplies trusted cluster without role
mappings, or with role mappings referring to
non-existent roles that do not exist, the
error will be returned.
2018-01-11 14:13:30 -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 71c15e5835 Add support for NFS-friendly log protocol.
* Session events are delivered in continuous
batches in a guaranteed order with every event
and print event ordered from session start.

* Each auth server writes to a separate folder
on disk to make sure that no two processes write
to the same file at a time.

* When retrieving sessions, auth servers fetch
and merge results recorded by each auth server.

* Migrations and compatibility modes are in place
for older clients not aware of the new format,
but compatibility mode is not NFS friendly.

* On disk migrations are launched automatically
during auth server upgrades.
2018-01-04 18:54:37 -08:00
Sasha Klizhentas e114fbd46c Add support for remote_cluster, implements #1526
This commit adds remote cluster resource that specifies
connection and trust of the remote trusted cluster to the local
cluster. Deleting remote cluster resource deletes trust
established between clusters on the local cluster side
and terminates all reverse tunnel connections.

Migrations make sure that remote cluster resources exist
after upgrade of the auth server.
2017-12-28 17:48:30 -08:00
Russell Jones 61b2873b33 Create single server context for forwarding server. 2017-12-27 13:12:48 -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 a2bcf68166 Emit session specific audit events, but not session specific stream
bytes.
2017-12-21 11:48:05 -08:00
Russell Jones 3bfe61dc0b Added integration tests and minor fixes. 2017-12-19 17:40:05 -08:00
mricher b58cb051e8
Correct various typos
This was fixed running the `misspell` linter in fix mode using
`gometalinter`. The exact command I ran was :
```
gometalinter --vendor --disable-all -E misspell --linter='misspell:misspell -w {path}:^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$' ./...
```

Some typo were fixed by hand on top of it.
2017-10-20 10:20:26 +02:00
Sasha Klizhentas 05d0c417d5 add regression test for mismatching cluster name
Modify integration test suite to catch cases
when trusted cluster resource name is not equal
to the cluster name
2017-10-19 00:36:32 +00:00
Sasha Klizhentas 7b87c73f6b fix cluster name fix 2017-10-19 00:36:32 +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
Sasha Klizhentas 9c31410a4d start working on integration testing 2017-10-11 16:36:25 -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
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 4719c4bdfa Allow enable or disable of a TrustedCluster without performing the
exchange again.
2017-08-18 20:14:42 +00:00
Russell Jones 6299d349c1 Introduced and migrated to RoleV3. 2017-07-18 11:20:48 -07:00
Russell Jones 2286c6593d Remote clusters should only send their own CAs. 2017-06-27 11:55:59 -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 3c2570fa35 Sasha High Availability. 2017-04-07 16:54:15 -07:00
Ev Kontsevoy 86bda472a8 Fixed tests 2017-02-23 17:10:43 -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 a8889271c6 Finished polish of tsh login
This commit:

* Improves on the previous commit on better name resolution by the proxy
  (and fixes a bug introduced by the previous commit)

* Removes 'host_login' from tsh client profile. Closes #729
2017-01-29 17:52:42 -08:00
Ev Kontsevoy bd80127fac Fixed tests 2017-01-28 18:06:12 -08:00
Ev Kontsevoy 4a07dd3e22 Improved CLI login procedure
This commit adds several improvements to how CLI SSH login works

- Validated keys are added to the SSH agent [1]
- tsh will does not verify host keys twice anymore
- error messages for "access denied" look clean now

[1] This is huge. This means that tsh login can "feed" the keys to the
    built-in SSH agents of the OS and OpenSSH can fetch them from there.

QUESTION: why do we even need `tsh agent` option then? ssh-agent is
installed on every Linux/OSX machine.
2017-01-24 19:54:41 -08:00
Sasha Klizhentas 5eedbea1ad fix integration tests 2016-12-30 14:47:52 -08:00
dmitri 53e059a11a Add context support to ProxyClient.ConnectToNode to be able to timeout the connection.
The method is otherwise blocking and might hang upon establishing a connection if the other side closes the connection.
2016-12-23 20:50:32 +01:00
Sasha Klizhentas dfd58dccb6 several fixes 2016-12-20 11:04:11 -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 a6127227f3 Proper handling of attached/detached terminals
Also Teleport now will try to get the type of terminal you're already
on, looking at $TERM
2016-09-10 21:59:16 -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 4a635ec949 Added "seed_config" configuration flag
Teleport YAML config now has a new configuration variable for internal
use by Gravitational:

```yaml
teleport:
   seed_config: true
```

If set to 'true', Teleport treats YAML configuration simply as a seed
configuration on first start.

If set to 'false' (default for OSS version), Teleport will throw away
its back-end config, treating YAML config as the only source of truth.

Specifically, for now, the following settings are thrown away if not
found in YAML:

- trusted authorities
- reverse tunnels
2016-06-17 11:55:22 -07:00
Sasha Klizhentas fba07c4f17 add support for passing env variables, fixes #451 2016-06-10 09:38:19 -07:00
Ev Kontsevoy dc87ef5aec Clean error reporting for SSH exec
- stdout and stderr are separated
- exit status is inherited by tsh
2016-05-24 18:00:26 -07:00
Ev Kontsevoy 64393d8d27 Fixed tests 2016-05-20 20:09:13 -07:00
Ev Kontsevoy ab278f0a06 TunClient changes
TunClient always tries to dial the statically configured auth server
first, before trying "discovered" ones.

The rationale is that --auth flag must override whatever dynamic auth
servers have been discovered (because sometimes their IPs are wrong, if
advertise-ip was misconfigured)

Closes #416
Fixes #416
2016-05-20 19:38:20 -07:00
Ev Kontsevoy 23b3565f3a Started work on self-reconnecting reverse tunnels 2016-05-11 13:17:13 -07:00