Start of default config sub system
This commit is contained in:
parent
6ca864f125
commit
cb9940f734
43
ezjail-config.sh
Normal file
43
ezjail-config.sh
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -f /etc/ezjail.template ]; then
|
||||||
|
. /etc/ezjail.template
|
||||||
|
|
||||||
|
# we do need to install only once
|
||||||
|
# rm /etc/ezjail.template
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set defaults
|
||||||
|
ezjail_template_root=${ezjail_template_root:-"/basejail/config/_JAILNAME_"}
|
||||||
|
ezjail_template_files=${ezjail_template_files:-""}
|
||||||
|
ezjail_template_users=${ezjail_template_users:-""}
|
||||||
|
ezjail_template_packages=${ezjail_template_packages:-""}
|
||||||
|
|
||||||
|
# try to create users
|
||||||
|
for user in $ezjail_template_users; do
|
||||||
|
TIFS=$IFS; IFS=:; set -- $user; IFS=$TIFS
|
||||||
|
if [ $# -eq 7 ]; then
|
||||||
|
name=$1; grouplist=$3; gidlist=$4
|
||||||
|
|
||||||
|
[ $2 ] && uid="-u $2" || uid=""
|
||||||
|
[ $5 ] && pass=$5 || pass="*"
|
||||||
|
[ $6 ] && home=$6
|
||||||
|
[ $7 ] && shell="-s $7"
|
||||||
|
|
||||||
|
[ x$6 = x${6#-} ] && mkhome="-r" || mkhome=""; home=${6#-}
|
||||||
|
[ $home ] && home="-h $home";
|
||||||
|
|
||||||
|
if [ $grouplist ]; then
|
||||||
|
gc=1
|
||||||
|
for $group in `echo $grouplist | tr "," " "`; do
|
||||||
|
gid=`echo $gidlist | cut -d , -f $gc`; [ $gid ] && gid="-n $gid"
|
||||||
|
echo pw groupadd -n $group $gid
|
||||||
|
gc=(($gc + 1))
|
||||||
|
done
|
||||||
|
endif
|
||||||
|
if [ $name ]; then
|
||||||
|
echo pw useradd $name $uid $shell $home $grouplist
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
36
ezjail.template
Normal file
36
ezjail.template
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# ezjail template example
|
||||||
|
# refer to ezjail(5) for more information
|
||||||
|
#
|
||||||
|
# ezjails jail init script tries to create the following users. Format is
|
||||||
|
# as follows:
|
||||||
|
#
|
||||||
|
# username:<uid>:group[,group,...]:<gid[,gid,...]>:cryptpw:[-]homedir:shell
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# ezjail_template_users=\
|
||||||
|
# "admin::wheel::$1$p75bbfK.$Kz3dwkoVlgZrfLZdAXQt91:/home/admin:/bin/sh \
|
||||||
|
# pgsql:1002:pgsql:1002:*:-/usr/local/psql:/bin/nologin \
|
||||||
|
# ::heroes:1003::::"
|
||||||
|
|
||||||
|
# ezjails init script tries to install all files listed here from the path
|
||||||
|
# specified in the ezjail_template_root variable root to the corresponding
|
||||||
|
# location inside the jail. Directories are being copied recursive. Format
|
||||||
|
# is as follows:
|
||||||
|
#
|
||||||
|
# user:group:file(s)
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# ezjail_template_root=/basejail/config/_JAILNAME_
|
||||||
|
# ezjail_template_files=\
|
||||||
|
# "root:wheel:/etc/{resolv,rc,make}.conf \
|
||||||
|
# admin:wheel:/home/admin/"
|
||||||
|
|
||||||
|
# ezjails jail init script tries to install packages specified in the
|
||||||
|
# ezjail_template_packages variable. All packages without an absolute
|
||||||
|
# path are assumed to be located in /basejail/config/pkg
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# ezjail_template_packages="sudo-1.6.8.9.tbz pico-4.64.tbz"
|
Loading…
x
Reference in New Issue
Block a user