[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ezjail networking interface patch



Hello,

I am a new user to ezjail having just recently migrated from jailctl. I
really like the program and feel that has a far greater potential than
jailctl in managing large numbers of jails. However i 've been surprised
by the lack of an automatic way to have the alias IP configured on the
hosting machine. This behavior is provided by /etc/rc.d/jail which is
used by ezjail so i sat down and wrote this small patch to ezjail-admin
which gives the ability to specify an interface to create the alias on
through a -I option on the command line of create + a default value in
ezjail.conf in case the user sets it.

The ezjail_interface variable in ezjail.conf by default should be set to
"". This preserves the old behavior. However should a user set it to the
the string of an interface all new jails should have their IPs set upon
this interface. The -I directive allows overriding the value to either a
different interface in case of a multihomed machine or even to ""
effectively disabling networking for this machine.

Keep up the good work

Sincerely yours,

-- 
Alexandros Kosiaris 	Network Management Center , NTUA
e-mail : alex AT noc.ntua DOT gr
Public Key Fingerprint :
D6B1 0634 BE65 719C 6C95  7492 8201 4B46 C478 F074
--- ezjail-admin	Fri Apr 20 13:25:14 2007
+++ ezjail-admin-alex	Mon May  7 13:43:13 2007
@@ -35,7 +35,7 @@
 # Synopsis messages
 ezjail_usage_ezjailadmin="Usage: ${ezjail_admin} [config|create|delete|install|list|update] {params}"
 ezjail_usage_install="Usage: ${ezjail_admin} install [-mps] [-h host] [-r release]"
-ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli] [-C args] jailname jailip"
+ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli] [-I interface] [-C args] jailname jailip"
 ezjail_usage_delete="Usage: ${ezjail_admin} delete [-w] jailname"
 ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-i] [-pP]"
 ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-i attach|detach] jailname"
@@ -86,6 +86,7 @@
   eval ezjail_attachparams=\"\$jail_${ezjail_safename}_attachparams\"
   eval ezjail_attachblocking=\"\$jail_${ezjail_safename}_attachblocking\"
   eval ezjail_forceblocking=\"\$jail_${ezjail_safename}_forceblocking\"
+  eval ezjail_interface=\"\$jail_${ezjail_safename}_interface\"
 
   ezjail_softlink=${ezjail_jaildir}/`basename -- ${ezjail_rootdir}`
 
@@ -184,8 +185,8 @@
 ######################## ezjail-admin CREATE ########################
 create)
   # Clean variables, prevent polution
-  unset ezjail_rootdir ezjail_flavour ezjail_softlink ezjail_image ezjail_imagetype ezjail_imageparams ezjail_imagesize ezjail_device ezjail_config ezjail_attachparams ezjail_exists ezjail_attachblocking ezjail_forceblocking ezjail_sourcedevice
-  shift; while getopts :f:r:s:xbic:C: arg; do case ${arg} in
+  unset ezjail_rootdir ezjail_flavour ezjail_softlink ezjail_image ezjail_imagetype ezjail_imageparams ezjail_imagesize ezjail_device ezjail_config ezjail_attachparams ezjail_exists ezjail_attachblocking ezjail_forceblocking ezjail_interface ezjail_sourcedevice
+  shift; while getopts :f:r:s:xbic:C:I: arg; do case ${arg} in
     x) ezjail_exists="YES";;
     r) ezjail_rootdir="${OPTARG}";;
     f) ezjail_flavour="${OPTARG}";;
@@ -194,6 +195,7 @@
     b) ezjail_forceblocking="YES";;
     i) ezjail_imagetype=${ezjail_imagetype:-"simple"};;
     s) ezjail_imagesize="${OPTARG}";;
+    I) ezjail_interface="${OPTARG}";;
     ?) exerr ${ezjail_usage_create};;
   esac; done; shift $(( ${OPTIND} - 1 ))
 
@@ -364,6 +366,7 @@
   echo export jail_${ezjail_safename}_attachparams=\"${ezjail_attachparams}\"
   echo export jail_${ezjail_safename}_attachblocking=\"${ezjail_attachblocking}\"
   echo export jail_${ezjail_safename}_forceblocking=\"${ezjail_forceblocking}\"
+  echo export jail_${ezjail_safename}_interface=\"${ezjail_interface}\"
   ) > ${ezjail_config}
 
   # Final steps for flavour installation

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature