Commit Graph

118 Commits

Author SHA1 Message Date
Ken Moore
df3196a54e Add a new API call: sysadm/pkg, "action"="pkg_upgrade".
This will have pkg upgrade all currently-installed packages.
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "action" : "pkg_upgrade"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "pkg_upgrade"
   },
   "name" : "pkg",
   "namespace" : "sysadm",
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "pkg_upgrade": {
      "proc_cmd": "pkg upgrade -y",
      "proc_id": "sysadm_pkg_upgrade-{19ace7c9-0d83-4a0d-9249-0b56cb105762}",
      "status": "pending"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-28 10:55:40 -04:00
Ken Moore
203c18752f Add a new API call: sysadm/pkg, "action" = "pkg_audit".
This will perform an audit of all installed packages and report any vulnerable packages and which other packages these impact. NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "action" : "pkg_audit"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "pkg_audit"
   },
   "name" : "pkg",
   "id" : "fooid",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "pkg_audit": {
      "proc_cmd": "pkg audit -qr",
      "proc_id": "sysadm_pkg_audit-{257cc46b-9178-4990-810a-12416ddfad79}",
      "status": "pending"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-28 10:37:05 -04:00
Ken Moore
5e0cc42ab2 Add two more API calls for sysadm/pkg
1) "action"="list_categories" (optional argument: "repo"). This will list all the known categories within the given repository (local repository used by default if none specified). WARNING: Just because a category is listed from here does not mean there are packages existing within that category. This might be corrected later on to only return categories where packages reside.
2) "action"="list_repos" (no other arguments). This will scan the pkg repo config files and return any repos that pkg is currently aware of. NOTE: All of the repos returns by this function are valid as the optional "repo" argument for the other sysadm/pkg API calls.

API Call #1:

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "repo" : "local",
   "action" : "list_categories"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "args" : {
      "action" : "list_categories",
      "repo" : "local"
   },
   "namespace" : "sysadm",
   "name" : "pkg"
}

Response:
-------------------------------
{
  "args": {
    "list_categories": [
      "ports-mgmt",
      "x11",
      "gnome",
      "textproc",
      "devel",
      "python",
      "misc",
      "print",
      "graphics",
      "security",
      "x11-fonts",
      "lang",
      "ipv6",
      "perl5",
      "converters",
      "math",
      "x11-toolkits",
      "sysutils",
      "dns",
      "net",
      "accessibility",
      "databases",
      "shells",
      "x11-themes",
      "multimedia",
      "audio",
      "www",
      "ftp",
      "net-im",
      "archivers",
      "comms",
      "java",
      "deskutils",
      "kde",
      "mail",
      "editors",
      "emulators",
      "games",
      "irc",
      "japanese",
      "news",
      "x11-servers",
      "tk",
      "net-mgmt",
      "ruby",
      "x11-drivers",
      "x11-wm",
      "x11-clocks",
      "kld",
      "tcl",
      "enlightenment",
      "linux"
    ]
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

API Call #2

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "action" : "list_repos"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "pkg",
   "args" : {
      "action" : "list_repos"
   }
}

Response:
-------------------------------
{
  "args": {
    "list_repos": [
      "local",
      "pcbsd-major"
    ]
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-25 19:36:25 -04:00
Ken Moore
cbeb80aee1 Add a new API call for sysadm/pkg: "action"="pkg_search"
This will search with the given "search_term" (required) and return the basic info on all results found.
Optional inputs:
1) "repo" - may be used to specifiy searching a particular repository (local DB if not specified).
2) "category" - may be used to restrict searches to a particular category.

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "repo" : "pcbsd-major",
   "category" : "www",
   "action" : "pkg_search",
   "search_term" : "fire"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "pkg",
   "args" : {
      "action" : "pkg_search",
      "search_term" : "fire",
      "category" : "www",
      "repo" : "pcbsd-major"
   }
}

