diff options
-rwxr-xr-x | ezjail-admin | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ezjail-admin b/ezjail-admin index 48dfdc8..b73ebc6 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -55,10 +55,6 @@ create) | |||
55 | # we need at least a name and an ip for new jail | 55 | # we need at least a name and an ip for new jail |
56 | [ "$newjail_name" -a "$newjail_ip" -a $# = 2 ] || exerr 'Usage: ezjail create [-f flavour] [-r jailroot] [-x] jailname jailip' | 56 | [ "$newjail_name" -a "$newjail_ip" -a $# = 2 ] || exerr 'Usage: ezjail create [-f flavour] [-r jailroot] [-x] jailname jailip' |
57 | 57 | ||
58 | # check, whether IP is configured on a local interface, warn if it isnt | ||
59 | ping -c 1 -m 1 -t 1 -q $newjail_ip > /dev/null | ||
60 | [ $? = 0 ] || echo "Warning: IP $newjail_ip not configured on a local interface" | ||
61 | |||
62 | # check, whether ezjail-update has been called. existence of | 58 | # check, whether ezjail-update has been called. existence of |
63 | # ezjail_jailbase is our indicator | 59 | # ezjail_jailbase is our indicator |
64 | [ -d $ezjail_jailbase ] || exerr "Error: base jail does not exist. Please run 'ezjail-admin update' first" | 60 | [ -d $ezjail_jailbase ] || exerr "Error: base jail does not exist. Please run 'ezjail-admin update' first" |
@@ -128,11 +124,33 @@ create) | |||
128 | echo export jail_${newjail_nname}_procfs_enable=\"${ezjail_procfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} | 124 | echo export jail_${newjail_nname}_procfs_enable=\"${ezjail_procfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} |
129 | echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} | 125 | echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} |
130 | 126 | ||
127 | # check, whether IP is configured on a local interface, warn if it isnt | ||
128 | ping -c 1 -m 1 -t 1 -q $newjail_ip > /dev/null | ||
129 | [ $? = 0 ] || echo "Warning: IP $newjail_ip not configured on a local interface" | ||
130 | |||
131 | # check, whether some host system services do listen on the Jails IP | ||
132 | TIFS=$IFS; IFS=_ | ||
133 | newjail_listener=`sockstat -4 -l | grep $newjail_ip:[[:digit:]]` | ||
134 | if [ $? = 0 ]; then | ||
135 | echo "Warning: Some services already seem to be listening on IP $newjail_ip" | ||
136 | echo " This may cause some confusion, here they are:" | ||
137 | echo $newjail_listener | ||
138 | fi | ||
139 | |||
140 | newjail_listener=`sockstat -4 -l | grep \*:[[:digit:]]` | ||
141 | if [ $? = 0 ]; then | ||
142 | echo "Warning: Some services already seem to be listening on all IPs" | ||
143 | echo " (including $newjail_ip)" | ||
144 | echo " This may cause some confusion, here they are:" | ||
145 | echo $newjail_listener | ||
146 | fi | ||
147 | IFS=$TIFS | ||
148 | |||
131 | # Final steps for flavour installation | 149 | # Final steps for flavour installation |
132 | if [ "${newjail_flav}" ]; then | 150 | if [ "${newjail_flav}" ]; then |
133 | install -o root -g wheel -m 0755 ${newjail_flav} ${newjail_root}/etc/ezjail.flavour | 151 | install -o root -g wheel -m 0755 ${newjail_flav} ${newjail_root}/etc/ezjail.flavour |
134 | install -o root -g wheel -m 0755 ${ezjail_share}/ezjail-config.sh ${newjail_root}/etc/rc.d/ezjail-config.sh | 152 | install -o root -g wheel -m 0755 ${ezjail_share}/ezjail-config.sh ${newjail_root}/etc/rc.d/ezjail-config.sh |
135 | echo "Shell scripts installed, flavourizing on jails first startup" | 153 | echo "Note: Shell scripts installed, flavourizing on jails first startup" |
136 | fi | 154 | fi |
137 | 155 | ||
138 | ;; | 156 | ;; |