Commit Graph

615 Commits

Author SHA1 Message Date
Ken Moore
8a16f9a4d0 Completely finish up the raw changes to the sysadm-server so it can operator over a bridge connection (untested).
This also adds some stand-alone CLI options to the sysadm-binary utility:
"bridge_list": List any bridge connections in the settings file. Output Format: "name (url)"
"bridge_add <name> <url>": Add a bridge connection to the settings with the given name. (if websocket server is running, this change will take effect within 5 minutes).
"bridge_remove <name>": Remove a bridge connection from the settings. If a websocket server is running, this change will take effect within 5 minutes (closing the connection to the removed bridge as needed).

There is also a new option in the global server config file:
BRIDGE_CONNECTIONS_ONLY=[true/false]
If true, this will allow the websocket server to run without listening on any ports, and instead force all traffic through the existing bridge connections.
2016-05-12 10:25:16 -04:00
Ken Moore
916069ce69 Add support for the server to become the initiator in a client->bridge connection. The bridge setting to use are still not implemented yet, and the new bridge-specific SSL key pair still needs to be created on first run. 2016-05-11 15:29:37 -04:00
Ken Moore
9012c7cb57 Add an additional localhost verification check for passwordless logins: Ensure that the designated user is actually active on the localhost (via "users" if no graphical sessions running, or number of active processes if there are graphical sessions running) 2016-05-11 12:14:20 -04:00
Ken Moore
a303e160af Get the sysadm-server all setup for bridge relay connections (untested). 2016-05-10 15:56:16 -04:00
Ken Moore
f5ed144d90 Start adding the bridge data handling into the server so there can be unique encryption keys and auth tokens per bridged system connection. 2016-05-10 12:13:24 -04:00
Ken Moore
94596117ed API CHANGE: Get the sysadm-bridge all finished up. Now to add the necessary bits to the server/client so we can try using it.
NOTE: There is a special API/event for the bridge to announce which server/client connections are available (clients will see only servers, and vice versa)
The syntax for this event is:

{
 "namespace":"events",
 "name":"bridge",
 "id":"",
 "args":{
   "available_connections":["ID1","ID2", etc..]
 }
}

Note that the available_connections are *all* the connections available at that time (it is not a difference from a previous state), so there may be both new ID's in the list and ID's which are no longer listed.

This event will get sent out any time a new connection/disconnection is made from the bridge which impacts the current connection (so a client will only get the event when a server connects/disconnects and vice versa).
2016-05-10 10:49:33 -04:00
Ken Moore
083b8ad694 Oops - forgot to add the new RestStructs.cpp file to GIT. 2016-05-09 14:50:10 -04:00
Ken Moore
e2c66ceef7 Merge branch 'master' of github.com:pcbsd/sysadm 2016-05-09 13:37:35 -04:00
Ken Moore
1fea33c354 Get the sysadm server message parsing system all setup for bridge relays (no additional encryption/decryption layer yet) 2016-05-09 13:36:40 -04:00
Kris Moore
6c07e17e8b Merge branch 'master' of https://github.com/pcbsd/sysadm 2016-05-09 11:32:13 -04:00
Kris Moore
2e4c3d8068 Update the api-test script with optional way to enable REST mode 2016-05-09 11:31:52 -04:00
Dru Lavigne
6351f7714e Merge pull request #15 from Mrt134/master
Adding PCBSD style to sysadm server handbook
2016-05-09 11:27:41 -04:00
Mrt134
32ffd85af7 Merge branch 'master' of https://github.com/pcbsd/sysadm 2016-05-09 11:23:38 -04:00
Mrt134
e9c0da79e0 Added PCBSD style to sysadm handbook
- Changed SysAdm handbook style to pair with the PCBSD handbook
2016-05-09 11:21:33 -04:00
Ken Moore
9287390e54 Fix up the parsing/usage of REST requests in the sysadm server. A Websocket-specific filtering rule was put in place earlier which was filtering out all the REST messages. 2016-05-09 10:15:59 -04:00
Ken Moore
c736015324 Merge branch 'master' of github.com:pcbsd/sysadm 2016-05-09 09:36:13 -04:00
Ken Moore
34e7fb4754 Fix up the api-test script so that it runs REST requests properly (WS disabled for the moment - while REST is enabled) 2016-05-09 09:34:05 -04:00
Kris Moore
129285945d Minor update to test script to use correct variables for REST 2016-05-07 20:22:05 -04:00
dlavigne
97695ef4f1 Doc list_ssl_checksums. 2016-05-05 10:19:12 -04:00
Ken Moore
aa9e7583a7 Merge branch 'master' of github.com:pcbsd/sysadm 2016-05-05 09:58:56 -04:00
Ken Moore
f9af7c2efe Add a API call to the server:
rpc/settings: "action" = "list_ssl_checksums"
This will list the MD5 checksums of all the known SSL keys (in no particular order)