Response:
-------------------------------
{
  "args": {
    "pkg_search": {
      "www/firefox": {
        "arch": "FreeBSD:11:amd64",
        "cksum": "cc72c379afbd66d152cf06b7d2a14ada413f338071ecb9b084899c94d39f951e",
        "comment": "Web browser based on the browser portion of Mozilla",
        "cpe": "cpe:2.3:a:mozilla:firefox:45.0:::::freebsd11:x64:1",
        "dep_formula": "",
        "desc": "Mozilla Firefox is a free and open source web browser descended from the\nMozilla Application Suite. It is small, fast and easy to use, and offers\nmany advanced features:\n\n o Popup Blocking\n o Tabbed Browsing\n o Live Bookmarks (ie. RSS)\n o Extensions\n o Themes\n o FastFind\n o Improved Security\n\nWWW: http://www.mozilla.com/firefox",
        "flatsize": "96435169",
        "icon": "\\\\\\\"http://www.pcbsd.org/appcafe/icons/www_firefox.png\\\\\\\"",
        "id": "12147",
        "licenselogic": "1",
        "maintainer": "gecko@FreeBSD.org",
        "manifestdigest": "2$0$hcbb9x7urbs9nw1e44chw9bwxn339983b6q9mixxdn5ghdwuh9ny",
        "name": "firefox",
        "no_provide_shlib": "yes",
        "olddigest": "",
        "origin": "www/firefox",
        "osversion": "",
        "path": "All/firefox-45.0_1,1.txz",
        "pkg_format_version": "",
        "pkgsize": "39935776",
        "prefix": "/usr/local",
        "screen1": "\\\\\\\"http://www.pcbsd.org/appcafe/screenshots/www/firefox/screen1.png\\\\\\\"",
        "screen2": "\\\\\\\"http://www.pcbsd.org/appcafe/screenshots/www/firefox/screen2.png\\\\\\\"",
        "version": "45.0_1,1",
        "www": "http://www.mozilla.com/firefox"
      },
      "www/firefox-esr": {
        "arch": "FreeBSD:11:amd64",
        "cksum": "811545c4da089b52db54ddee04af2ea8c439eb12e708f478b09141cdcca7aec5",
        "comment": "Web browser based on the browser portion of Mozilla",
        "cpe": "cpe:2.3:a:mozilla:firefox_esr:38.7.0:::::freebsd11:x64",
        "dep_formula": "",
        "desc": "Mozilla Firefox is a free and open source web browser descended from the\nMozilla Application Suite. It is small, fast and easy to use, and offers\nmany advanced features:\n\n o Popup Blocking\n o Tabbed Browsing\n o Live Bookmarks (ie. RSS)\n o Extensions\n o Themes\n o FastFind\n o Improved Security\n\nWWW: http://www.mozilla.com/firefox",
        "flatsize": "86940998",
        "icon": "\\\\\\\"http://www.pcbsd.org/appcafe/icons/www_firefox-esr.png\\\\\\\"",
        "id": "656",
        "licenselogic": "1",
        "maintainer": "gecko@FreeBSD.org",
        "manifestdigest": "2$0$km1kyyxoae47gyhp9gx7wz7pcnsn6jnc8yxgpz63iyynaxi7ia8y",
        "name": "firefox-esr",
        "no_provide_shlib": "yes",
        "olddigest": "",
        "origin": "www/firefox-esr",
        "osversion": "",
        "path": "All/firefox-esr-38.7.0,1.txz",
        "pkg_format_version": "",
        "pkgsize": "36352676",
        "prefix": "/usr/local",
        "version": "38.7.0,1",
        "www": "http://www.mozilla.com/firefox"
      },
      "www/firefox-esr-i18n": {
        "arch": "FreeBSD:11:*",
        "cksum": "c389f2960fa77548435e0b905b3ef6ddb48957b76c2d8346de1f9f97dd7b23ca",
        "comment": "Localized interface for Firefox",
        "dep_formula": "",
        "desc": "Language packs for Firefox\n\nWWW: http://www.mozilla.org/projects/l10n/",
        "flatsize": "102671800",
        "id": "17350",
        "licenselogic": "1",
        "maintainer": "gecko@FreeBSD.org",
        "manifestdigest": "2$0$wzmx16rcynpdej5eckeg6c8w8z6r7oha86cmjfth4pnfu9iojdmb",
        "name": "firefox-esr-i18n",
        "olddigest": "",
        "origin": "www/firefox-esr-i18n",
        "osversion": "",
        "path": "All/firefox-esr-i18n-38.7.0.txz",
        "pkg_format_version": "",
        "pkgsize": "10449532",
        "prefix": "/usr/local",
        "version": "38.7.0",
        "www": "http://www.mozilla.org/projects/l10n/"
      },
      "www/firefox-i18n": {
        "arch": "FreeBSD:11:*",
        "cksum": "11ca74215bb2c9032a316692b02d4b675cc2102b0e6c9c9f79e85cb6a292e689",
        "comment": "Localized interface for Firefox",
        "dep_formula": "",
        "desc": "Language packs for Firefox\n\nWWW: http://www.mozilla.org/projects/l10n/",
        "flatsize": "107852121",
        "id": "11462",
        "licenselogic": "1",
        "maintainer": "gecko@FreeBSD.org",
        "manifestdigest": "2$0$hozjo4sqt3kn4rqak7hfr4zubt3yahigcnhmbwad7xtuqt1qxntb",
        "name": "firefox-i18n",
        "olddigest": "",
        "origin": "www/firefox-i18n",
        "osversion": "",
        "path": "All/firefox-i18n-45.0.txz",
        "pkg_format_version": "",
        "pkgsize": "10295024",
        "prefix": "/usr/local",
        "version": "45.0",
        "www": "http://www.mozilla.org/projects/l10n/"
      },
      "www/firefox-pulse": {
        "arch": "FreeBSD:11:amd64",
        "cksum": "76bcc4096c378a647c4517ab8fac64d3ecbf2c08a1e47ab0eb9061d95d86c195",
        "comment": "Web browser based on the browser portion of Mozilla",
        "cpe": "cpe:2.3:a:mozilla:firefox:45.0:::::freebsd11:x64:1",
        "dep_formula": "",
        "desc": "Mozilla Firefox is a free and open source web browser descended from the\nMozilla Application Suite. It is small, fast and easy to use, and offers\nmany advanced features:\n\n o Popup Blocking\n o Tabbed Browsing\n o Live Bookmarks (ie. RSS)\n o Extensions\n o Themes\n o FastFind\n o Improved Security\n\nWWW: http://www.mozilla.com/firefox",
        "flatsize": "96438909",
        "icon": "\\\\\\\"http://www.pcbsd.org/appcafe/icons/www_firefox-pulse.png\\\\\\\"",
        "id": "5534",
        "licenselogic": "1",
        "maintainer": "gecko@FreeBSD.org",
        "manifestdigest": "2$0$8mb8qqmcqu3ja8uy4x9nqgyeennjemumrb1q6ugyege76i4rdefb",
        "name": "firefox-pulse",
        "no_provide_shlib": "yes",
        "olddigest": "",
        "origin": "www/firefox-pulse",
        "osversion": "",
        "path": "All/firefox-pulse-45.0_1,1.txz",
        "pkg_format_version": "",
        "pkgsize": "39959876",
        "prefix": "/usr/local",
        "screen1": "\\\\\\\"http://www.pcbsd.org/appcafe/screenshots/www/firefox/screen1.png\\\\\\\"",
        "screen2": "\\\\\\\"http://www.pcbsd.org/appcafe/screenshots/www/firefox/screen2.png\\\\\\\"",
        "version": "45.0_1,1",
        "www": "http://www.mozilla.com/firefox"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-25 16:02:45 -04:00
Ken Moore
0d478da106 Another few modifications to the sysadm/pkg - "pkg_info" action/API.
1) Add a new optional argument: "category". This option will be used if the "pkg_origins" argument is not, and limits the results to packages within the designated category.
2) Add a new optional argument: "result". This option may be set to anything other than "full" to restrict the information output to just the basic/simple information (no sub-categories of info such as "dependencies","requires","depends","options", etc...)

Example JSON request:
{"action":"pkg_info","category":"x11","result":"simple"}
These argument will result in a basic listing of all the packages within the x11 category. (name, version, origin, www, arch, comment, etc....)
{
2016-03-25 15:15:09 -04:00
Ken Moore
147f0c5338 A couple more tweaks for the new pkg_info API call: Now the "provides"/"requires" information will also be output (not too common yet), and the same function can be used for any repo file/database. 2016-03-25 14:38:41 -04:00
Ken Moore
e18efb942d Merge branch 'master' of github.com:pcbsd/sysadm 2016-03-25 12:07:10 -04:00
Ken Moore
0b70897ce8 Add a new API call/system: sysadm/pkg.
This system reads the pkg database directly and returns any relevant information about the pkgs requested.
Note: The "repo" input is optional (defaults to "local"), and the "pkg_origins" will become optional here soon as well (going to make it default to listing all pkgs if the pkg_origins variable is missing/empty).

REST Request:
-------------------------------
PUT /sysadm/pkg
{
   "pkg_origins" : [
      "x11/lumina"
   ],
   "repo" : "local",
   "action" : "pkg_info"
}

WebSocket Request:
-------------------------------
{
   "name" : "pkg",
   "namespace" : "sysadm",
   "args" : {
      "repo" : "local",
      "action" : "pkg_info",
      "pkg_origins" : [
         "x11/lumina"
      ]
   },
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "pkg_info": {
      "x11/lumina": {
        "arch": "FreeBSD:11:amd64",
        "automatic": "0",
        "comment": "Lumina Desktop Environment",
        "dep_formula": "",
        "dependencies": [
          "x11-toolkits/qt5-gui",
          "x11/qt5-x11extras",
          "x11-wm/fluxbox",
          "x11/libXdamage",
          "devel/qt5-linguist",
          "x11/numlockx",
          "devel/qt5-buildtools",
          "multimedia/qt5-multimedia",
          "graphics/qt5-svg",
          "x11/xbrightness",
          "x11/xorg",
          "devel/desktop-file-utils",
          "devel/qt5-concurrent",
          "x11/libX11",
          "net/qt5-network",
          "x11-themes/fluxbox-tenr-styles-pack",
          "x11-themes/kde4-icons-oxygen",
          "devel/qt5-core",
          "x11/xscreensaver",
          "multimedia/gstreamer1-plugins-core",
          "graphics/qt5-imageformats"
        ],
        "desc": "Lumina-DE is a lightweight, BSD licensed desktop environment,\ndesigned specifically for use on FreeBSD\n\nWWW: http://lumina-desktop.org",
        "files": [
          "/usr/local/share/licenses/lumina-0.8.8_2,1/catalog.mk",
          "/usr/local/share/licenses/lumina-0.8.8_2,1/LICENSE",
          "/usr/local/share/licenses/lumina-0.8.8_2,1/BSD3CLAUSE",
          "/usr/local/bin/Lumina-DE",
          "/usr/local/bin/lumina-config",
          "/usr/local/bin/lumina-fileinfo",
          "/usr/local/bin/lumina-fm",
          "/usr/local/bin/lumina-info",
          "/usr/local/bin/lumina-open",
          "/usr/local/bin/lumina-screenshot",
          "/usr/local/bin/lumina-search",
          "/usr/local/bin/lumina-xconfig",
          "/usr/local/etc/luminaDesktop.conf.dist",
          "/usr/local/include/LuminaOS.h",
          "/usr/local/include/LuminaSingleApplication.h",
          "/usr/local/include/LuminaThemes.h",
          "/usr/local/include/LuminaUtils.h",
          "/usr/local/include/LuminaX11.h",
          "/usr/local/include/LuminaXDG.h",
          "/usr/local/lib/libLuminaUtils.so",
          "/usr/local/lib/libLuminaUtils.so.1",
          "/usr/local/lib/libLuminaUtils.so.1.0",
          "/usr/local/lib/libLuminaUtils.so.1.0.0",
          "/usr/local/share/Lumina-DE/Login.ogg",
          "/usr/local/share/Lumina-DE/Logout.ogg",
          "/usr/local/share/Lumina-DE/colors/Black.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Blue-Light.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Grey-Dark.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Lumina-Glass.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Lumina-Gold.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Lumina-Green.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Lumina-Purple.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Lumina-Red.qss.colors",
          "/usr/local/share/Lumina-DE/colors/PCBSD10-Default.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Solarized-Dark.qss.colors",
          "/usr/local/share/Lumina-DE/colors/Solarized-Light.qss.colors",
          "/usr/local/share/Lumina-DE/desktop-background.jpg",
          "/usr/local/share/Lumina-DE/fluxbox-init-rc",
          "/usr/local/share/Lumina-DE/fluxbox-keys",
          "/usr/local/share/Lumina-DE/luminaDesktop.conf",
          "/usr/local/share/Lumina-DE/quickplugins/quick-sample.qml",
          "/usr/local/share/Lumina-DE/themes/Lumina-default.qss.template",
          "/usr/local/share/Lumina-DE/themes/None.qss.template",
          "/usr/local/share/applications/lumina-fm.desktop",
          "/usr/local/share/applications/lumina-info.desktop",
          "/usr/local/share/applications/lumina-screenshot.desktop",
          "/usr/local/share/applications/lumina-search.desktop",
          "/usr/local/share/applications/lumina-support.desktop",
          "/usr/local/share/pixmaps/Insight-FileManager.png",
          "/usr/local/share/pixmaps/Lumina-DE.png",
          "/usr/local/share/wallpapers/Lumina-DE/Lumina_Wispy_gold.jpg",
          "/usr/local/share/wallpapers/Lumina-DE/Lumina_Wispy_green.jpg",
          "/usr/local/share/wallpapers/Lumina-DE/Lumina_Wispy_purple.jpg",
          "/usr/local/share/wallpapers/Lumina-DE/Lumina_Wispy_red.jpg",
          "/usr/local/share/xsessions/Lumina-DE.desktop"
        ],
        "flatsize": "12324767",
        "icon": "\\\"http://www.pcbsd.org/appcafe/icons/x11_lumina.png\\\"",
        "id": "2541",
        "licenselogic": "1",
        "licenses": [
          "BSD3CLAUSE"
        ],
        "locked": "0",
        "maintainer": "kmoore@FreeBSD.org",
        "manifestdigest": "2$0$4ypg5zrco9upyuioczmo3uwbtdd5yart7xuit6fx3gjrn1k979qb",
        "message": "[{\"message\":\"The Lumina Desktop Environment has been installed!\\n\\nAn entry for for launching Lumina from a graphical login manager has already been added to the system, but if you with to start Lumina manually, you will need to do one of the following:\\n1) Put the line \\\"exec Lumina-DE\\\" at the end of your user's \\\"~/.xinitrc\\\" file before running startx\\n2) Wrap the Lumina binary call with an X initialization call: \\nExample: \\\"xinit ${PREFIX}/bin/Lumina-DE -- :0\\\"\\n\\nAlso note that the system-wide default settings for Lumina are contained in ${PREFIX}/etc/luminaDesktop.conf[.dist]. While it is possible to customize the desktop to the user's liking after logging in, you may want to adjust the default settings as necessary if there are multiple user accounts on this system.\"}]",
        "mtree_id": "",
        "name": "lumina",
        "options": {
          "MULTIMEDIA": "on",
          "PCBSD": "on"
        },
        "origin": "x11/lumina",
        "pkg_format_version": "",
        "prefix": "/usr/local",
        "repo_type": "binary",
        "repository": "pcbsd-major",
        "screen1": "\\\"http://www.pcbsd.org/appcafe/screenshots/x11/lumina/screen1.png\\\"",
        "shlibs_provided": [
          "libLuminaUtils.so.1"
        ],
        "shlibs_required": [
          "libxcb.so.1",
          "libxcb-composite.so.0",
          "libxcb-damage.so.0",
          "libXdamage.so.1",
          "libxcb-util.so.1",
          "libGL.so.1",
          "libQt5Core.so.5",
          "libxcb-image.so.0",
          "libxcb-icccm.so.4",
          "libxcb-ewmh.so.2",
          "libQt5Gui.so.5",
          "libQt5Network.so.5",
          "libQt5Widgets.so.5",
          "libQt5Concurrent.so.5",
          "libQt5Multimedia.so.5",
          "libQt5MultimediaWidgets.so.5",
          "libQt5Svg.so.5",
          "libQt5X11Extras.so.5"
        ],
        "time": "1458334158",
        "version": "0.8.8_2,1",
        "www": "http://lumina-desktop.org"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-25 12:03:38 -04:00
Kris Moore
3dfe44dbb0 Add new iohyve API call to set properties
Requires "name" of the VM, and then any other args
will be set on the VM as properties

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "ram" : "512M",
   "name" : "bsdguest",
   "action" : "setprop"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "id" : "fooid",
   "args" : {
      "ram" : "512M",
      "name" : "bsdguest",
      "action" : "setprop"
   },
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "setprop": {
      "bsdguest": {
        "ram": "512M"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-25 11:24:13 -04:00
Kris Moore
87f1b49fed Add new API call to get iohyve properties for a guest
Requires the "name" of the guest to get props for

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "action" : "getprops",
   "name" : "bsdguest"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "namespace" : "sysadm",
   "args" : {
      "name" : "bsdguest",
      "action" : "getprops"
   },
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "getprops": {
      "bsdguest": {
        "autogrub": "\\n",
        "bargs": "-A_-H_-P",
        "boot": "0",
        "con": "nmdm0",
        "cpu": "1",
        "description": "Tue",
        "install": "no",
        "loader": "bhyveload",
        "name": "bsdguest",
        "os": "default",
        "persist": "1",
        "ram": "256M",
        "size": "10G",
        "tap": "tap0"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-25 10:40:56 -04:00
Ken Moore
b074a611ee Move the "zpool list" parsing function over to a new library class (sysadm::ZFS). This adjusts the sysadm/zfs "list_pools" action return message a bit - it just moves the list of pools one level down - within a "list_pools" object. 2016-03-22 09:39:39 -04:00
Ken Moore
3060c9906d Finish fixing up the sysadm/update server backend. Now updates can properly be started and the other update flags are detected/used as needed. 2016-03-21 14:14:51 -04:00
Ken Moore
857919958a Update the iohyve fetch event structure, and make the whole process log structure available under the "process_details" variable in the event. 2016-03-04 11:05:39 -05:00
Ken Moore
9396d7ae1a Merge branch 'master' of github.com:pcbsd/sysadm 2016-03-03 15:19:47 -05:00
Ken Moore
d2ef14a0d1 Large update to the dispatcher/events systems. Now there is a new DispatcherParsing.h file where any subsystem-specific dispatcher calls may be detected/parsed/handled as needed, and the iohyve fetch routine was updated to use this routine (for a proof of concept - could probably still use a bit more log output). 2016-03-03 15:16:55 -05:00
Kris Moore
91a2c700cb Add API call to show iohyve version
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "action" : "version"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "args" : {
      "action" : "version"
   },
   "id" : "fooid",
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "version": {
      "version": "iohyve v0.7.3 2016/01/08 Bear in a Datacenter Edition"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-03 14:22:53 -05:00
Kris Moore
9b03d42d87 Add API call to resize a VM disk
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "disk" : "disk0",
   "name" : "bsdguest",
   "action" : "resizedisk",
   "size" : "20G"
}

WebSocket Request:
-------------------------------
{
   "name" : "iohyve",
   "id" : "fooid",
   "args" : {
      "size" : "20G",
      "action" : "resizedisk",
      "disk" : "disk0",
      "name" : "bsdguest"
   },
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "resizedisk": {
      "disk": "disk0",
      "name": "bsdguest",
      "size": "20G"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-03 13:57:16 -05:00
Kris Moore
f91651d342 Add API call to remove a disk from a VM
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "disk" : "disk1",
   "name" : "bsdguest",
   "action" : "deletedisk"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "id" : "fooid",
   "name" : "iohyve",
   "args" : {
      "name" : "bsdguest",
      "action" : "deletedisk",
      "disk" : "disk1"
   }
}

Response:
-------------------------------
{
  "args": {
    "deletedisk": {
      "disk": "disk1",
      "name": "bsdguest"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-03 13:37:57 -05:00
Kris Moore
04ee45494f Add new API call to add/create a disk for a VM
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "name" : "bsdguest",
   "action" : "adddisk",
   "size" : "10G"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "size" : "10G",
      "name" : "bsdguest",
      "action" : "adddisk"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "adddisk": {
      "bsdguest": {
        "size": "10G"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-03 13:24:02 -05:00
Kris Moore
30cb48e926 Add API call to list disks connected to a VM
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "name" : "bsdguest",
   "action" : "listdisks"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "listdisks",
      "name" : "bsdguest"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "listdisks": {
      "disk0": "10G"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-03 13:11:13 -05:00
Kris Moore
caf6bd1e06 Add new API call to delete an iohyve guest
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "action" : "delete",
   "name" : "bsdguest"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "id" : "fooid",
   "args" : {
      "action" : "delete",
      "name" : "bsdguest"
   },
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "delete": {
      "name": "bsdguest"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-03 12:46:03 -05:00
Ken Moore
21fbf8643a A couple fixes to try and track down a seg fault when a distpatch finishes. 2016-03-03 10:53:27 -05:00
Kris Moore
5f148d5388 Show debug output from iso fetch slots 2016-03-03 10:07:15 -05:00
Ken Moore
1b0cd22e84 Add a new API call to the iohyve subsystem: action="listisos"
This will list all the known ISO files which iohyve can use.

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "action" : "listisos"
}

WebSocket Request:
-------------------------------
{
   "name" : "iohyve",
   "namespace" : "sysadm",
   "id" : "fooid",
   "args" : {
      "action" : "listisos"
   }
}

Response:
-------------------------------
{
  "args": {
    "listisos": [
      "TRUEOS10.2-RELEASE-08-19-2015-x64-netinstall.iso"
    ]
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-02 14:56:39 -05:00
Ken Moore
a14e9a30d6 Add a new API call: sysadm/zfs (action==list_pools)
This subsystem can be expanded later for any zfs/zpool command calls

REST Request:
-------------------------------
PUT /sysadm/zfs
{
   "action" : "list_pools"
}

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

Response:
-------------------------------
{
  "args": {
    "tank": {
      "alloc": "71.8G",
      "altroot": "-",
      "cap": "32%",
      "dedup": "1.00x",
      "expandsz": "-",
      "frag": "18%",
      "free": "148G",
      "health": "ONLINE",
      "size": "220G"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-03-02 12:34:17 -05:00
Kris Moore
718ed8f594 Attempt to fix dispatcher queues 2016-02-29 15:37:49 -05:00
Kris Moore
08df048c69 Commit for ken to fix DProc issues 2016-02-29 15:27:17 -05:00
Kris Moore
2401da278d Add new WebBackendSlots.cpp which has the initial slots for
Iohvye Fetch processing
2016-02-29 14:44:18 -05:00
Ken Moore
2bd77b9882 Merge branch 'master' of github.com:pcbsd/sysadm 2016-02-19 15:15:56 -05:00
Ken Moore
6cfaf6e597 Completely re-do the SSL authentication systems. Now it is a two-stage auth system, where the server generates a random string, sends it to the client for encryptions with their private SSL key, then gets sent back to the server where the new string is decrypted with the known SSL keys and compared to teh original for accuracy. 2016-02-18 17:01:09 -05:00
Kris Moore
80bcd67733 Add two new API calls, to shutdown/halt the system, and to
reboot the system.

Shutdown API call

REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
   "action" : "halt"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "args" : {
      "action" : "halt"
   },
   "name" : "systemmanager",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "halt": {
      "response": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

Reboot API call

REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
   "action" : "reboot"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "args" : {
      "action" : "reboot"
   },
   "name" : "systemmanager",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "reboot": {
      "response": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-17 13:08:12 -05:00
JoshDW19
d3d32b15c5 New API call for unmounting a boot environment. This will specify the -f flag which will force unmount even if the BE is busy.
REST Request:
-------------------------------
PUT /sysadm/beadm
{
   "action" : "umountbe",
   "be" : "green"
}

WebSocket Request:
-------------------------------
{
   "name" : "beadm",
   "namespace" : "sysadm",
   "id" : "fooid",
   "args" : {
      "be" : "green",
      "action" : "umountbe"
   }
}

Response:
-------------------------------
{
  "args": {
    "umountbe": {
      "be": "green"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-11 14:49:14 -05:00
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