summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2005-09-25 11:57:21 +0000
committererdgeist <erdgeist@erdgeist.org>2005-09-25 11:57:21 +0000
commit2fcd7f1a76faa37b6cf8827dfee9875f041c8dd9 (patch)
tree6b6bdd73fa887ac5556dd128d6a100d9bdd84d19
parenteba8f0e8c2427e0dc8d48814ea0bcfd6b238e4d0 (diff)
delete implemented, permissions changed, root permissions no longer necessary to start script, it will run into problems early enuogh
-rwxr-xr-xMakefile2
-rwxr-xr-xezjail-admin36
2 files changed, 29 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 5b72f62..6fbe633 100755
--- a/Makefile
+++ b/Makefile
@@ -8,5 +8,5 @@ install:
8 sed s:EZJAIL_PREFIX:${PREFIX}: man1/ezjail-admin.1 > ${PREFIX}/man/man1/ezjail-admin.1 8 sed s:EZJAIL_PREFIX:${PREFIX}: man1/ezjail-admin.1 > ${PREFIX}/man/man1/ezjail-admin.1
9 sed s:EZJAIL_PREFIX:${PREFIX}: man5/ezjail.conf.5 > ${PREFIX}/man/man5/ezjail.conf.5 9 sed s:EZJAIL_PREFIX:${PREFIX}: man5/ezjail.conf.5 > ${PREFIX}/man/man5/ezjail.conf.5
10 sed s:EZJAIL_PREFIX:${PREFIX}: man5/ezjail.5 > ${PREFIX}/man/man5/ezjail.5 10 sed s:EZJAIL_PREFIX:${PREFIX}: man5/ezjail.5 > ${PREFIX}/man/man5/ezjail.5
11 chmod 744 ${PREFIX}/etc/rc.d/ezjail ${PREFIX}/bin/ezjail-admin 11 chmod 755 ${PREFIX}/etc/rc.d/ezjail ${PREFIX}/bin/ezjail-admin
12 chown root:wheel ${PREFIX}/man/man1/ezjail-admin.1 ${PREFIX}/man/man5/ezjail.conf.5 ${PREFIX}/man/man5/ezjail.5 12 chown root:wheel ${PREFIX}/man/man1/ezjail-admin.1 ${PREFIX}/man/man5/ezjail.conf.5 ${PREFIX}/man/man5/ezjail.5
diff --git a/ezjail-admin b/ezjail-admin
index c09142e..f1db4dd 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -4,10 +4,6 @@
4ezjail_prefix=EZJAIL_PREFIX 4ezjail_prefix=EZJAIL_PREFIX
5ezjail_jailcfgs=${ezjail_prefix}/etc/ezjail 5ezjail_jailcfgs=${ezjail_prefix}/etc/ezjail
6 6
7if [ "0" != "`id -u`" ]; then
8 echo "Retry as root"; exit 1;
9fi
10
11if [ -f ${ezjail_prefix}/etc/ezjail.conf ]; then 7if [ -f ${ezjail_prefix}/etc/ezjail.conf ]; then
12 . ${ezjail_prefix}/etc/ezjail.conf; 8 . ${ezjail_prefix}/etc/ezjail.conf;
13fi 9fi
@@ -71,7 +67,7 @@ create)
71 # name will be foo_com in most scripts 67 # name will be foo_com in most scripts
72 newjail_name=`echo $newjail_name | tr /~ __`; 68 newjail_name=`echo $newjail_name | tr /~ __`;
73 newjail_root=${newjail_root:-"$ezjail_jaildir/$newjail_name"} 69 newjail_root=${newjail_root:-"$ezjail_jaildir/$newjail_name"}
74 newjail_nname=`echo $newjail_name | tr . _`; 70 newjail_nname=`echo $newjail_nname | tr . _`;
75 71
76 # if jail root specified on command line is not absolute, 72 # if jail root specified on command line is not absolute,
77 # make it absolute inside our jail directory 73 # make it absolute inside our jail directory
@@ -142,17 +138,41 @@ delete)
142 echo 'Usage: ezjail delete [-w] jailname'; exit 1; 138 echo 'Usage: ezjail delete [-w] jailname'; exit 1;
143 fi 139 fi
144 140
141 # tidy up jail name the ezjail way
142 oldjail_nname=`echo $oldjail_name | tr /~. ___`;
143
145 # check for existence of jail in our records 144 # check for existence of jail in our records
146 if [ ! -f ${ezjail_jailcfgs}/${oldjail_name} ]; then 145 if [ ! -f ${ezjail_jailcfgs}/${oldjail_nname} ]; then
147 echo 'Error: Nothing known about jail $oldjail_name'; exit 1 146 echo 'Error: Nothing known about jail $oldjail_name'; exit 1
148 fi 147 fi
149 148
150 . ${ezjail_jailcfgs}/${oldjail_name} 149 # fetch information about the jail to be gone
151 eval jail_root=\"\$jail_${jail}_root\" 150 # by parsing our records
151 . ${ezjail_jailcfgs}/${oldjail_nname}
152 eval oldjail_root=\"\$jail_${oldjail_nname}_root\"
153
154 # now we know everything we need to let the jail be gone
155 # remove entry from ezjail resource structure
156 echo rm -f ${ezjail_jailcfgs}/${oldjail_nname}
157
158 # delete fstab.JAILNAME
159 echo rm -f /etc/fstab.$oldjail_nname
160
161 # if there is a soft link pointing to the jail root, remove it
162 oldjail_softlink=$ezjail_jaildir/`basename $oldjail_root`
163 if [ -L $oldjail_softlink ]; then
164 echo rm $oldjail_softlink
165 fi
166
167 # if wiping the jail was requested, remove it
168 if [ $oldjail_wipe = "YES" ]; then
169 echo rm -rf $oldjail_root
170 fi
152 171
153 ;; 172 ;;
154list) 173list)
155 jail_list=`ls $ezjail_jailcfgs` 174 jail_list=`ls $ezjail_jailcfgs`
175echo $jail_list
156 for jail in $jail_list; do 176 for jail in $jail_list; do
157 . ${ezjail_jailcfgs}/$jail 177 . ${ezjail_jailcfgs}/$jail
158 eval jail_ip=\"\$jail_${jail}_ip\"; echo -n "$jail_ip " 178 eval jail_ip=\"\$jail_${jail}_ip\"; echo -n "$jail_ip "