Commit Graph

191 Commits

Author SHA1 Message Date
2e8107ddbd discovered net.Pipe for testing tcp connnections which makes the
previously developed ChannelReadWriter and InmemoryConnection obsolete.
2024-09-08 11:16:49 +02:00
3d0f343098 fix for non-deterministic test. 2024-09-08 11:16:49 +02:00
2153d23e2e channelreadwriter test done. 2024-09-08 11:16:49 +02:00
d3d4c7242a restructuring test code by introducing a testsupport package
Making it easy 6to start a porof server in tests.
2024-09-08 11:16:49 +02:00
276c2c0fa7 some more tests added. 2024-09-08 11:16:49 +02:00
3059a16559 table testing with go routines only really works well when standard
assertions are ued. With suite.Required() there are issues in getting
the test results correct.

Instead, use standard assertions and use suite.T().Failed() to do
early returns.
2024-09-08 11:16:49 +02:00
3f3635b056 a lot of progress in setting up tests for the communication.
Wrote ChannelReadWriter that simulates a connection inmemory.
This is used by the agentserver test for testing the initialization. The
first test is already working.
2024-09-08 11:16:49 +02:00
3776b86946 typo 2024-09-08 11:16:49 +02:00
974b4b9ad0 more symmetry. SetupHeartBeat froma agent to server now done in separate
call.
2024-09-08 11:16:49 +02:00
9f90f9a2b8 now using a testsuite for the throttler tests. 2024-09-08 11:16:49 +02:00
6abcf0a7af go conventions: context should be first argument. 2024-09-08 11:16:49 +02:00
c1ade0408d some moving around of files in the throttling package to make the
structure more clear.
2024-09-08 11:16:49 +02:00
4444d6bbcd initial state is now sent again when the websocket connection is
established.
Also throttling based on user input. When browser sends multiple
messages per second the user will still only get one notification per
second at most.
2024-09-08 11:16:49 +02:00
75606dfe2e consistent casing in the titles (all lower case) 2024-09-08 11:16:49 +02:00
00dd0d17c6 hostkey is now sent from the server to the agent so that at a later
stage we can make the hostkey conrfigurable at the server level instead
of using a fixed hardcoded key.
2024-09-08 11:16:49 +02:00
427ebb2c78 more docs. 2024-09-08 11:16:49 +02:00
3408e2893a moved all ui stuff to the ui package.
The structure of converge server is now much more clear in the package
// structure below pkg/server.
2024-09-08 11:16:49 +02:00
c66be7775f renamed templates package to ui 2024-09-08 11:16:49 +02:00
49912e02d0 moved prometheus to its own package. 2024-09-08 11:16:49 +02:00
3e0828f1fe removed unused field LocalShells of UsageInputs. 2024-09-08 11:16:49 +02:00
4fbe5c7907 introduced DownloadCommand and Shell types to improve type safety 2024-09-08 11:16:49 +02:00
6c6d396393 more generalization of how time is handled in the tests.
Asynchronous variant that is easier to use and multi-thread safe.
2024-09-08 11:16:49 +02:00
1bf559bb65 moved the throttler to its own package. 2024-09-08 11:16:49 +02:00
c13500812a about page vvarious fixes, typo's etc. 2024-09-08 11:16:49 +02:00
4d4a72a062 formatting 2024-09-08 11:16:49 +02:00
17cac3a1a2 typo 2024-09-08 11:16:49 +02:00
3675f0b8c4 Small comment updates. 2024-09-08 11:16:49 +02:00
3574b64842 Server side sorting for the websessions page. No longer using LinkedMap as a result. 2024-09-08 11:16:49 +02:00
1de3c90146 Now using a map of ClientId to clientConnection which is more efficient for deleting clients. 2024-09-08 11:16:49 +02:00
9f12b7bea4 Separated out the metadata about the agents and clients from the agentConnection and clientConnection objects. Now, the state does not need to be copied anymore when sending notifications.
The matchmaker uses copy on write every time a new agent or client connects or disconnects.
2024-09-08 11:16:49 +02:00
96c62ab925 concurrency for the expiry time 2024-09-08 11:16:49 +02:00
fc7977f7bb now using maps of Guid to Agent/Client in the state, working towards the definitive solution.
Using LinkedMap that preserves insertion order for the implementation and also added unit tests for that.
2024-09-08 11:16:49 +02:00
556315906d introdcution of typesafe ids. 2024-09-08 11:16:49 +02:00
eb145b2374 a bit more safety by copying the state when passing it to
the websessions and prometheus.
2024-09-08 11:16:49 +02:00
6bb75728e7 eliminated unused fields in State
Now preserving the lastState in prometheus.go in a State object instead
of in multiple values.
2024-09-08 11:16:49 +02:00
2d426f8db3 using unbuffered channels everywhere now. Only change required was to initialize prometeus and the websessions before the matchmaker. This is because at startup the matchmaker wants to write a notification when it starts up but then prometheus and the websessions would not be there to read them.
Alternative solution would be to run all initialization code in go routines to make it independent of initialization order but having a defined initialization order is much cleaner.
2024-09-08 11:16:49 +02:00
d3c9de628d fixed typos 2024-09-08 11:16:49 +02:00
3e4ad7dff6 timezone handling now moved to a separate script that does not leak any symbols. 2024-09-08 11:16:49 +02:00
f83d7b2c83 added a utility function for logging request data. 2024-09-08 11:16:49 +02:00
30a49217e4 Much imporoved websocket connection closure will now detect closing of
websockets immediately.
2024-09-08 11:16:49 +02:00
b1dbf9e8aa updated the about page 2024-09-08 11:16:49 +02:00
567d9a4031 now a single websocket is opened from the webui to converge.
The browser sends a hello message anytime the user switches to the
sessions page, upon which the server sends the current state back.
THis also improves the timeout handling of broken connecions.
2024-09-08 11:16:49 +02:00
a06d8b0ca6 renamed converge package to matchmaker. 2024-09-08 11:16:49 +02:00
4f06fd71e0 renamed modukle name so that pkgsite will work. 2024-09-08 11:16:49 +02:00
813d398ea4 message now indicates what to do when using ssh and when using sftp 2024-09-08 11:16:49 +02:00
061fabfd07 Addes agent address and client address to the client and agent info. 2024-09-08 11:16:49 +02:00
ad72c41347 ClientConnection no longer has public fields. 2024-09-08 11:16:49 +02:00
db1d908d06 a lot of work to get prometheus monitoring better.
Now the duration is updated every second to get more accurate readings. Also, the time series are now cleaned up when they no longer exists. Previously, all time series were deleted and then everything was setup from scratch.
2024-09-08 11:16:49 +02:00
1c92fcb03e much more clean handling of concurrency in the converge server by separating the administration from the matchmaking by putting admin in a separate package. 2024-09-08 11:16:49 +02:00
c2ec1ce117 Added agent uid to the client info so that client and agent can be correlated in prometheus/grafana. 2024-09-08 11:16:49 +02:00
21ffd29ae4 Now showing information superscripts to hint that there are tooltipos available. 2024-09-08 11:16:49 +02:00
8e131c44a3 Now also logging the user's shell. 2024-09-08 11:16:49 +02:00
82a21ad4f6 One additional logging so that the user's environment info is also known. 2024-09-08 11:16:49 +02:00
5b7d51f210 Code is more robust and should now never try to send a notification to a web client that can block, using a context with cancellation. 2024-09-08 11:16:49 +02:00
0bb9812b59 added tooltips. 2024-09-08 11:16:49 +02:00
0c18689afd Generalized persistence of forms in separate js file.
Some minor improvements to the usage instructions.
2024-09-08 11:16:49 +02:00
2fe2be0b9a with the previous fix connection loss was not detected anymore, now using the ping method based on writing data which is more robust but may take a bit longer for connection loss to be detected. 2024-09-08 11:16:49 +02:00
29ddb6ce00 the read call to check for connectivity was doing more harm than good. Removed it. In the end there were situations where the read was blocking indefinitely, finally leading to a deadlock situation. 2024-09-08 11:16:49 +02:00
f3d0074f17 added environment info from the client. 2024-09-08 11:16:49 +02:00
Erik Brakkee
b4b962d859 remove some console logs in the javascript
prometheus now listening on separate port
fixed powershell command for setting up authorized keys.
2024-09-08 11:16:49 +02:00
85841bcb0f read of 0 bytes to detect connection loss. 2024-09-08 11:16:49 +02:00
52ca0f3ecc consistent lower case on the usage page 2024-09-08 11:16:49 +02:00
564a8792f9 an attempt to avoid flickering of the image (not 100% successful) 2024-09-08 11:16:49 +02:00
b0aaec03fe Added a banner and logo. 2024-09-08 11:16:49 +02:00
f62b81cbfb cumulative counters implemented. 2024-09-08 11:16:49 +02:00
97d34424ca prometheus monitoring now more complete. Including a guid to uniquely identify agents and clients. 2024-09-08 11:16:49 +02:00
Erik Brakkee
135fd081d8 prometheus support step 1
updates to documentation.
2024-09-08 11:16:49 +02:00
2366b78e95 ClientId is now a string instead of an int. 2024-09-08 11:16:49 +02:00
ae60b77eec public id is now shown on the sessions page since authorized keys are
used which is safer.
2024-09-08 11:16:49 +02:00
cd953c5edf eliminated the username. 2024-09-08 11:16:49 +02:00
Erik Brakkee
d109c72f66 removed password based access
authorized keys can now be modified within the session.
keep last set of keys when no valid keys were found and keys are changed during the session .
2024-09-08 11:16:49 +02:00
8d554a5ce1 getting the bootstrap icons (not checking them in).
Split up instructions for working with agents.
2024-09-08 11:16:49 +02:00
1b1f8f2167 A lot of work in getting cut and paste from the UI to
work properly.

