All Projects → libcrack → Ezjail Flavours

libcrack / Ezjail Flavours

FreeBSD ezjail flavours

Labels

Projects that are alternatives of or similar to Ezjail Flavours

Vim confs
Personal Vim configurations with focus on a few programming languages (Python, Perl, Ruby and Go) and MacVim.
Stars: ✭ 9 (-25%)
Mutual labels:  viml
Vim Textobj Rubysymbol
Text object for manipulation of ruby symbol variables
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Speech
Speech to text and text to speech via google speech api
Stars: ✭ 11 (-8.33%)
Mutual labels:  viml
Puppet Multipuppetmaster
A setup for multiple puppetmaster and one puppeteer who manges them
Stars: ✭ 9 (-25%)
Mutual labels:  viml
Molokai Terminal
A molokai-like theme for 16-color terminals and a 256-color theme for vim.
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Vimrc
My personal vim config. Now with organisation! :-)
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Dotfiles
My Vim dotfiles.
Stars: ✭ 9 (-25%)
Mutual labels:  viml
Darkspectrum
a gvim color scheme based on the oblivion color scheme for gedit
Stars: ✭ 11 (-8.33%)
Mutual labels:  viml
Vim Simplebar
A simple non-attention-seeking Vim status line.
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Vim Tsv
Tab Separated Value niceties for Vim
Stars: ✭ 11 (-8.33%)
Mutual labels:  viml
Devlindo.vim
Ultimate productivity boost for Vim.
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Zdict.vim
A vim plugin integrate with zdict - the last online dictionary framework you need.
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Php.vim Html Enhanced
combination of the php indent file and the html indent file
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Reading Vimrc
vimrc読書会資料集
Stars: ✭ 9 (-25%)
Mutual labels:  viml
Peg.vim
PEG Syntax for Vim
Stars: ✭ 11 (-8.33%)
Mutual labels:  viml
Ap dark8
8色 Terminal 用の色設定と vim 用の色設定の自作
Stars: ✭ 9 (-25%)
Mutual labels:  viml
Haskomplete.vim
A vim ftplugin for magical contextual haskell code completions
Stars: ✭ 10 (-16.67%)
Mutual labels:  viml
Vim Css To Inline
Transforms plain css into JSX inline styles
Stars: ✭ 12 (+0%)
Mutual labels:  viml
Specky
Functions to help make behavioral testing easy with ruby and rspec.
Stars: ✭ 11 (-8.33%)
Mutual labels:  viml
Vimux Ipy
To send python code from vim to ipython running within a tmux split (with either visually selected code or with IPython like cells).
Stars: ✭ 11 (-8.33%)
Mutual labels:  viml

FreeBSD ezjail flavours

Ezjail is a FreeBSD wrapper for managing jails in a convenient way. Linux people could identify it as a Docker-ish deployment technology for FreeBSD zero-overhead virtualization.

ezjail main website

How ezjail flavours do work?

When creating a new jail using ezjail, a jail template can be specified. The jail template is composed by a set of files which will overwrite the instelled ones on the freshly created jail.

The main ezjail shell script is located at /usr/local/bin/ezjail-admin. By examining the shell stantences starting at line 780 the customisation of the jail installation process can be easily spotted:

 780
 781       # if the packages are links and not files we have to copy them now
 782       find "${ezjail_rootdir}/pkg/" -type l -exec cp -r -f {} {}.ezjail \; -exec mv {}.ezjail {} \;
 783
 784       # If an old style flavour config is found, make it auto run on jails startup
 785       if [ -f "${ezjail_rootdir}/ezjail.flavour" ]; then
 786         chmod 0755 "${ezjail_rootdir}/ezjail.flavour"
 787         mv "${ezjail_rootdir}/ezjail.flavour" "${ezjail_rootdir}/ezjail.flavour".`printf %04d ${installed_flavours}`
 788         [ $(( installed_flavours+=1 )) == 1 ] && echo "Note: Shell scripts for flavour ${ezjail_flavour} installed, flavourizing on jails first startup."
 789
 790       cat > "${ezjail_rootdir}/etc/rc.d/ezjail-config" <<"EOF"
 791 #!/bin/sh
 792 #
 793 # BEFORE: DAEMON
 794 # PROVIDE: ezjail-config
 795 #
 796 name=ezjail-config
 797 start_cmd=flavour_setup
 798
 799 flavour_setup() {
 800   # N.B.: Do NOT rm $0, it points to /etc/rc
 801   rm -f "/etc/rc.d/ezjail-config"
 802   for ezjail_flavour in /ezjail.flavour.*; do
 803     [ -x "${ezjail_flavour}" ] && "${ezjail_flavour}"
 804     rm -f "${ezjail_flavour}"
 805   done
 806 }
 807 run_rc_command "$1"
 808 EOF
 809       chmod 0755 "${ezjail_rootdir}/etc/rc.d/ezjail-config"
 810       fi
 811     done
 812   fi
 813

As can be seen on /usr/local/bin/ezjail-admin:788, the script checks for the existence of the directory ${ezjail_rootdir}/pkg and the script file ezjail.flavour on the freshly created jail filesystem. If the directory ${ezjail_rootdir}/pkg exists, all packages contained on it will be installed automatically; If the file ${ezjail_rootdir}/etc/rc.d/ezjail.flavour is also present, it will be executed.

If the file ${ezjail_rootdir}/ezjail.flavour exists, ezjail-admin understand that its a "old-style jail" and it will be also executed. The same applies to every script named with the form ezjail.flavour.*. The execution of this scripts is carried out with a helper rc-script which is located on the jail's filesystem (${ezjail_rootdir}/etc/rc.d/ezjail-config). The helper rc-script (as well the rest of the ezjail.flavour.* scripts if present) will be deleted after the jail's first boot. Note that the original flavour script included at ${ezjail_rootdir}/etc/rc.d/ezjail.flavour won't be deleted from the freshly installed jail.

So, in order to customise a jail using a specifig flavour the following requeriments must be met:

  1. The default flavour must exist at /usr/jails/flavour/default. If it doesn't, ezjail-admin will create an example jail flavour.
  2. The jail flavour must contain a customisation script located at the flavour's filesystem ${ezjail_rootdir}/etc/rc.d/ezjail.flavour
  3. Customisation code must be implemented on the shell function flavour_setup inside ${ezjail_rootdir}/etc/rc.d/ezjail.flavour. This can be also customised by modifying the variable start_cmd=flavour_setup in the flavour script.

Creating a new ezjail flavour

  1. Copy the base default flavour

    cp -r /usr/jails/flavours/default /usr/jails/flavours/myflavour
    
  2. Rename the ezjail post-installation script and variables

    mv /usr/jails/flavours/myflavour/etc/rc.d/ezjail.flavour.default \
        /usr/jails/flavours/myflavour/etc/rc.d/ezjail.flavour.myflavour
    sed -i '' -s 's/default/myflavour/g' \
        /usr/jails/flavours/myflavour/etc/rc.d/ezjail.flavour.myflavour
    
  3. Implement the post-install inside the flavour_setup shell function

    vim /usr/jails/flavours/myflavour/etc/rc.d/ezjail.flavour.myflavour
    
  4. Deploy a jail using the newly created flavour

    ezjail-admin create -f myflavour mynewjail 'lo1|172.16.1.10'
    
  5. Start the jail (first boot, so be patiente)

    ezjail-admin start mynewjail
    
  6. Connect to the flavoured jail

    ezjail-admin console mynewjail
    
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].