REST Request:
-------------------------------
PUT /rpc/settings
{
   "action" : "list_ssl_checksums"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "list_ssl_checksums"
   },
   "namespace" : "rpc",
   "name" : "settings",
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "md5_keys": [
      "0`H\u0013\r*\u00023\u000bc"
    ]
  },
  "id": "fooid",
  "name": "response",
  "namespace": "rpc"
}
2016-05-05 09:55:38 -04:00
Ken Moore
8154d8f345 Enable the 30 second window for a client to successfully authorize before the connection is closed. 2016-05-04 14:54:04 -04:00
Ken Moore
45cec48f3c Setup the authorization manager for the sysadm-bridge. The SSL authentication procedures for Bridge<-->System should now be completely functional. 2016-05-04 14:45:59 -04:00
dlavigne
0f9a73de2f Add identify RPC call. 2016-05-03 14:20:44 -04:00
Ken Moore
4ef706afee Get the bridge setup with the rpc/identify API call as well. Also get it all setup for adding additional API calls. 2016-05-03 11:03:53 -04:00
Ken Moore
7f38c91420 Merge branch 'master' of github.com:pcbsd/sysadm 2016-05-03 10:40:16 -04:00
Ken Moore
f7333470a9 API Change:
Add a new API call to the sysadm-server: rpc/identify (no arguments)
This generates a responce identifying the type of sysadm system ("server" in this case). This will be important and I am going to be adding this same API call to all the various sysadm utilities so they can identify which one they are ("server", "bridge", "client").

REST Request:
-------------------------------
PUT /rpc/identify
{}

WebSocket Request:
-------------------------------
{
   "args" : {},
   "namespace" : "rpc",
   "id" : "fooid",
   "name" : "identify"
}

Response:
-------------------------------
{
  "args": {
    "type": "server"
  },
  "id": "fooid",
  "name": "response",
  "namespace": "rpc"
}
2016-05-03 10:26:08 -04:00
Kris Moore
bc2d2e4fa6 Merge branch 'master' of https://github.com/pcbsd/sysadm 2016-05-02 15:04:50 -04:00
Kris Moore
ef792121e5 Use script as rc.d target 2016-05-02 15:04:34 -04:00
Kris Moore
e584066f3c Add rc.d and sysadm-bridge-start 2016-05-02 15:04:07 -04:00
Ken Moore
26f54ff4f0 Simply the server layout of the bridge 2016-05-02 14:57:49 -04:00
Ken Moore
eb0b691c1d Merge branch 'master' of github.com:pcbsd/sysadm 2016-05-02 14:35:24 -04:00
Ken Moore
bd863b70d7 Add the beginning of a new "sysadm-bridge" utility. 2016-05-02 14:34:18 -04:00
Ken Moore
b27166d1d4 Add a couple new settings:
auth/allowUserPassAuth [bool]: Enable username/password combinations for authentication (default value: true)
auth/allowServiceAuth [bool]: Allow local services to connect to the server with reduced priviledges (default value: false)
2016-04-29 14:37:55 -04:00
Ken Moore
6d47bf00bd oops. fix a typo. 2016-04-29 13:41:25 -04:00
Ken Moore
71f507e9b7 Merge branch 'master' of github.com:pcbsd/sysadm 2016-04-29 13:11:11 -04:00
Ken Moore
60fc3e1c5a API CHANGE:
Change the sysadm/settings class to rpc/settings

