Commit graph

419 commits

Author SHA1 Message Date
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 27ce2e1e1f Introduce version checking and fix YAML lists
Fixes #1663, #1665

This commit fixes a couple of issues with tsh and tctl:

* tsh now check the version of the server and prints error
if tsh is newer version than the server.

* tctl did not work properly when yaml file contained
multiple resources in a list
2018-02-06 17:50:37 -08:00
Sasha Klizhentas f84e9e0fe1 Add monitoring stack.
Demo monitoring stack sets up example monitoring
infrastructure:

* All nodes, auth servers and proxies
  run telegraf alongside them, polling prometheus
  diagnostic endpoints.

* Telegraf sends the data to InfluxDB database

* Grafana sets up cluster health dashboard
watching key teleport metrics - numbers of goroutines,
number of active sessions, file descriptors and so on.
2018-01-25 13:22:43 -08:00
Russell Jones 07e90d0ad6 LocalKeyAgent only loads keys for a user logged into a proxy. 2018-01-20 00:40:38 +00:00
Sasha Klizhentas 5d134b4b50 Add support for custom tokens.
fixes #1546, fixes #1535

This commit fixes error message in case if token
is generated for trusted cluster and allows
admins to provide custom tokens:

tctl nodes add --roles=node --token=custom --ttl=100h
2018-01-18 12:48:18 -08: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
Mattias Gees 9c4d1afba6 Move nodeport from int16 to int32
The highest port number can be 65535 but int16 only goes to 32767. That is why we need int32 to reach higher port numbers than 32767. In certain cases this can be handy when you want to run the node client on a random port.
2018-01-10 16:17:58 +01: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 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
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
Roman Tkachenko c0cf7df7c9 Github connector 2017-12-14 13:41:38 -08:00
Russell Jones a56b0870a7 Added the ability to generate host certificates to tctl. 2017-12-09 19:37:49 +00:00
Sasha Klizhentas 4b39fcf4d2 couple of UX tweaks 2017-11-29 11:28:24 -08:00
Sasha Klizhentas b1f502a0f3 add ttl support for invite tokens, fixes #1474 2017-11-28 19:39:12 -08:00
Roman Tkachenko 143b834e57 Changes for the upcoming teleport pro:
* Allow external audit log plugins
* Add support for auth API server plugins
* Add license file path configuration parameter (not used in open-source)
* Extend audit log with user login events
2017-11-21 17:35:58 -08:00
Russell Jones 9ad600d39b Forwarding to proxy is controlled by a global out-of-band
request. Always forward Teleport agent to node in Web UI.
Support the -A flag in tsh to optionally forward agent to
node in CLI.
2017-11-16 00:11:25 +00: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
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
Roman Tkachenko aeea8e9e8a Merge branch 'master' into roman/plugins 2017-10-16 16:55:54 -07:00
Ev Kontsevoy 57ac02f381 Minor tweaks for 2.3.5
- Documentation edit (closes #1404)
- Updated logging level for configuration (closes #1403)
2017-10-16 14:10:38 -07:00
Roman Tkachenko 5dbda4f41b Use plugins mechanism instead of oss/e flag 2017-10-13 17:32:45 -07:00
Ev Kontsevoy 63ea06d416 Removed 'tsh agent'
Fixes #1126

2.3 had the deprecation warning, this one removes it.
2017-09-22 14:34:35 -07:00
Ev Kontsevoy 76df0127e4 Removed tctl create user.yaml feature
It would create a user in a always-disabled state because no 2FA and no
password would be assigned to him
2017-09-11 14:17:22 -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
Ev Kontsevoy 3d54c3e423 Added a simple --text formatter for tctl get users
It had to work well for both OSS and Enterprise, so it's just a list of
user names.
2017-09-07 18:11:41 -07:00
Ev Kontsevoy f4b1b7a9d8 Merge branch 'master' into ev/1267 2017-09-06 19:38:37 -07:00
Ev Kontsevoy 0cc39838ae Removed 'goterm' dependency
goterm had no license, I quickly replaced it with our own little table
formatter.

also rewrote some tsh commands, that were using home-made formatting, to
the new table, so the output is now much nicer.
2017-09-06 19:06:48 -07:00
Ev Kontsevoy fecf6183da Fixed the unit tests 2017-09-06 14:22:40 -07:00
Ev Kontsevoy dd5f08c058 Added a global distro flag
This allows anywhere in Teleport code to quickly check if it's running
under enterprise or OSS edition

Refs #1267
2017-09-06 14:19:54 -07:00
Ev Kontsevoy d965e9e0a3 Added cleaner way to specify which distribution of Teleport is running 2017-09-06 14:19:54 -07:00
Ev Kontsevoy 9604d8661e Updated to the latest enterprise version 2017-09-05 23:24:38 -07:00
Ev Kontsevoy cc63502987 Fixed the build (merged lost commit) 2017-09-05 22:52:56 -07:00
Ev Kontsevoy 38127d75b5 Implemented -f (force) flag for tctl create
`tctl create` used to create or update (AKA "upsert") resources.
Now there's a difference:

`--force, -f` flag, if not set, means "create only". Otherwise it means
"update".

This means you can fail updating non-existing resources.
2017-09-05 22:52:56 -07:00
Ev Kontsevoy a7db6d7ca6 tctl changes (polish for 2.3)
This commit refs #1137

- tctl get user/joe now works (as reported in #1247)
- tctl create/rm roles changes
- added synonyms for various resources
- made YAML the default output for tctl get
- added better help + examples for tctl get
- edited error messages
- minor refactoring
- added the system of "command plugins" which allows enterprise version
  of tctl to introduce different behavior to OSS commands
2017-09-03 19:23:57 -07:00
Ev Kontsevoy d0706962d1 New way to customize the behavior of tctl for the enterprise users. 2017-09-03 19:21:57 -07:00
Russell Jones c543067001 Removed namespaces and expires from user interface. 2017-08-30 18:11:13 +00:00
Sasha Klizhentas d182d1bcc8 switch from client-go to apimachinery release-1.7 2017-08-28 18:25:39 -07:00
Sasha Klizhentas 0c77c5c0e9 refactor internal rule representation 2017-08-23 19:08:56 -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
Ev Kontsevoy 6bd1737268 Friendlier error message
When `tctl` is executed on a regular node the error message could be
better.

With this commit it will say "tctl must be executed on the auth server"
2017-08-20 13:26:09 -07:00
Ev Kontsevoy e483e1404a Added (terrible) implementation of tsh show 2017-08-18 18:48:35 -07:00
Ev Kontsevoy 6150216653 Changes to how TSH deals with identity files
- Renamed "dir" format to "openssh"
- Replaced self-made key fingerprinting function with a standard one
- Changed fingerprinting from legacy md5 to sha256
2017-08-18 17:31:32 -07:00
Ev Kontsevoy 94cc4a18d4 A few fixes in docs and in code
- Updated "enterprise" and "quick start"
- Fixed #1208
2017-08-16 21:42:35 -07:00
Russell Jones 865000d6fe Reintroduced --auth flag to tsh. 2017-08-09 17:24:54 -07:00
Russell Jones b4c805fe23 Re-factored cluster configuration. 2017-08-07 17:20:16 -07:00
Ev Kontsevoy f547a2b369 Merge remote-tracking branch 'origin/master' into ev/r 2017-07-25 22:43:42 -07:00
Ev Kontsevoy e301279b5c Finished tctl refactoring
`tctl` can now be compiled for multiple distributions, with different
features (commands) enabled or disabled.
2017-07-25 22:41:19 -07:00
Ev Kontsevoy 432cb34c91 Migrated 'users' and 'nodes' CLI commands to the new model 2017-07-25 22:13:02 -07:00
Ev Kontsevoy 39c6fc347c Merge branch 'master' into ev/r 2017-07-23 22:27:08 -07:00