2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-17 21:23:18 +00:00

708 Commits

Author SHA1 Message Date
Jarrod Johnson
6504acecad Change default log retention to be indefinite
Users have noted and complained that log data was lost, and didn't have old data.  This changes
the default behavior to be indefinite retention.  Users noting a lot of logs using space have a nice
intuitive indication of old files to delete, and the option remains for those to request a log expiration.
2016-03-21 09:57:23 -04:00
Jarrod Johnson
d1247cfb37 Restore disconnect notification to ssh plugin
The disconnect notification was erroneously removed in
the previous checkin, this restores it.
2016-03-16 11:20:14 -04:00
Jarrod Johnson
c5e19fe474 Have ssh plugin report on connection error
Before the connection would fail and log to trace without anything
particularly informative for the client (they just saw 'unexpected error'.
Provide a more informative behavior for the client.
2016-03-16 09:50:46 -04:00
Jarrod Johnson
58bf72d5aa Do not remove databuffer on close
If exiting from a shell session, the databuffer will contain needed info for the client
to work properly.  Preserve databuffer existence.  Responsibility for deleting the
object should be in the hands of the caller.
2016-03-16 09:09:24 -04:00
Jarrod Johnson
f15cf014e9 Avoid changing hash size during loop
Coerce iterator into a list so that for loop does not
raise an exception.
2016-03-16 08:40:39 -04:00
Jarrod Johnson
fb1e20906e Do not worry over non-existant debug socket
If the socket was not created, do not error on exit because it isn't there to be cleaned up.
2016-03-15 11:15:15 -04:00
Jarrod Johnson
1bf124494e Add location attributes
Provide data that may be used to track system
locations.
2016-03-14 09:16:46 -04:00
Jarrod Johnson
9d40c67974 Support walking back through multiple logs
The rollback support and replaydid not follow more than one log back.  Do the work to recurse
into older and older files, until big enough buffer or run out of files.
2016-03-13 19:50:02 -04:00
Jarrod Johnson
f75f2cae51 Correct sockapi behavior when user authorize returns None
If a user can connect, but gets removed mid session, traces were
being generated.  Correct by recognizing the circumstance and returning
the appropriate error to the client.
2016-03-13 18:57:27 -04:00
Jarrod Johnson
5ae0f37f97 Do not generate trace on request to delete non-existant session 2016-03-13 18:51:18 -04:00
Jarrod Johnson
7ff20e3e39 Close shell interface on remote disconnect 2016-03-13 18:48:58 -04:00
Jarrod Johnson
0e42e83c50 Restore intended per-user ssh sessions
Each user should have their own ssh sessions, as originally
intended.
2016-03-13 18:43:57 -04:00
Jarrod Johnson
378df2966f Clean up the debug socket
Also limit permissions of the socket.
2016-03-13 17:29:10 -04:00
Jarrod Johnson
b6546f923b Fix security key initialization race condition
When initializing security key, a background thread may occur.  Sometimes,
the system would go to daemonize while that thread was still running, and
the whole system could exit.  Leading to incomplete write to globals as well
as leaving the daemon looking at the data copied over from pre-fork and
seeing the last state of that thread forever frozen.  Make sure the background
threads are fully done prior to exiting.
2016-03-08 11:34:25 -05:00
Jarrod Johnson
40007a6a07 Enable debug socket for sufficiently new eventlet
Newer versions of eventlet address the bug in backdoor when used with
unix domain sockets.  Detect and take advantage of that circumstance.
2016-03-07 16:44:11 -05:00
Jarrod Johnson
b98889b54a Ensure correct inflight thread id is discarded
It seems it is possible in some circumstance for the thread id to become stale,
perhaps due to a different threadid executing the code for some reason.
Just in case, ensure the same exact value that was added is later discarded.
2016-03-05 15:47:49 -05:00
Jarrod Johnson
8bf7a55b68 Prevent double firing of event in consolesession
There is a timing scenario where an event could be double fired.
Prevent by clearing the event when sent.
2016-03-05 15:42:17 -05:00
Jarrod Johnson
e9f2d7eb63 Improve logout return to browsers
A browser may choke on non-JSON if promised JSON.
Fix this by passing down JSON for now (API explorer
users can deal with seeing JSON for error data)
2016-02-29 09:15:21 -05:00
Jarrod Johnson
5ab6a9e7b7 Provide client hook to get session info
Web client may come in without knowing the session info.
Provide it additional data to populate UI elements.
2016-02-28 18:48:18 -05:00
Jarrod Johnson
64751bccee Add closesession request to term sessions
This provides a method for client to request session be closed down.  This provides more
immediate responsiveness to the client count when closing such a terminal.  With this
both closing a single window and doing a 'logout' immediately impacts clientcount.
2016-02-28 14:15:08 -05:00
Jarrod Johnson
244f655055 Suppress browser cache for API requests
Browser caching can interfere with our goal of delivering fresh data.
Suppress the cache behavior for our API.
2016-02-27 18:40:05 -05:00
Jarrod Johnson
1b26b2cf3d Reap session immediately on logout
When a logout happens in httpapi, immediately reap related console sessions that are in flight.
2016-02-27 14:04:19 -05:00
Jarrod Johnson
029c06cc66 Have polling consoleserver sessions more robustly clean up
If anything goes wrong or a session was exited, no destruction of the
session would be scheduled.  Always have a reaper scheduled for that.
2016-02-27 13:37:10 -05:00
Jarrod Johnson
1df60ceb73 Rename '/session/logout' to '/sessions/current/logout'
Have room for a future where a user may list and disconnect
other sessions.
2016-02-27 13:23:02 -05:00
Jarrod Johnson
875cda00ff Implement immediate logout
If something triggers a logout of session, immediately cut into long polling
console sessions that are relevant.  This results in web client being able to
immediately detect a logout externally originated.
2016-02-27 13:20:08 -05:00
Jarrod Johnson
f20cdfe49a Add '/session/logout' to http api
Provide a means for an http request to erase
it's own session's validity.  Always return 200
to allow a client to send bogus credentials and
think they got success to forget the auth data in
the browser.
2016-02-27 11:40:26 -05:00
Jarrod Johnson
ba6b7cf517 Give client method to suppress auth header
A javascript client running in browser may want
the standard authorization header suppressed.
This allows a client to block the default browser
authentication prompt.
2016-02-26 08:35:51 -05:00
Jarrod Johnson
76ff9fd759 Reduce long poll console to 25 seconds
A common proxy timeout is 30 seconds.  Adjust the
polling length to accomodate such a limitation.
2016-02-23 10:35:58 -05:00
Jarrod Johnson
18280ccd8a Fix bad location of auth check
Auth check was erroneously in a place without
ability to check the authenticated state.  Move
the check up the stack.
2016-02-21 15:05:11 -05:00
Jarrod Johnson
37f1acae1d Merge pull request #58 from jjohnson42/sshkey
SSH known hosts handling
2016-02-21 15:00:19 -05:00
Jarrod Johnson
44103b31f8 Extend key error data
Clients can now more consistently tell the difference between
a new key and a mismatch.
2016-02-21 14:44:31 -05:00
Jarrod Johnson
774d592eb4 Fix more usage mistakes 2016-02-11 12:08:18 -05:00
Jarrod Johnson
824253ae8c Hook the custom keyhandler policy
This actually uses the previously commited class, with one fix for
the structure of the key as passed into the callback.
2016-02-11 11:35:20 -05:00
Jarrod Johnson
a574c69535 Implement SSH host key management
Like self-signed TLS certificates, SSH host keys
warrant a similar security policy.  This implementations
follows the lead of the TLS management and uses the same
policy name and interpretation, just storing the value
in 'pubkeys.ssh' for the node rather than an extensible
set of entry points (for now).
2016-02-11 09:13:21 -05:00
Jarrod Johnson
a2445e7f65 Have client exit on auth issue
Without this, an auth error will leave client just
hanging without any feedback.  Correct this with
raising an exception for now.
2016-01-28 10:26:28 -05:00
Jarrod Johnson
0b51edde97 Merge branch 'jjohnson42-fixwget' 2016-01-28 10:19:17 -05:00
Jarrod Johnson
6b014deb04 Fix response to wget and similar
If the client comes in without an HTTP_ACCEPT at all,
do not trigger a trace.
2016-01-28 10:17:06 -05:00
Jarrod Johnson
366de1235c Merge pull request #55 from jjohnson42/sshconsole
Implement shell infrastructure with ssh support
2016-01-08 15:06:26 -05:00
Jarrod Johnson
1d67f10432 Merge branch 'sshconsole' of github.com:jjohnson42/confluent into sshconsole 2016-01-08 14:55:17 -05:00
Jarrod Johnson
6e1adc88dd Have sessions deleted on disconnect
When the shell session disconnects, destroy all dependent
sessions.
2016-01-08 14:44:52 -05:00
Jarrod Johnson
2419d95b74 Rework session to console relationship
Previously, was using counters to track the relation, also had distinct tracking of users versus
callbacks.  Unify the callback and user into a single 'session' attach and then use the size
of the set of sessions and their declared users rather than trying to maintain a counter on the side.

This change simplifies the relationship, changes away the logging and clientcount counter for
a more robust strategy, and paves the way for the dependent ShellHandler to terminate connected
sessions when the shell session dies.
2016-01-08 14:44:49 -05:00
Jarrod Johnson
62801734ab Have shell sessions not autoreconnect
Unlike consoles, where the underlying concept is a real
persistent thing that needs some care to reattach to watch,
a shell session should die when it is lost, as a new one would
have to be created anyway.  Modify the disconnect behavior
for a shell session to set closed and notify the receivers.
It should also reap dependent watching objects in a future
change.
2016-01-08 14:44:47 -05:00
Jarrod Johnson
cf16bfdd95 Have builds include shell plugins
The builds were excluding the ssh plugin, correct the oversight.
2016-01-08 14:44:45 -05:00
Jarrod Johnson
d0bd275cb3 Instrument sessions/ collection
This causes some additional features into core.  Namely
the ability to use a fixed module rather than a string
defined plugin.  This allows shellserver to implement the
'plugin' interface without living in 'plugins'.  'plugins'
implies modularity and potential eventual choice, but
this functionality is core.  It would make sense for the
'attributes' plugin to be changed to match this strategy.
2016-01-08 14:44:42 -05:00
Jarrod Johnson
a332678312 Avoid double connect on shell start
When a shell session is initiated, it registers
a recipient at the same time it would be trying
to establish session for not being a 'wait for
recipient'.  Aggressively mark the state as connecting
to avoid the recipient erroneously thinking things have
not be set into motion yet.  Additionally, have the ssh
plugin avoid a traceback when disconnecting before completing
connection.
2016-01-08 14:44:39 -05:00
Jarrod Johnson
cfafa5a5bc Connect shellserver to httpapi
Have httpapi recognize the difference and start a shellserver
session when appropriate.  Next step will be to wire up enumeration of
current shellserver sessions, debug ssh.py traceback, delete on remote
close, and auto-delete when no client connected after some interval (e.g.
30 minutes).
2016-01-08 14:44:37 -05:00
Jarrod Johnson
23f025eb71 Use a plain incrementing session id
UUIDs when a simple number will do are harder to use.
Change to a simple increment id.  This could cause an issue
with multiple management nodes, but I think the sessions
should be contained to the instance used.
2016-01-08 14:44:34 -05:00
Jarrod Johnson
5695bf5288 Fix misuse of console log for shell sessions
console logging assumptions are not valid for shell sessions.
Correct by modifying the buffer init code to be conditional
and adding a stub 'log' to the ShellHandler class.
2016-01-08 14:44:32 -05:00
Jarrod Johnson
3d926bb264 Amend core to pass shell objects through
For 'handler' plugin definitions, also recognize
the 'console' exception to allow the plugin to pass
through to the shellserver infrastructure.
2016-01-08 14:44:29 -05:00
Jarrod Johnson
c8e5644061 Refactor socket api terminal handler
The 'terminal' handler code is broken out to get ready
for using 'shell' as well as 'console'
2016-01-08 14:44:27 -05:00