Commit Graph

180 Commits

Author SHA1 Message Date
Ken Moore
96fa70a1fe Merge branch 'master' of github.com:pcbsd/sysadm 2016-01-21 07:51:06 -05:00
Ken Moore
7d6ea3ff11 Make the SSL settings for the servers appear as defined within globals-qt.h. This makes it easy to change key/cert files or SSL versions later on for both types of server simultaneously. 2016-01-21 07:49:47 -05:00
dlavigne
9b065a1937 Doc batteryinfo action. 2016-01-20 13:57:07 -05:00
Kris Moore
58e7e7a4e3 Add new API call for batteryinfo
Will return battery:"true/false" if one exists

If one exists, it will also return "level":"1-99"
and "status":"offline/charging/backup/unknown"

REST Request:
-------------------------------
PUT /sysadm/systeminfo
{
   "action" : "batteryinfo"
}

REST Response:
-------------------------------
{
    "args": {
        "batteryinfo": {
            "battery": "false"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "name" : "systeminfo",
   "id" : "fooid",
   "args" : {
      "action" : "batteryinfo"
   }
}

WebSocket Response:
-------------------------------
{
  "args": {
    "batteryinfo": {
      "battery": "false"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-01-20 13:26:38 -05:00
dlavigne
783bca9dbf Doc new systeminfo class. 2016-01-20 13:08:51 -05:00
Kris Moore
7d839787bd Add first API call for the "systeminfo" class
This API call will return a list of external mounts
on the system

TYPE: UNKNOWN/USB/HDRIVE/DVD/SDCARD

REST Request:
-------------------------------
PUT /sysadm/systeminfo
{
   "action" : "externalmounts"
}

REST Response:
-------------------------------
{
    "args": {
        "externalmounts": {
            "/dev/fuse": {
                "filesystem": "fusefs",
                "path": "/usr/home/kris/.gvfs",
                "type": "UNKNOWN"
            }
        }
    }
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "systeminfo",
   "args" : {
      "action" : "externalmounts"
   }
}

WebSocket Response:
-------------------------------
{
  "args": {
    "externalmounts": {
      "/dev/fuse": {
        "filesystem": "fusefs",
        "path": "/usr/home/kris/.gvfs",
        "type": "UNKNOWN"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-01-20 12:13:25 -05:00
Ken Moore
155026aab1 Fix up the file watcher system in the events class. Now it actually functions in it's own thread. 2016-01-20 11:42:41 -05:00
Ken Moore
539e2bf64e Commit some debugging on the event watcher system - trying to figure out why no events are getting picked up from lp log changes. 2016-01-20 10:18:51 -05:00
Ken Moore
f347c5ac56 Merge branch 'master' of github.com:pcbsd/sysadm 2016-01-20 09:54:36 -05:00
Ken Moore
fd5bc59d00 Fix up a bit more of the event system within the websocket class after some testing with the client. 2016-01-20 09:54:00 -05:00
ldemouy
730bd194fc Merge pull request #7 from ldemouy/master
Create ServiceManager Class
2016-01-19 14:44:42 -07:00
Ken Moore
89865b5a2d Merge branch 'master' of github.com:pcbsd/sysadm 2016-01-19 16:18:56 -05:00
Ken Moore
d99871c117 Add in support for Life Preserver events. 2016-01-19 16:17:59 -05:00
Kris Moore
d4f2e302bc OSX Doesn't support TLS 1.1 or 1.2, so we fallback to 1.0 2016-01-19 15:05:18 -05:00
Ken Moore
2155947438 Merge branch 'master' of github.com:pcbsd/sysadm 2016-01-19 14:50:13 -05:00
Ken Moore
7ebc12aaf7 Add handling/debug output for connection errors in the websocket server. 2016-01-19 14:49:46 -05:00
dlavigne
f2daaddea6 Doc checkupdates action. While here, fix formatting error. 2016-01-19 13:13:35 -05:00
Ken Moore
27ebde481d Make sure the "auth" requests are always run in order - do asyncronous event handling after auth is already setup. 2016-01-19 12:36:19 -05:00
Ken Moore
2260d06ee2 Merge branch 'master' of github.com:pcbsd/sysadm 2016-01-19 12:33:32 -05:00
Ken Moore
ee7a5a9d43 Enable QtConcurrent for the message reply generation systems. 2016-01-19 12:33:00 -05:00
Kris Moore
01cad39043 Add new API call for "update" class to check system for updates.
Possible response arrays include

"security":{ "name":"FreeBSD System Update" }
"majorupgrade":{ "name":"Update to 10.3", "tag":"releng10.3", "version":"10.3-RELEASE" }
"patch":{ "name":"StandAlone Update", "tag":"mypatch", "details":"Updates PKG to FOO", "date":"20160120", "size":"5MB" }
"pkgupdate":{ "name":"System Package Updates" }

REST Request:
-------------------------------
PUT /sysadm/update
{
   "action" : "checkupdates"
}

REST Response:
-------------------------------
{
    "args": {
        "checkupdates": {
            "status": "noupdates"
        }
    }
}

  bSocket Request:
-------------------------------
{
   "name" : "update",
   "args" : {
      "action" : "checkupdates"
   },
   "namespace" : "sysadm",
   "id" : "fooid"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "checkupdates": {
      "status": "noupdates"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-01-19 12:27:03 -05:00
Kris Moore
f948edc354 Fix the place where we close the WS connection, so we don't close
too fast before a reply can be formed
2016-01-19 12:25:55 -05:00
Luke De Mouy
7668cbe7f8 Merge remote-tracking branch 'upstream/master' 2016-01-19 10:15:39 -07:00
Luke De Mouy
b54191a87d turn off the debug statement about services that are loaded 2016-01-18 16:43:18 -07:00
Luke De Mouy
8930ed8a01 put unsigned back in to get rid of the warning about conversion between
int and uint
2016-01-18 16:37:20 -07:00
Luke De Mouy
71ef5fb49d Move Ctors/Dtors to top of class as is normal 2016-01-18 16:30:03 -07:00
Luke De Mouy
28eab2e2ef switch the Firewall class over to using the ServiceManager 2016-01-18 16:29:01 -07:00
Luke De Mouy
a66d4b9bcc Create the ServiceManager Class that has the following functionality:
*Start/Stop/Restart a Service
*Enable/Disable a Service
*Get the List of services
*Get a specific service token

Pull in two functions from pcbsd-utils into sysadm-general:
GetConfFileValue
SetConfFileValue
which are used to modify /etc/rc.conf
2016-01-18 16:27:21 -07:00
Ken Moore
0077d68208 Commit some debugging work on the sysadm server. 2016-01-18 16:53:12 -05:00
Kris Moore
766305dcdf Add new "update" API class with the first "checkupdates" action for
testing. We will add an API call for doc'ing once we troubleshoot
some issues
2016-01-18 15:07:57 -05:00
Ken Moore
ae054b759a Merge branch 'master' of github.com:pcbsd/sysadm 2016-01-18 12:38:14 -05:00
Ken Moore
f30b6cf947 Finish up the overhaul of the Events subsystem and start adding in the Life Preserver event handling/systems. 2016-01-18 12:37:40 -05:00
Kris Moore
de4a7bd3c6 Make pid files 744, and update sysadm-global.h with some cleanup 2016-01-18 12:34:50 -05:00
Ken Moore
a2c054e48e Merge branch 'master' of github.com:pcbsd/sysadm 2016-01-15 15:36:58 -05:00
Ken Moore
82b549ead3 Split off the Events subsystem from the server class and set it up for easy expansion later. 2016-01-15 15:36:04 -05:00
dlavigne
fd4c33a660 Add index entries. 2016-01-15 15:16:54 -05:00
dlavigne
9af179294b Doc runreplication task. 2016-01-15 15:06:06 -05:00
dlavigne
4f14d76418 Doc removereplication action. 2016-01-15 14:40:33 -05:00
dlavigne
7024f74a34 Doc listreplication action. 2016-01-15 14:29:29 -05:00
Ken Moore
5a1882dda5 Merge pull request #6 from ldemouy/master
Switch LoadUser and LoadGroup over to using pw usershow/groupshow -a
2016-01-15 14:02:37 -05:00
Luke De Mouy
ff2dcc83b7 Switch LoadUser and LoadGroup over to using pw usershow/groupshow -a 2016-01-15 11:52:56 -07:00
dlavigne
536ff32d47 Doc initreplication action. 2016-01-15 12:22:58 -05:00
Kris Moore
84cb7bb19d Add new API call to run replication tasks manually
REST Request:
-------------------------------
PUT /sysadm/lifepreserver
{
   "host" : "10.0.10.100",
   "dataset" : "mypool",
   "action" : "runreplication"
}

REST Response:
-------------------------------
{
    "args": {
        "runreplication": {
            "dataset": "mypool",
            "host": "10.0.10.100"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "name" : "lifepreserver",
   "args" : {
      "host" : "10.0.10.100",
      "dataset" : "mypool",
      "action" : "runreplication"
   },
   "namespace" : "sysadm"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "runreplication": {
      "dataset": "mypool",
      "host": "10.0.10.100"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-01-15 12:11:01 -05:00
Kris Moore
f31d53587f Add new API call to remove a replication task / target
REST Request:
-------------------------------
PUT /sysadm/lifepreserver
{
   "dataset" : "tank",
   "host" : "192.168.0.10",
   "action" : "removereplication"
}

REST Response:
-------------------------------
{
    "args": {
        "removereplication": {
            "dataset": "tank",
            "host": "192.168.0.10"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "args" : {
      "action" : "removereplication",
      "dataset" : "tank",
      "host" : "192.168.0.10"
   },
   "name" : "lifepreserver",
   "namespace" : "sysadm"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "removereplication": {
      "dataset": "tank",
      "host": "192.168.0.10"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-01-15 12:01:28 -05:00
Kris Moore
97e8af86cf New API call for lifepreserver. This one lists the replication
targets on a system

While here, update api-test.sh to save response to /tmp/api-response, so we dont
need to always cut-n-paste

REST Request:
-------------------------------
PUT /sysadm/lifepreserver
{
   "action" : "listreplication"
}

REST Response:
-------------------------------
{
    "args": {
        "listreplication": {
            "tank1->192.168.0.9": {
                "dataset": "tank1",
                "frequency": "22",
                "host": "192.168.0.9",
                "port": "22",
                "rdset": "tank/backups",
                "user": "backups"
            }
        }
    }
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "args" : {
      "action" : "listreplication"
   },
   "id" : "fooid",
   "name" : "lifepreserver"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "listreplication": {
      "tank1->192.168.0.9": {
        "dataset": "tank1",
        "frequency": "22",
        "host": "192.168.0.9",
        "port": "22",
        "rdset": "tank/backups",
        "user": "backups"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-01-15 10:40:03 -05:00
Ken Moore
68b01bca4f Merge pull request #5 from ldemouy/master
Add uid and gid back in and add in personacrypt
2016-01-15 09:05:14 -05:00
Luke De Mouy
3347669b6e Copy the PersonaCrypt Functions from the maindlgcode file and wire it up
to user creation and password changing
2016-01-14 15:01:04 -07:00
Kris Moore
48d7108529 Add a new API call to (re)init the replication on the remote
side via life-preserver

dataset = The local dataset/pool you are replicating
host = The target for replication, either IP or hostname

REST Request:
-------------------------------
PUT /sysadm/lifepreserver
{
   "dataset" : "tank1",
   "host" : "192.168.0.9",
   "action" : "initreplication"
}

REST Response:
-------------------------------
{
    "args": {
        "initreplication": {
            "dataset": "tank1",
            "host": "192.168.0.9"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "args" : {
      "host" : "192.168.0.9",
      "dataset" : "tank1",
      "action" : "initreplication"
   },
   "namespace" : "sysadm",
   "name" : "lifepreserver"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "initreplication": {
      "dataset": "tank1",
      "host": "192.168.0.9"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-01-14 15:17:25 -05:00
Luke De Mouy
553b14185b add ability to set the uid and gid when creating a user back in 2016-01-14 11:15:14 -07:00
Ken Moore
4dcdaf2cb9 Merge pull request #4 from ldemouy/master
Create a UserManager for sysadm
2016-01-14 10:14:09 -05:00