Wrote two web components. One for cut and paste in general, and another for code samples.
2024-09-08 11:16:49 +02:00
51be117200 Simple validation of the id and the authorized keys. 2024-09-08 11:16:49 +02:00
75e1bd77ba Alternative contextpath is now supported.
This will simplify hosting in cases where you have no control over DNS but only over one domain.
2024-09-08 11:16:49 +02:00
9456665a6f Preparation for alternative context path.
The contextpath parameter in converge.go is
temporary and should be removed later. What is needed is autodetectio of the context path for the usage page and passing on the context for rendering.
2024-09-08 11:16:49 +02:00
2df296d3c3 fixed issue in usage page where local shell was not used at all. 2024-09-08 11:16:49 +02:00
b41317c598 Lots of work on making easier interactive documentation, especially to make working with SSH public keys really easy.
Next step is to do more validation in the UI.
Specifically:
* validate authorized keys
* detection of accidental use of a private key

Then, password based access can be disabled.
2024-09-08 11:16:49 +02:00
49db7578a7 large parts of the usage is now dynamic.
Still need to generate instructions for authorized keys. A lot of troubleshooting for the form to cookie persistence.
2024-09-08 11:16:49 +02:00
62b51a6d09 work in progress:
* usage page now has more dynamic part where user
  can enter id and publis ssh keys and the server will
  generate the appropriate commmands to execute depending on the local and remote shell.
2024-09-08 11:16:49 +02:00
4f6d9c209d relative link to websocket did not work for some reason, reverted back to /.... link 2024-09-08 11:16:49 +02:00
Erik Brakkee
830594740b * session will now expire some time after last user
activity and updated documentation.
* downloads will now download again. Because of hx-boost
  the downloads where rendered in the browser. Now
  disabling hx-boost for the downloads section.
* relative link for sessions page
2024-09-08 11:16:49 +02:00
c45b6ed090 fixed typo 2024-09-08 11:16:49 +02:00
b332c0fe4c remark about tcptows 2024-09-08 11:16:49 +02:00
a9bd539175 Updated documentation:
* remote shell usage for linux, cmd, and powershell
* help of wsproxy.
2024-09-08 11:16:49 +02:00
adee89cc08 Now by default wsproxy uses a specific protocol to establish connections to the server. It does this by adding the ?wsproxy query parameter.
The server then sends it the protocol version and the client connection info describing whether an agent was found or not. This improves usability for users.

With the --raw option it bypasses this query parameter and wsproxy then works in the old way as a simple stdio-websocket connector. It then still works with converge server but can also be used for simple websocket troubleshooting.
2024-09-08 11:16:49 +02:00
52954a4bdb Using # instead of id in the sessions page to avoid confusion with the term id used in the docs. 2024-09-08 11:16:49 +02:00
Erik Brakkee
e141007f0a Now displaying agent number instead of id.
Passing timezone to server side for rendering of time stamps
Configuration of preferred shells.
2024-09-08 11:16:49 +02:00
d6fc2e4118 Rendering status as HTML tables. 2024-09-08 11:16:49 +02:00
638dffd143 doing the same thing as before but now rendering the
status using a template.
2024-09-08 11:16:49 +02:00
Erik Brakkee
882f97fa17 many small changes
* removed the Async utility
* now using Ping message to webclient for keep alive instaed of actual content
* added remote shell to AgentInfo
* retry of connections to the agent
* better logging for SynchronizeStreams
2024-09-08 11:16:49 +02:00
0f10e1d8e7 typo in usage.html 2024-09-08 11:16:49 +02:00
9d460b9cf3 usage fix (agent was renamed by intellij to session)
Now using embedded timezone database by go so setting the TZ variable will work.
2024-09-08 11:16:49 +02:00
d6d2d5648c Live updates of the sessions.
V1 in ascii-art. To be improved.
2024-09-08 11:16:49 +02:00
100771a7ba restructuring 2024-09-08 11:16:49 +02:00
60d641a1a4 When a duplicate id is requested the server now allocates a new unique id so that the session can be handled anyway. 2024-09-08 11:16:49 +02:00
64f2460bc9 Adding rm/del instruction for agents. 2024-09-08 11:16:49 +02:00
816e8d8609 refactoring towards being able to send events from Admin to UI (websocket) without exposing connection info but only metadata. 2024-09-08 11:16:49 +02:00
7783ab51a8 removed hardcoded host used for testing. 2024-09-08 11:16:49 +02:00
0e8ed86be3 basic htmx with server sending content to the client over a websocket is now working. This only worked when text message where being sent so the websocket handling had to be made configurable with a 'text' boolean field. 2024-09-08 11:16:49 +02:00