While here also add automatic log pruning capabilities (90 days of logs kept by default).
2016-04-29 13:10:11 -04:00
dlavigne
52d599dc82 Doc the namespace change of the sysadm/logs class to rpc/logs. 2016-04-29 11:06:53 -04:00
dlavigne
85ffdab597 Doc kill action. 2016-04-29 11:03:52 -04:00
dlavigne
b473ea7314 Add new dispatcher class. 2016-04-29 10:59:16 -04:00
Ken Moore
78b4dcf62a API CHANGE
Change the namespace of the sysadm/logs class to rpc/logs for consistency between internal/external classes.
2016-04-29 10:58:14 -04:00
Ken Moore
d56e90d557 Add a new API call: rpc/dispatcher -> "action":"kill"
This allows a user with full access to cancel pending/running jobs within the dispatcher system.

Required arguments: "job_id" : <ID string> or [<ID1>, <ID2>, etc..]

REST Request:
-------------------------------
PUT /rpc/dispatcher
{
   "action" : "kill",
   "job_id" : "sysadm_pkg_install-{9c079421-ace9-4b6e-8870-d023b48f4c49}"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "kill",
      "job_id" : "sysadm_pkg_install-{9c079421-ace9-4b6e-8870-d023b48f4c49}"
   },
   "namespace" : "rpc",
   "name" : "dispatcher",
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "killed": {
      "jobs": ["sysadm_pkg_install-{9c079421-ace9-4b6e-8870-d023b48f4c49}"]
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "rpc"
}
2016-04-29 10:25:36 -04:00
Ken Moore
aa055be7a2 Merge branch 'master' of github.com:pcbsd/sysadm 2016-04-29 10:04:57 -04:00
Ken Moore
caad04ece9 Add a new API call:
rpc/dispatcher -> "action":"list"
This will list all the currently running/pending processes within the dispatcher queues.
Possible Queues: "no_queue", "pkg_queue", "iocage_queue"

REST Request:
-------------------------------
PUT /rpc/dispatcher
{
   "action" : "list"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "list"
   },
   "namespace" : "rpc",
   "name" : "dispatcher",
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "jobs": {
      "pkg_queue": {
        "sysadm_pkg_install-{9c079421-ace9-4b6e-8870-d023b48f4c49}": {
          "commands": [
            "pkg install -y --repository \"pcbsd-major\" misc/pcbsd-meta-mate"
          ],
          "queue_position": "0",
          "state": "running"
        }
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "rpc"
}
2016-04-29 10:00:43 -04:00
dlavigne
3131b73a5e Add new logs class. While here, fix a grammo. 2016-04-28 09:13:58 -04:00
Ken Moore
4cee9244e4 Add a new API call/class:
namespace: "sysadm"
name: "logs"
This is a class used for interacting with the log files created by the sysadm server.

"action":"read_logs"
Optional Arguments:
"logs" : array/string of log type(s) (valid types: "hostinfo", "dispatcher", "events-dispatcher","events-lifepreserver","events-state"
"time_format" : one of the following formats (required for custom start/end times below). Valid Formats: "time_t_seconds", "epoch_mseconds, "relative_[day/month/second]", or a QDateTime String code (see http://doc.qt.io/qt-5/qdatetime.html#fromString for details).
"start_time" : "<number/string corresponding to format above>"
"end_time" : "<number/string corresponding to format above>"

If the time_format is missing, or the start/end times are not defined, the end time will be the current date/time, and the start time will be 12 hours previous.
If the "logs" argument is missing/empty, then all logs matching the search parameters will be returned.

Example Input:
{
 "action" : "read_logs",
 "time_format" : "relative_second",
 "start_time" : "-3600"
}
This returns all log entries within the last hour.

Return Format:
"args" : {
  "<log_file_type>" : {
    "<date_time_stamp>" : <message>,
    "<date_timo_stamp2>" : <message>
  }
}
2016-04-27 16:41:17 -04:00
dlavigne
1d041b47f9 Update name of Guide. While here, fix a mangled table. 2016-04-27 14:37:39 -04:00
dlavigne
fe58a46838 Doc pkg_autoremove action. 2016-04-27 09:34:06 -04:00
Ken Moore
0acebe7435 Fix up a couple LP API calls. Now they function properly again. 2016-04-26 13:59:53 -04:00
Ken Moore
cd3078c708 Add a note about the day-codes for the lifepreserver scrub schedule: 01 is Monday, 07 is Sunday. 2016-04-26 13:45:45 -04:00