948 Commits

Author SHA1 Message Date
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
Ken Moore
1b29b2966f Merge branch 'master' of github.com:pcbsd/sysadm 2016-04-26 09:43:24 -04:00
Ken Moore
b07f11bfe3 API Change: Add a simple "pkg_autoremove" action for the sysadm/pkg subsystem (no additional inputs). This will queue up the pkg autoremove action which prunes all orphaned packages on the systems. 2016-04-26 09:41:58 -04:00
dlavigne
0cd90b3558 Doc new fs class. 2016-04-22 12:29:56 -04:00
Kris Moore
dd33e9648c Merge branch 'master' of https://github.com/pcbsd/sysadm 2016-04-21 14:55:20 -04:00
Kris Moore
b2a4386c36 Add a new 'fs' class to sysadm API, along with the initial "dirlist"
command which will return a listing of the requested directory

REST Request:
-------------------------------
PUT /sysadm/fs
{
   "dir" : "/root",
   "action" : "dirlist"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "dir" : "/root",
      "action" : "dirlist"
   },
   "id" : "fooid",
   "name" : "fs",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "dirlist": {
      "VirtualBox VMs": {
        "dir": true
      },
      "freenas-auto.iso": {
        "group": "wheel",
        "owner": "root",
        "size": 408049664
      },
      "ixbuild": {
        "dir": true
      },
      "pc-sysinstall.cfg": {
        "group": "wheel",
        "owner": "root",
        "size": 1741
      },
      "pc-sysinstall.log": {
        "group": "wheel",
        "owner": "root",
        "size": 125408
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-04-21 14:54:12 -04:00
dlavigne
cf1c16de27 Doc datasets action. 2016-04-21 13:45:16 -04:00
dlavigne
25eac09ce9 Doc createsnap action. 2016-04-21 13:37:59 -04:00
Ken Moore
e4db11a0f7 Fix a missing "ok=true" in the ZFS list_pools API call. 2016-04-21 13:09:48 -04:00
Kris Moore
f5d402108b Fix starting sysadm-server 2016-04-21 11:34:06 -04:00
Kris Moore
cff5baae47 Add new API call to return list of ZFS datasets on a particular pool
REST Request:
-------------------------------
PUT /sysadm/zfs
{
   "action" : "datasets",
   "zpool" : "tank"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "id" : "fooid",
   "args" : {
      "action" : "datasets",
      "zpool" : "tank"
   },
   "name" : "zfs"
}

Response:
-------------------------------
{
  "args": {
    "datasets": {
      "tank": {
        "avail": "320G",
        "mountpoint": "none",
        "refer": "96K",
        "used": "125G"
      },
      "tank/ROOT": {
        "avail": "320G",
        "mountpoint": "none",
        "refer": "96K",
        "used": "63.7G"
      },
      "tank/ROOT/11.0-CURRENTAPRIL2016-up-20160418_124146": {
        "avail": "320G",
        "mountpoint": "/",
        "refer": "34.7G",
        "used": "63.7G"
      },
      "tank/ROOT/11.0-CURRENTFEB2016-up-20160303_094216": {
        "avail": "320G",
        "mountpoint": "/",
        "refer": "29.7G",
        "used": "272K"
      },
      "tank/ROOT/11.0-CURRENTMAR2016-up-20160304_102405": {
        "avail": "320G",
        "mountpoint": "/",
        "refer": "30.5G",
        "used": "248K"
      },
      "tank/ROOT/11.0-CURRENTMAR2016-up-20160315_092952": {
        "avail": "320G",
        "mountpoint": "/",
        "refer": "31.2G",
        "used": "256K"
      },
      "tank/ROOT/11.0-CURRENTMAR2016-up-20160318_090405": {
        "avail": "320G",
        "mountpoint": "/",
        "refer": "34.7G",
        "used": "280K"
      },
      "tank/ROOT/initial": {
        "avail": "320G",
        "mountpoint": "/mnt",
        "refer": "5.60G",
        "used": "232K"
      },
      "tank/iocage": {
        "avail": "320G",
        "mountpoint": "/iocage",
        "refer": "152K",
        "used": "1.13G"
      },
      "tank/iocage/.defaults": {
        "avail": "320G",
        "mountpoint": "/iocage/.defaults",
        "refer": "96K",
        "used": "992K"
      },
      "tank/iocage/download": {
        "avail": "320G",
        "mountpoint": "/iocage/download",
        "refer": "96K",
        "used": "203M"
      },
      "tank/iocage/download/10.2-RELEASE": {
        "avail": "320G",
        "mountpoint": "/iocage/download/10.2-RELEASE",
        "refer": "202M",
        "used": "202M"
      },
      "tank/iocage/jails": {
        "avail": "320G",
        "mountpoint": "/iocage/jails",
        "refer": "104K",
        "used": "1000K"
      },
      "tank/iocage/releases": {
        "avail": "320G",
        "mountpoint": "/iocage/releases",
        "refer": "96K",
        "used": "953M"
      },
      "tank/iocage/releases/10.2-RELEASE": {
        "avail": "320G",
        "mountpoint": "/iocage/releases/10.2-RELEASE",
        "refer": "96K",
        "used": "952M"
      },
      "tank/iocage/releases/10.2-RELEASE/root": {
        "avail": "320G",
        "mountpoint": "/iocage/releases/10.2-RELEASE/root",
        "refer": "825M",
        "used": "951M"
      },
      "tank/iocage/templates": {
        "avail": "320G",
        "mountpoint": "/iocage/templates",
        "refer": "96K",
        "used": "992K"
      },
      "tank/iohyve": {
        "avail": "320G",
        "mountpoint": "/iohyve",
        "refer": "96K",
        "used": "22.8G"
      },
      "tank/iohyve/Firmware": {
        "avail": "320G",
        "mountpoint": "/iohyve/Firmware",
        "refer": "96K",
        "used": "992K"
      },
      "tank/iohyve/ISO": {
        "avail": "320G",
        "mountpoint": "/iohyve/ISO",
        "refer": "96K",
        "used": "453M"
      },
      "tank/iohyve/ISO/FreeBSD-10.1-RELEASE-amd64-bootonly.iso": {
        "avail": "320G",
        "mountpoint": "/iohyve/ISO/FreeBSD-10.1-RELEASE-amd64-bootonly.iso",
        "refer": "219M",
        "used": "220M"
      },
      "tank/iohyve/ISO/FreeBSD-10.2-RELEASE-amd64-bootonly.iso": {
        "avail": "320G",
        "mountpoint": "/iohyve/ISO/FreeBSD-10.2-RELEASE-amd64-bootonly.iso",
        "refer": "231M",
        "used": "232M"
      },
      "tank/iohyve/bsdguest": {
        "avail": "320G",
        "mountpoint": "/iohyve/bsdguest",
        "refer": "96K",
        "used": "22.4G"
      },
      "tank/iohyve/bsdguest/disk0": {
        "avail": "341G",
        "mountpoint": "-",
        "refer": "1.75G",
        "used": "22.4G"
      },
      "tank/tmp": {
        "avail": "320G",
        "mountpoint": "/tmp",
        "refer": "2.95M",
        "used": "18.3M"
      },
      "tank/usr": {
        "avail": "320G",
        "mountpoint": "none",
        "refer": "96K",
        "used": "37.5G"
      },
      "tank/usr/home": {
        "avail": "320G",
        "mountpoint": "/usr/home",
        "refer": "96K",
        "used": "27.8G"
      },
      "tank/usr/home/kris": {
        "avail": "320G",
        "mountpoint": "/usr/home/kris",
        "refer": "21.9G",
        "used": "27.8G"
      },
      "tank/usr/jails": {
        "avail": "320G",
        "mountpoint": "/usr/jails",
        "refer": "96K",
        "used": "992K"
      },
      "tank/usr/obj": {
        "avail": "320G",
        "mountpoint": "/usr/obj",
        "refer": "4.68G",
        "used": "4.75G"
      },
      "tank/usr/ports": {
        "avail": "320G",
        "mountpoint": "/usr/ports",
        "refer": "2.20G",
        "used": "2.96G"
      },
      "tank/usr/src": {
        "avail": "320G",
        "mountpoint": "/usr/src",
        "refer": "1.82G",
        "used": "2.01G"
      },
      "tank/var": {
        "avail": "320G",
        "mountpoint": "none",
        "refer": "96K",
        "used": "13.5M"
      },
      "tank/var/audit": {
        "avail": "320G",
        "mountpoint": "/var/audit",
        "refer": "96K",
        "used": "992K"
      },
      "tank/var/log": {
        "avail": "320G",
        "mountpoint": "/var/log",
        "refer": "1.43M",
        "used": "5.21M"
      },
      "tank/var/mail": {
        "avail": "320G",
        "mountpoint": "/var/mail",
        "refer": "120K",
        "used": "1.21M"
      },
      "tank/var/tmp": {
        "avail": "320G",
        "mountpoint": "/var/tmp",
        "refer": "3.20M",
        "used": "5.99M"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-04-21 11:28:37 -04:00
Kris Moore
4f8b78c361 Add new API call to create a new snapshot via Life-Preserver
REST Request:
-------------------------------
PUT /sysadm/lifepreserver
{
   "snap" : "mytestsnap",
   "dataset" : "tank",
   "comment" : "Testing",
   "action" : "createsnap"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "comment" : "Testing",
      "dataset" : "tank",
      "action" : "createsnap",
      "snap" : "mytestsnap"
   },
   "name" : "lifepreserver",
   "namespace" : "sysadm",
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "createsnap": {
      "comment": "Testing",
      "dataset": "tank",
      "snap": "mytestsnap"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-04-21 10:36:44 -04:00
Kris Moore
5f53dd4a4e Finish adding relaunchd services for sysadm server 2016-04-19 10:00:56 -04:00
Kris Moore
9153467480 Disable launchd support for now 2016-04-14 15:57:29 -04:00
Kris Moore
47428cef37 Detect if we get a 'cannot destroy' error from iohyve rmiso 2016-04-14 10:36:29 -04:00
Kris Moore
57cc4212bb Comments on sysadm server wrapper 2016-04-13 14:30:05 -04:00
Dru Lavigne
2860152c04 Merge pull request #14 from Mrt134/master
Additional dispatcher work
2016-04-12 17:04:15 -04:00
Kris Moore
fc55d22a9f Merge branch 'master' of https://github.com/pcbsd/sysadm 2016-04-12 16:56:29 -04:00