diff options
-rwxr-xr-x | ezjail-admin | 12 | ||||
-rwxr-xr-x | ezjail.sh | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/ezjail-admin b/ezjail-admin index b6cb4e7..75258e8 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -74,7 +74,7 @@ create) | |||
74 | args=`getopt f:r:s:xic $*` || exerr "Usage: `basename -- $0` create [-f flavour] [-r jailroot] [-s size] [-xic] jailname jailip" | 74 | args=`getopt f:r:s:xic $*` || exerr "Usage: `basename -- $0` create [-f flavour] [-r jailroot] [-s size] [-xic] jailname jailip" |
75 | 75 | ||
76 | # Clean variables, prevent polution | 76 | # Clean variables, prevent polution |
77 | unset ezjail_rootdir ezjail_flavour ezjail_softlink ezjail_image ezjail_lock ezjail_imagetype ezjail_imagesize ezjail_device ezjail_config | 77 | unset ezjail_rootdir ezjail_flavour ezjail_softlink ezjail_image ezjail_imagetype ezjail_imagesize ezjail_device ezjail_config |
78 | ezjail_fillme="YES" | 78 | ezjail_fillme="YES" |
79 | 79 | ||
80 | set -- ${args} | 80 | set -- ${args} |
@@ -150,14 +150,12 @@ create) | |||
150 | ezjail_image=${ezjail_rootdir%/}; while [ "${ezjail_image}" -a -z "${ezjail_image%%*/}" ]; do ezjail_image=${ezjail_image%/}; done | 150 | ezjail_image=${ezjail_rootdir%/}; while [ "${ezjail_image}" -a -z "${ezjail_image%%*/}" ]; do ezjail_image=${ezjail_image%/}; done |
151 | [ -z "${ezjail_image}" ] && exerr "Error: Could not determine image file name, something is wrong with the jail root: ${ezjail_rootdir}." | 151 | [ -z "${ezjail_image}" ] && exerr "Error: Could not determine image file name, something is wrong with the jail root: ${ezjail_rootdir}." |
152 | 152 | ||
153 | # Location of our image and crypto image lock file | 153 | # Location of our image file |
154 | ezjail_lock=${ezjail_image}.lock | ||
155 | ezjail_image=${ezjail_image}.img | 154 | ezjail_image=${ezjail_image}.img |
156 | 155 | ||
157 | # If NOT exist, create image | 156 | # If NOT exist, create image |
158 | if [ "${ezjail_fillme}" = "YES" ]; then | 157 | if [ "${ezjail_fillme}" = "YES" ]; then |
159 | [ -e "${ezjail_image}" ] && exerr "Error: a file exists at the location ${ezjail_image}, preventing our own image file to be created." | 158 | [ -e "${ezjail_image}" ] && exerr "Error: a file exists at the location ${ezjail_image}, preventing our own image file to be created." |
160 | [ "${ezjail_imagetype}" = "crypto" -a -e "${ezjail_lock}" ] && exerr "Error: a file exists at the location ${ezjail_lock}, preventing our own crypto image lock file to be created." | ||
161 | 159 | ||
162 | # Now create jail disc image | 160 | # Now create jail disc image |
163 | touch "${ezjail_image}" | 161 | touch "${ezjail_image}" |
@@ -170,10 +168,10 @@ create) | |||
170 | if [ "${ezjail_imagetype}" = "crypto" ]; then | 168 | if [ "${ezjail_imagetype}" = "crypto" ]; then |
171 | # Initialise crypto image | 169 | # Initialise crypto image |
172 | echo "Initialising crypto device. Enter a new passphrase twice..." | 170 | echo "Initialising crypto device. Enter a new passphrase twice..." |
173 | gbde init /dev/${ezjail_imagedevice} -L ${ezjail_lock} || detach_images || exerr "Error: Could not initialise crypto image." | 171 | gbde init /dev/${ezjail_imagedevice} || detach_images || exerr "Error: Could not initialise crypto image." |
174 | 172 | ||
175 | echo "Attaching crypto device. Enter the passphrase..." | 173 | echo "Attaching crypto device. Enter the passphrase..." |
176 | gbde attach /dev/${ezjail_imagedevice} -l ${ezjail_lock} || detach_images || exerr "Error: Could not attach crypto image." | 174 | gbde attach /dev/${ezjail_imagedevice} || detach_images || exerr "Error: Could not attach crypto image." |
177 | ezjail_device=${ezjail_imagedevice}.bde | 175 | ezjail_device=${ezjail_imagedevice}.bde |
178 | else | 176 | else |
179 | ezjail_device=${ezjail_imagedevice} | 177 | ezjail_device=${ezjail_imagedevice} |
@@ -296,7 +294,7 @@ delete) | |||
296 | 294 | ||
297 | # if wiping the jail was requested, remove it | 295 | # if wiping the jail was requested, remove it |
298 | if [ "${ezjail_wipeme}" ]; then | 296 | if [ "${ezjail_wipeme}" ]; then |
299 | [ "${ezjail_image}" ] && rm -f ${ezjail_image} ${ezjail_image%.img}.lock ${ezjail_image%.img}.device | 297 | [ "${ezjail_image}" ] && rm -f ${ezjail_image} ${ezjail_image%.img}.device |
300 | rm -rf ${ezjail_rootdir} | 298 | rm -rf ${ezjail_rootdir} |
301 | fi | 299 | fi |
302 | 300 | ||
@@ -97,7 +97,7 @@ attach_detach_pre () | |||
97 | # this is. In this case, the device to mount is | 97 | # this is. In this case, the device to mount is |
98 | if [ "${ezjail_imagetype}" = "crypto" ]; then | 98 | if [ "${ezjail_imagetype}" = "crypto" ]; then |
99 | echo "Attaching gbde device for image jail ${ezjail}..." | 99 | echo "Attaching gbde device for image jail ${ezjail}..." |
100 | gbde attach /dev/${ezjail_device} -l ${ezjail_image%.img}.lock | 100 | gbde attach /dev/${ezjail_device} |
101 | 101 | ||
102 | # Device to mount is not md anymore | 102 | # Device to mount is not md anymore |
103 | ezjail_device=${ezjail_device}.bde | 103 | ezjail_device=${ezjail_device}.bde |