Skip to content
A ReST api for creating and managing FreeBSD jails written in Go
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial Commit Jun 25, 2017
.travis.yml Setting up test coverage with Travis Jul 6, 2017
LICENSE Create LICENSE Jul 6, 2017
README.md Update README.md Jul 10, 2017
config.go Add config.go Jul 9, 2017
home.go Almost able to initialise the host now. We have a issue where we can'… Jul 5, 2017
init.go Jail creation is working now! Lots of tweaks and changes too :) Jul 9, 2017
jails.go Jails can now be stopped and started Jul 11, 2017
main.go Jails can now be stopped and started Jul 11, 2017
templates.go Jail creation is working now! Lots of tweaks and changes too :) Jul 9, 2017
utils.go
zfs.go Jail creation is working now! Lots of tweaks and changes too :) Jul 9, 2017

README.md

Jest

A ReST api for creating and managing FreeBSD jails written in Go.

Build Status Coverage Status License


Watch

Creating, starting and deleting jails with Jest:

Alt text


Jails

Create a jail

Call /jails with a POST request and a JSON body:

curl -X POST "http://10.0.2.4:8080/jails" –data 
'{"hostname": "mash", "IPV4Addr": "10.0.2.7", "jailName": "mash", "template": "default", "useDefaults": true}'

Response:

{
  "Message": "Jail created successfully",
  "Error": null,
  "JUID": "3254ec98-e683-429a-9849-7e432c24c01b"
}

List jails

Call /jails with a GET request. You can see we have 3 jails configured on this host, pie, mash and gravy:

curl "http://10.0.2.4:8080/jails"

Response:

{
  "Message": "Jails found.",
  "Error": null,
  "Jails": [
    {
      "Name": "pie",
      "JailConfig": {
        "AllowRawSockets": "0",
        "AllowMount": "0",
        "AllowSetHostname": "0",
        "AllowSysVIPC": "0",
        "Clean": "0",
        "ConsoleLog": "/var/log/jail_${name}_console.log",
        "Hostname": "pie",
        "IPV4Addr": "10.0.2.9",
        "JailUser": "root",
        "JailName": "pie",
        "Path": "/usr/jail",
        "SystemUser": "root",
        "Start": "/bin/sh /etc/rc",
        "Stop": "/bin/sh /etc/rc.shutdown",
        "Template": "default",
        "UseDefaults": true
      },
      "JailState": {
        "Name": "pie",
        "Running": false,
        "JID": ""
      }
    },
    {
      "Name": "gravy",
      "JailConfig": {
        "AllowRawSockets": "0",
        "AllowMount": "0",
        "AllowSetHostname": "0",
        "AllowSysVIPC": "0",
        "Clean": "0",
        "ConsoleLog": "/var/log/jail_${name}_console.log",
        "Hostname": "gravy",
        "IPV4Addr": "10.0.2.8",
        "JailUser": "root",
        "JailName": "gravy",
        "Path": "/usr/jail",
        "SystemUser": "root",
        "Start": "/bin/sh /etc/rc",
        "Stop": "/bin/sh /etc/rc.shutdown",
        "Template": "default",
        "UseDefaults": true
      },
      "JailState": {
        "Name": "gravy",
        "Running": false,
        "JID": ""
      }
    },
    {
      "Name": "mash",
      "JailConfig": {
        "AllowRawSockets": "0",
        "AllowMount": "0",
        "AllowSetHostname": "0",
        "AllowSysVIPC": "0",
        "Clean": "0",
        "ConsoleLog": "/var/log/jail_${name}_console.log",
        "Hostname": "mash",
        "IPV4Addr": "10.0.2.10",
        "JailUser": "root",
        "JailName": "mash",
        "Path": "/usr/jail",
        "SystemUser": "root",
        "Start": "/bin/sh /etc/rc",
        "Stop": "/bin/sh /etc/rc.shutdown",
        "Template": "default",
        "UseDefaults": true
      },
      "JailState": {
        "Name": "mash",
        "Running": false,
        "JID": ""
      }
    }
  ]
}

You can also get the information for a specific jail by issue a GET request to /jails/{jailName} for example:

curl "http://10.0.2.4:8080/jails/mash"

Change the state of a jail

Call /jails/{jailName} with a PUT request. For example, to start a jail, you would put the 'Running' state to 'true':

curl -X PUT "http://10.0.2.4:8080/jails/mash" --data '{"JailState": {"Name": "mash","Running": true}}'

Response:

  {
  "Message": "Jail state updated.",
  "Error": null,
  "JailState": {
      "Name": "mash",
      "Running": true,
      "JID": "2"
    }
  }

You can also update the configuration for the jail the same way.

Delete a jail

Call /jails/{jailName} with a DELETE request:

curl -X DELETE "http://10.0.2.4:8080/jails/mash"

Response:

{
  "Message": "Jail deleted.",
  "Error": null,
  ...
}

Templates

Templates are jails which serve as a template for the creation of other jails, you can deploy a specific FreeBSD version into a template, configure any global settings such as DNS and then use it to create new jails quickly and easily.

Snapshots

Snapshots allow you to backup your jails and templates at specific points in time, including the underlying ZFS datasets and the related Jest configuration.

Config

Config is where you can query or update the Jest configuration for a particular agent.

You can’t perform that action at this time.