JoshDW19
cb64b84ed0
Merge branch 'master' of https://github.com/pcbsd/sysadm
2016-02-11 11:12:47 -05:00
JoshDW19
e645840496
API call for mounting a boot environment. Can be passed the additional argument below of mountpoint to set a specific
...
mount point directory set by the user.
REST Request:
-------------------------------
PUT /sysadm/beadm
{
"mountpoint" : "/tmp/mounteddir/",
"action" : "mountbe",
"be" : "green"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"namespace" : "sysadm",
"name" : "beadm",
"args" : {
"mountpoint" : "/tmp/mounteddir/",
"be" : "green",
"action" : "mountbe"
}
}
Response:
-------------------------------
{
"args": {
"mountbe": {
"be": "green",
"mountpoint": ""
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-11 10:57:57 -05:00
Brandon Schneider
9e3ab39de4
Add new iocage API call to execute a process on a jail.
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "execjail",
"jail" : "test",
"command" : "echo hi",
"user" : "root"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"name" : "iocage",
"args" : {
"user" : "root",
"action" : "execjail",
"jail" : "test",
"command" : "echo hi"
},
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"execjail": {
"success": {
"hi": ""
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-10 20:24:53 -06:00
Brandon Schneider
76dec01bb4
Add new iocage API call to list resource usage for jails.
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "df"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"name" : "iocage",
"id" : "fooid",
"args" : {
"action" : "df"
}
}
Response:
-------------------------------
{
"args": {
"df": {
"f250ab25-d062-11e5-8209-d05099728dbf": {
"ava": "83.4G",
"crt": "2.30x",
"qta": "none",
"res": "none",
"tag": "test",
"use": "1.69M"
},
"f39318ae-d064-11e5-8209-d05099728dbf": {
"ava": "83.4G",
"crt": "2.30x",
"qta": "none",
"res": "none",
"tag": "test2",
"use": "1.69M"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-10 20:14:03 -06:00
Brandon Schneider
e2cede4fa0
Add new iocage API call to destroy jails.
...
This uses the `force` switch to bypass interaction.
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "destroyjail",
"jail" : "test"
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "destroyjail",
"jail" : "test"
},
"name" : "iocage",
"id" : "fooid",
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"destroyjail": {
"success": {
"Destroying": " 3030c554-d05e-11e5-8209-d05099728dbf"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-10 19:56:43 -06:00
Brandon Schneider
4eaa321034
Add new iocage API call to create jails.
...
The `switches` object is only for specifying empty jails currently, but kept it vague as more may eventually happen.
There are 2 different outputs depending on if a switch is supplied.
Without any switches:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "createjail",
"props" : "tag=test release=10.2-RELEASE"
}
WebSocket Request:
-------------------------------
{
"args" : {
"props" : "tag=test release=10.2-RELEASE",
"action" : "createjail"
},
"namespace" : "sysadm",
"name" : "iocage",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"createjail": {
"props": "tag=test release=10.2-RELEASE",
"success": {
"Successfully created": " 3030c554-d05e-11e5-8209-d05099728dbf (test)"
},
"switches": ""
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
With switches:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"switches" : "-e",
"action" : "createjail",
"props" : "tag=emptytest"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"args" : {
"props" : "tag=emptytest",
"action" : "createjail",
"switches" : "-e"
},
"name" : "iocage",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"createjail": {
"props": "tag=emptytest",
"success": {
"uuid": "1325b8bc-d05e-11e5-8209-d05099728dbf"
},
"switches": "-e"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-10 19:27:30 -06:00
Ken Moore
06edd43945
Add API call for list/register/revoke SSL Certificate management (auth system: alternate for the user/password combo). I don't have a way to test this just yet (still need to write the other side of the system in the client first), but here is the expected inputs:
...
Namespace: "sysadm"
Name: "settings"
Arguments structure needs the "action" variable/value for all calls:
Action: "list_ssl_certs"
- No additional input needed: will list the known/registered certificates organized by <username> : { <public_key> : <certificate as text> }
Action: "register_ssl_cert"
Example Payload: {"action" : "register_ssl_cert", "pub_key" : <public_key> }
The <public_key> string needs to match the public key of one of the certificates currently loaded into the server/client connection. This will register that certificate on the server and allow that user to authenticate without a password as long as that same certificate is loaded up in any future connections. No special outputs are send back (just overall error/ok status).
Action: "revoke_ssl_cert"
Example Payload: {"action" : "revoke_ssl_cert", "pub_key" : <public_key>, "user" : <optional-username> }
The <public_key> string needs to match one of the keys given by the list function (does not need to match any currently-loaded certs). The "user" field is optional, and allows a connection with full admin privileges to revoke certs belonging to other users.
Note about current user/connection permissions level:
If the current user has full admin access, the "list_ssl_certs" API call will return the registered certificates for all users on the system - otherwise it will only return the certificates for the current user. Similarly, the "revoke_ssl_cert" may be used to remove certs registered to other users only if the current user/connection has full admin access - otherwise it may only be used to manage the current user's certificates.
2016-02-10 13:26:46 -05:00
Brandon Schneider
2adb8537e1
Add new iocage API call to clone jails.
...
If you supply props your output will look like this:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"props" : "tag=newtest",
"jail" : "test",
"action" : "clonejail"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"name" : "iocage",
"args" : {
"action" : "clonejail",
"jail" : "test",
"props" : "tag=newtest"
},
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"clonejail": {
"jail": "test",
"props": "tag=newtest",
"success": {
"Successfully created": " 5e1fe97e-cfba-11e5-8209-d05099728dbf (newtest)"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
Otherwise iocage will populate it's own values and the props returned by the API will be empty:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "clonejail",
"jail" : "test"
}
WebSocket Request:
-------------------------------
{
"args" : {
"jail" : "test",
"action" : "clonejail"
},
"name" : "iocage",
"namespace" : "sysadm",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"clonejail": {
"jail": "test",
"props": "",
"success": {
"Successfully created": " 89e78032-cfba-11e5-8209-d05099728dbf (2016-02-09@23"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 23:55:18 -06:00
Kris Moore
f48954ebf4
Add new API call to stop a guest VM
...
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"action" : "stop",
"name" : "bsdguest"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"args" : {
"action" : "stop",
"name" : "bsdguest"
},
"name" : "iohyve",
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"stop": {
"name": "bsdguest"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 14:54:03 -05:00
Kris Moore
c8b123df65
Add new API call to start a iohyve guest
...
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"action" : "start",
"name" : "bsdguest"
}
WebSocket Request:
-------------------------------
{
"name" : "iohyve",
"id" : "fooid",
"args" : {
"action" : "start",
"name" : "bsdguest"
},
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"start": {
"name": "bsdguest"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 14:42:56 -05:00
Kris Moore
e6b285ebfd
Add API call to start the iohyve installation of a guest from
...
an ISO
FYI, this only boots the VM with the ISO, to do the install
the user still needs to run "iohyve console <name>" from the system,
which uses serial mode to bring up a terminal
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"name" : "bsdguest",
"iso" : "FreeBSD-10.2-RELEASE-amd64-disc1.iso",
"action" : "install"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"name" : "iohyve",
"id" : "fooid",
"args" : {
"action" : "install",
"iso" : "FreeBSD-10.2-RELEASE-amd64-disc1.iso",
"name" : "bsdguest"
}
}
Response:
-------------------------------
{
"args": {
"install": {
"iso": "FreeBSD-10.2-RELEASE-amd64-disc1.iso",
"name": "bsdguest"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 14:21:34 -05:00
Kris Moore
2fa64a2031
Add API call to create a new iohyve guest
...
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"action" : "create",
"name" : "bsdguest",
"size" : "10G"
}
WebSocket Request:
-------------------------------
{
"name" : "iohyve",
"namespace" : "sysadm",
"id" : "fooid",
"args" : {
"name" : "bsdguest",
"action" : "create",
"size" : "10G"
}
}
Response:
-------------------------------
{
"args": {
"create": {
"name": "bsdguest",
"size": "10G"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 13:50:08 -05:00
Kris Moore
3c329b4292
Merge branch 'master' of https://github.com/pcbsd/sysadm
2016-02-09 12:47:07 -05:00
Kris Moore
a36081c77e
Add new API call to iohyve, which returns true/false
...
if iohyve has been setup on the box
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"action" : "issetup"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"namespace" : "sysadm",
"args" : {
"action" : "issetup"
},
"name" : "iohyve"
}
Response:
-------------------------------
{
"args": {
"issetup": {
"setup": "true"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 12:46:41 -05:00
JoshDW19
4ed13b1d46
Merge branch 'master' of https://github.com/pcbsd/sysadm
2016-02-09 12:32:37 -05:00
JoshDW19
3b9d2375e4
Add API call to destroy the "target" boot environment and force unmount it. Any
...
Verification should be done through the client.
REST Request:
-------------------------------
PUT /sysadm/beadm
{
"target" : "red",
"action" : "destroybe"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"args" : {
"action" : "destroybe",
"target" : "red"
},
"name" : "beadm",
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"destroybe": {
"target": "red"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
2016-02-09 12:31:32 -05:00
Kris Moore
30ffeccfd4
Merge branch 'master' of https://github.com/pcbsd/sysadm
2016-02-09 12:08:03 -05:00
Kris Moore
c3c809fcbc
Add new API call to do the initial setup of Iohyve
...
Both the pool/nic are required for setup to complete.
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"nic" : "re0",
"pool" : "tank",
"action" : "setup"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"name" : "iohyve",
"args" : {
"pool" : "tank",
"nic" : "re0",
"action" : "setup"
},
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"setup": {
"nic": "re0",
"pool": "tank"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 12:07:12 -05:00
JoshDW19
f58eb8ce08
New API call for creating a new boot environment. An optional flag is shown below.
...
By specifying clonefrom which passes along the -e flag it will clone from a inactive boot environment.
REST Request:
-------------------------------
PUT /sysadm/beadm
{
"action" : "createbe",
"newbe" : "red",
"clonefrom" : "green"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"args" : {
"newbe" : "red",
"clonefrom" : "green",
"action" : "createbe"
},
"namespace" : "sysadm",
"name" : "beadm"
}
Response:
-------------------------------
{
"args": {
"createbe": {
"clonefrom": "green",
"newbe": "red"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 11:49:39 -05:00
JoshDW19
6a3ffaa308
Merge branch 'master' of https://github.com/pcbsd/sysadm
2016-02-09 10:36:44 -05:00
JoshDW19
f9e5dc615d
API call for activating a different boot environment
...
REST Request:
-------------------------------
PUT /sysadm/beadm
{
"target" : "bootthingy",
"action" : "activatebe"
}
WebSocket Request:
-------------------------------
{
"name" : "beadm",
"args" : {
"action" : "activatebe",
"target" : "bootthingy"
},
"namespace" : "sysadm",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"activatebe": {
"target": "bootthingy"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-09 10:35:37 -05:00
Ken Moore
787369def3
Change the default reply code for an invalid subsystem to 400 BadRequest instead of 404 NoContent.
2016-02-09 09:57:50 -05:00
JoshDW19
6d8815a220
Really cool message because I forgot to include the modified webackend.cpp in the last commit.
2016-02-08 14:25:40 -05:00
Kris Moore
1ba65b3388
Add new API class and call for 'beadm', with the initial listbes
...
API call
REST Request:
-------------------------------
PUT /sysadm/beadm
{
"action" : "listbes"
}
WebSocket Request:
-------------------------------
{
"name" : "beadm",
"namespace" : "sysadm",
"id" : "fooid",
"args" : {
"action" : "listbes"
}
}
Response:
-------------------------------
{
"args": {
"listbes": {
"11.0-CURRENTJAN2016-up-20160128_150853": {
"active": "NR",
"date": "2016-01-28",
"mount": "/",
"nick": "14:57",
"space": "10.2G"
},
"initial": {
"active": "-",
"date": "2016-01-28",
"mount": "-",
"nick": "07:00",
"space": "1.2G"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-05 11:02:47 -05:00
Brandon Schneider
5cde5b594d
Add new iocage API to clean all.
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "cleanall"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"args" : {
"action" : "cleanall"
},
"id" : "fooid",
"name" : "iocage"
}
Response:
-------------------------------
{
"args": {
"cleanall": {
"success": "All iocage datasets have been cleaned."
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 22:39:32 -06:00
Brandon Schneider
285002d9e8
Add new iocage API call to clean all templates.
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "cleantemplates"
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "cleantemplates"
},
"name" : "iocage",
"id" : "fooid",
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"cleantemplates": {
"success": "All templates have been cleaned."
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 22:36:02 -06:00
Brandon Schneider
920a51f997
Add new iocage API call to clean all RELEASEs
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "cleanreleases"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"namespace" : "sysadm",
"args" : {
"action" : "cleanreleases"
},
"name" : "iocage"
}
Response:
-------------------------------
{
"args": {
"cleanreleases": {
"success": "All RELEASEs have been cleaned."
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 22:34:01 -06:00
Brandon Schneider
dbbcf44d35
Add new iocage API call to clean all jails.
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "cleanjails"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"args" : {
"action" : "cleanjails"
},
"id" : "fooid",
"name" : "iocage"
}
Response:
-------------------------------
{
"args": {
"cleanjails": {
"success": "All jails have been cleaned."
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 22:31:19 -06:00
Brandon Schneider
27cc7f279e
Add new iocage API call to cap a jail.
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"jail" : "test",
"action" : "capjail"
}
WebSocket Request:
-------------------------------
{
"args" : {
"jail" : "test",
"action" : "capjail"
},
"namespace" : "sysadm",
"name" : "iocage",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"capjail": {
"success": "jail test capped."
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 22:00:26 -06:00
JoshDW19
5cb8dcf026
Add new API call to iohyve to remove a iso dataset
...
Target is the iso we are removing from iohyve
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"action" : "rmiso",
"target" : "FreeBSD-10.2-RELEASE-amd64-bootonly.iso"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"name" : "iohyve",
"args" : {
"target" : "FreeBSD-10.2-RELEASE-amd64-bootonly.iso",
"action" : "rmiso"
},
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"rmiso": {
"target": "FreeBSD-10.2-RELEASE-amd64-bootonly.iso"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 15:53:45 -05:00
Kris Moore
4d3b590f46
Add new API call to iohyve to rename an existing ISO file on
...
disk
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"source" : "test.iso",
"target" : "102.iso",
"action" : "renameiso"
}
WebSocket Request:
-------------------------------
{
"args" : {
"target" : "102.iso",
"source" : "test.iso",
"action" : "renameiso"
},
"id" : "fooid",
"name" : "iohyve",
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"renameiso": {
"source": "test.iso",
"target": "102.iso"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 15:23:44 -05:00
Kris Moore
a727b4a8a2
Add new API call to fetch an ISO for iohyve
...
Uses the "url" argument, which should be the address understood by "fetch" to
grab an ISO from, I.E. http://, ftp://, file://, etc
The task will queue, and return an event when finished
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"url" : "ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso",
"action" : "fetchiso"
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"name" : "iohyve",
"args" : {
"url" : "ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso",
"action" : "fetchiso"
},
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"fetchiso": {
"command": "iohyve fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso",
"comment": "Task Queued",
"queueid": "{b3a8b980-a564-4ff8-86a2-1971bd4f58d1}"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-04 14:58:29 -05:00
Brandon Schneider
98409969c5
Add a new iocage API call to deactivate pools.
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "deactivatepool",
"pool" : "tank"
}
REST Response:
-------------------------------
{
"args": {
"deactivatepool": {
"success": "pool tank deactivated."
}
}
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"name" : "iocage",
"args" : {
"pool" : "tank",
"action" : "deactivatepool"
},
"namespace" : "sysadm"
}
WebSocket Response:
-------------------------------
{
"args": {
"deactivatepool": {
"success": "pool tank deactivated."
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
Also added some error control to the activate API call.
2016-02-03 19:37:23 -06:00
Brandon Schneider
1048b3a6da
Add a new iocage API call to activate zpools.
...
It has 2 different outputs depending on if `pool` was actually specified.
If you specify a pool this is what you get:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "activatepool",
"pool" : "tank"
}
REST Response:
-------------------------------
{
"args": {
"activatepool": {
"success": "pool tank activated."
}
}
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "activatepool",
"pool" : "tank"
},
"name" : "iocage",
"id" : "fooid",
"namespace" : "sysadm"
}
WebSocket Response:
-------------------------------
{
"args": {
"activatepool": {
"success": "pool tank activated."
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
If you do not specify a pool, this is your output:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "activatepool"
}
REST Response:
-------------------------------
{
"args": {
"activatepool": {
"currently active": {
"pool": " tank"
}
}
}
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "activatepool"
},
"namespace" : "sysadm",
"name" : "iocage",
"id" : "fooid"
}
WebSocket Response:
-------------------------------
{
"args": {
"activatepool": {
"currently active": {
"pool": " tank"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-03 19:14:18 -06:00
Brandon Schneider
437b3d76f3
Added stopping an iocage jail API call
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "stopjail",
"jail" : "test"
}
REST Response:
-------------------------------
{
"args": {
"stopjail": {
"test": {
"* Stopping 0bf985de-ca0f-11e5-8d45-d05099728dbf (test)": "",
"+ Removing jail process OK": "",
"+ Running post-stop OK": "",
"+ Running pre-stop OK": "",
"+ Stopping services OK": ""
}
}
}
}
WebSocket Request:
-------------------------------
{
"args" : {
"jail" : "test",
"action" : "stopjail"
},
"namespace" : "sysadm",
"id" : "fooid",
"name" : "iocage"
}
WebSocket Response:
-------------------------------
{
"args": {
"stopjail": {
"test": {
"INFO": " 0bf985de-ca0f-11e5-8d45-d05099728dbf (test) is already down"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-03 17:18:28 -06:00
Brandon Schneider
a5f05b7162
Added starting iocage jail API call
...
Websocket is duplicated after REST call, so it actually shows the jail as up since the REST request has already run
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "startjail",
"jail" : "test"
}
REST Response:
-------------------------------
{
"args": {
"startjail": {
"test": {
"* Starting 0bf985de-ca0f-11e5-8d45-d05099728dbf (test)": "",
"+ Started (shared IP mode) OK": "",
"+ Starting services OK": ""
}
}
}
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"id" : "fooid",
"args" : {
"action" : "startjail",
"jail" : "test"
},
"name" : "iocage"
}
WebSocket Response:
-------------------------------
{
"args": {
"startjail": {
"test": {
"INFO": " 0bf985de-ca0f-11e5-8d45-d05099728dbf (test) is already up"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-03 17:14:09 -06:00
Kris Moore
f4a61e7d0a
Add new API call to set a sysctl
...
REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
"value" : "0",
"sysctl" : "security.jail.mount_devfs_allowed",
"action" : "setsysctl"
}
REST Response:
-------------------------------
{
"args": {
"setsysctl": {
"response": "security.jail.mount_devfs_allowed: 1 -> 0",
"sysctl": "security.jail.mount_devfs_allowed",
"value": "0"
}
}
}
WebSocket Request:
-------------------------------
{
"args" : {
"value" : "0",
"action" : "setsysctl",
"sysctl" : "security.jail.mount_devfs_allowed"
},
"name" : "systemmanager",
"namespace" : "sysadm",
"id" : "fooid"
}
WebSocket Response:
-------------------------------
{
"args": {
"setsysctl": {
"response": "security.jail.mount_devfs_allowed: 1 -> 0",
"sysctl": "security.jail.mount_devfs_allowed",
"value": "0"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-03 13:21:00 -05:00
Kris Moore
fccac94ab6
Add new API call "sysctllist"
...
Returns the list of all setable sysctl values
REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
"action" : "sysctllist"
}
REST Response:
-------------------------------
{
"args": {
"sysctllist": {
"compat.ia32.maxdsiz": "536870912",
"compat.ia32.maxssiz": "67108864",
"compat.ia32.maxvmem": "0",
"compat.linux.osname": "Linux",
"compat.linux.osrelease": "2.6.18",
"compat.linux.oss_version": "198144",
"compat.linux32.maxdsiz": "536870912",
"compat.linux32.maxssiz": "67108864",
"compat.linux32.maxvmem": "0",
....
}
}
}
WebSocket Request:
-------------------------------
{
"name" : "systemmanager",
"namespace" : "sysadm",
"id" : "fooid",
"args" : {
"action" : "sysctllist"
}
}
WebSocket Response:
-------------------------------
{
"args": {
"sysctllist": {
"compat.ia32.maxdsiz": "536870912",
"compat.ia32.maxssiz": "67108864",
"compat.ia32.maxvmem": "0",
"compat.linux.osname": "Linux",
"compat.linux.osrelease": "2.6.18",
"compat.linux.oss_version": "198144",
"compat.linux32.maxdsiz": "536870912",
"compat.linux32.maxssiz": "67108864",
"compat.linux32.maxvmem": "0",
....
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-03 13:09:31 -05:00
Kris Moore
36d2f77d5c
Add API call to kill processes on the system
...
pid = <pid>
signal = {INT|QUIT|ABRT|KILL|ALRM|TERM}
REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
"signal" : "KILL",
"pid" : "13939",
"action" : "killproc"
}
REST Response:
-------------------------------
{
"args": {
"killproc": {
"action": "killproc",
"pid": "13939",
"signal": "KILL"
}
}
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"args" : {
"pid" : "13939",
"action" : "killproc",
"signal" : "KILL"
},
"id" : "fooid",
"name" : "systemmanager"
}
WebSocket Response:
-------------------------------
{
"args": {
"killproc": {
"action": "killproc",
"pid": "13939",
"signal": "KILL"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-03 12:45:02 -05:00
Kris Moore
6fd9a689b4
Rename "systeminfo" class -> "systemmanager"
...
Updated the docs as part of this commit
2016-02-03 12:27:06 -05:00
Ken Moore
8166ef8a79
Cleanup a lot of the logging in the sysadm server. Now the hostinfo log file will clearly list connection time/IP, auth attempts/IP, Dispatches/IP, disconnections/IP. The dispatcher and events systems also properly log activity within their individual log files.
2016-02-02 13:46:23 -05:00
Kris Moore
c9e4b2479a
Add a new API call to "systeminfo" class, which returns
...
information about all processes on the system.
The below example was greatly truncated ;)
REST Request:
-------------------------------
PUT /sysadm/systeminfo
{
"action" : "procinfo"
}
REST Response:
-------------------------------
{
"args": {
"procinfo": {
"228": {
"command": "adjkerntz",
"cpu": "3",
"nice": "0",
"pri": "52",
"res": "1968K",
"size": "8276K",
"state": "pause",
"thr": "1",
"time": "0:00",
"username": "root",
"wcpu": "0.00%"
}
}
}
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"namespace" : "sysadm",
"name" : "systeminfo",
"args" : {
"action" : "procinfo"
}
}
WebSocket Response:
-------------------------------
{
"args": {
"procinfo": {
"228": {
"command": "adjkerntz",
"cpu": "3",
"nice": "0",
"pri": "52",
"res": "1968K",
"size": "8276K",
"state": "pause",
"thr": "1",
"time": "0:00",
"username": "root",
"wcpu": "0.00%"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-02 11:06:45 -05:00
Kris Moore
bd53bbc29b
Add new API class for 'iohyve' along with the initial 'listvms'
...
API call
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"action" : "listvms"
}
REST Response:
-------------------------------
{
"args": {
"listvms": {
"testguest": {
"description": "February 1, 2016 at 03:11:57 PM EST",
"rcboot": "NO",
"running": "NO",
"vmm": "YES"
}
}
}
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"args" : {
"action" : "listvms"
},
"name" : "iohyve",
"id" : "fooid"
}
WebSocket Response:
-------------------------------
{
"args": {
"listvms": {
"testguest": {
"description": "February 1, 2016 at 03:11:57 PM EST",
"rcboot": "NO",
"running": "NO",
"vmm": "YES"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-02-01 15:23:21 -05:00
Ken Moore
87c545230c
New API: Change the sysadm dispatcher access to use the built-in dispatcher system now instead of the old shell script. This new API will have the server queue up generic processes/commands as the user needs (main output will return through the event system). The example blow included a single command queue (procID1), as well an an example of chaining a couple commands together as a single process call (procID2).
...
REST Request:
-------------------------------
PUT /rpc/dispatcher
{
"action" : "run",
"procID2" : [
"echo chainCmd1",
"echo chainCmd2"
],
"procID1" : "echo sample1"
}
REST Response:
-------------------------------
{
"args": {
"started": [
"procID1",
"procID2"
]
}
}
WebSocket Request:
-------------------------------
{
"name" : "dispatcher",
"namespace" : "rpc",
"id" : "fooid",
"args" : {
"procID1" : "echo sample1",
"procID2" : [
"echo chainCmd1",
"echo chainCmd2"
],
"action" : "run"
}
}
WebSocket Response:
-------------------------------
{
"args": {
"started": [
"procID1",
"procID2"
]
},
"id": "fooid",
"name": "response",
"namespace": "rpc"
}
2016-02-01 14:19:25 -05:00
Ken Moore
1146b14917
Cleanup the library/server interactions for sysadm: Now the "library" directory is just an internal collection of classes/files, rather than an actual library of system calls. This allows for in-server globals usage (such as the dispatcher/events systems) within the library files as needed.
2016-02-01 12:29:25 -05:00
Ken Moore
a95404c88d
Merge branch 'master' of github.com:pcbsd/sysadm
2016-02-01 11:21:04 -05:00
Ken Moore
df94531644
Setup the subsystem access to automatically deny access to systems which are not currently available (read/write access needs to be managed by the individual subsystems)
2016-02-01 11:18:24 -05:00
Ken Moore
1e9ec2d4b6
Merge branch 'master' of https://github.com/pcbsd/sysadm
2016-01-29 16:27:48 -05:00
Ken Moore
04c366f114
Finish adding in the new dispatcher system (untested). This should be ready for trying out in some subsystem now.
...
Note: to queue up a job you just need to run one of the DISPATCHER->queue() functions (there are a few overloaded versions for simplicity)
2016-01-29 16:24:40 -05:00
Kris Moore
5a53aacf9f
Add new API call to get all iocage default settings
...
REST Request:
-------------------------------
PUT /sysadm/iocage
{
"action" : "getdefaultsettings"
}
REST Response:
-------------------------------
{
"args": {
"getdefaultsettings": {
"defaults": {
"allow_chflags": "0",
"allow_mount": "0",
"allow_mount_devfs": "0",
"allow_mount_nullfs": "0",
"allow_mount_procfs": "0",
"allow_mount_tmpfs": "0",
"allow_mount_zfs": "0",
"allow_quotas": "0",
"allow_raw_sockets": "0",
"allow_set_hostname": "1",
"allow_socket_af": "0",
"allow_sysvipc": "0",
"available": "426G",
"boot": "off",
"bpf": "off",
"children_max": "0",
"compression": "lz4",
"compressratio": "1.00x",
"coredumpsize": "off",
"count": "1",
"cpuset": "off",
"cputime": "off",
"datasize": "off",
"dedup": "off",
"defaultrouter": "none",
"defaultrouter6": "none",
"devfs_ruleset": "4",
"dhcp": "off",
"enforce_statfs": "2",
"exec_clean": "1",
"exec_fib": "0",
"exec_jail_user": "root",
"exec_poststart": "/usr/bin/true",
"exec_poststop": "/usr/bin/true",
"exec_prestart": "/usr/bin/true",
"exec_prestop": "/usr/bin/true",
"exec_start": "/bin/sh /etc/rc",
"exec_stop": "/bin/sh /etc/rc.shutdown",
"exec_system_jail_user": "0",
"exec_system_user": "root",
"exec_timeout": "60",
"ftpfiles": "base.txz doc.txz lib32.txz src.txz",
"ftphost": "ftp.freebsd.org",
"gitlocation": "https://github.com ",
"hack88": "0",
"host_domainname": "none",
"host_hostname": "442a5843-c6bd-11e5-bbe9-fcaa14deb15d",
"host_hostuuid": "442a5843-c6bd-11e5-bbe9-fcaa14deb15d",
"hostid": "4145fbb8-c5b6-11e5-9f2f-fcaa14deb15d",
"interfaces": "vnet0:bridge0,vnet1:bridge1",
"ip4": "new",
"ip4_addr": "none",
"ip4_autoend": "none",
"ip4_autostart": "none",
"ip4_autosubnet": "none",
"ip4_saddrsel": "1",
"ip6": "new",
"ip6_addr": "none",
"ip6_saddrsel": "1",
"istemplate": "no",
"jail_zfs": "off",
"jail_zfs_dataset": "iocage/jails/442a5843-c6bd-11e5-bbe9-fcaa14deb15d/data",
"jail_zfs_mountpoint": "none",
"last_started": "none",
"login_flags": "-f root",
"maxproc": "off",
"memorylocked": "off",
"memoryuse": "8G:log",
"mount_devfs": "1",
"mount_fdescfs": "1",
"mount_linprocfs": "0",
"mount_procfs": "0",
"mountpoint": "/iocage/.defaults",
"msgqqueued": "off",
"msgqsize": "off",
"nmsgq": "off",
"notes": "none",
"nsemop": "off",
"nshm": "off",
"nthr": "off",
"openfiles": "off",
"origin": "-",
"owner": "root",
"pcpu": "off",
"pkglist": "none",
"priority": "99",
"pseudoterminals": "off",
"quota": "none",
"release": "11.0-CURRENTJAN2016",
"reservation": "none",
"resolver": "none",
"rlimits": "off",
"securelevel": "2",
"shmsize": "off",
"stacksize": "off",
"stop_timeout": "30",
"swapuse": "off",
"sync_target": "none",
"sync_tgt_zpool": "none",
"tag": "2016-01-29@14:19:49",
"type": "basejail",
"used": "96K",
"vmemoryuse": "off",
"vnet": "off",
"vnet0_mac": "none",
"vnet1_mac": "none",
"vnet2_mac": "none",
"vnet3_mac": "none",
"wallclock": "off"
}
}
}
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "getdefaultsettings"
},
"id" : "fooid",
"name" : "iocage",
"namespace" : "sysadm"
}
WebSocket Response:
-------------------------------
{
"args": {
"getdefaultsettings": {
"defaults": {
"allow_chflags": "0",
"allow_mount": "0",
"allow_mount_devfs": "0",
"allow_mount_nullfs": "0",
"allow_mount_procfs": "0",
"allow_mount_tmpfs": "0",
"allow_mount_zfs": "0",
"allow_quotas": "0",
"allow_raw_sockets": "0",
"allow_set_hostname": "1",
"allow_socket_af": "0",
"allow_sysvipc": "0",
"available": "426G",
"boot": "off",
"bpf": "off",
"children_max": "0",
"compression": "lz4",
"compressratio": "1.00x",
"coredumpsize": "off",
"count": "1",
"cpuset": "off",
"cputime": "off",
"datasize": "off",
"dedup": "off",
"defaultrouter": "none",
"defaultrouter6": "none",
"devfs_ruleset": "4",
"dhcp": "off",
"enforce_statfs": "2",
"exec_clean": "1",
"exec_fib": "0",
"exec_jail_user": "root",
"exec_poststart": "/usr/bin/true",
"exec_poststop": "/usr/bin/true",
"exec_prestart": "/usr/bin/true",
"exec_prestop": "/usr/bin/true",
"exec_start": "/bin/sh /etc/rc",
"exec_stop": "/bin/sh /etc/rc.shutdown",
"exec_system_jail_user": "0",
"exec_system_user": "root",
"exec_timeout": "60",
"ftpfiles": "base.txz doc.txz lib32.txz src.txz",
"ftphost": "ftp.freebsd.org",
"gitlocation": "https://github.com ",
"hack88": "0",
"host_domainname": "none",
"host_hostname": "442a5843-c6bd-11e5-bbe9-fcaa14deb15d",
"host_hostuuid": "442a5843-c6bd-11e5-bbe9-fcaa14deb15d",
"hostid": "4145fbb8-c5b6-11e5-9f2f-fcaa14deb15d",
"interfaces": "vnet0:bridge0,vnet1:bridge1",
"ip4": "new",
"ip4_addr": "none",
"ip4_autoend": "none",
"ip4_autostart": "none",
"ip4_autosubnet": "none",
"ip4_saddrsel": "1",
"ip6": "new",
"ip6_addr": "none",
"ip6_saddrsel": "1",
"istemplate": "no",
"jail_zfs": "off",
"jail_zfs_dataset": "iocage/jails/442a5843-c6bd-11e5-bbe9-fcaa14deb15d/data",
"jail_zfs_mountpoint": "none",
"last_started": "none",
"login_flags": "-f root",
"maxproc": "off",
"memorylocked": "off",
"memoryuse": "8G:log",
"mount_devfs": "1",
"mount_fdescfs": "1",
"mount_linprocfs": "0",
"mount_procfs": "0",
"mountpoint": "/iocage/.defaults",
"msgqqueued": "off",
"msgqsize": "off",
"nmsgq": "off",
"notes": "none",
"nsemop": "off",
"nshm": "off",
"nthr": "off",
"openfiles": "off",
"origin": "-",
"owner": "root",
"pcpu": "off",
"pkglist": "none",
"priority": "99",
"pseudoterminals": "off",
"quota": "none",
"release": "11.0-CURRENTJAN2016",
"reservation": "none",
"resolver": "none",
"rlimits": "off",
"securelevel": "2",
"shmsize": "off",
"stacksize": "off",
"stop_timeout": "30",
"swapuse": "off",
"sync_target": "none",
"sync_tgt_zpool": "none",
"tag": "2016-01-29@14:19:49",
"type": "basejail",
"used": "96K",
"vmemoryuse": "off",
"vnet": "off",
"vnet0_mac": "none",
"vnet1_mac": "none",
"vnet2_mac": "none",
"vnet3_mac": "none",
"wallclock": "off"
}
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
2016-01-29 15:37:43 -05:00