Add local dir for surcharge default templates files
This commit is contained in:
parent
f945ad2b2c
commit
031723d26a
19
bkctld
19
bkctld
|
@ -172,6 +172,12 @@ set_firewall() {
|
||||||
|
|
||||||
mk_jail() {
|
mk_jail() {
|
||||||
jail=$1
|
jail=$1
|
||||||
|
passwd="${TPLDIR}/passwd"
|
||||||
|
shadow="${TPLDIR}/shadow"
|
||||||
|
group="${TPLDIR}/group"
|
||||||
|
[ -f "${LOCALTPLDIR}/passwd" ] && passwd="${LOCALTPLDIR}/passwd"
|
||||||
|
[ -f "${LOCALTPLDIR}/shadow" ] && shadow="${LOCALTPLDIR}/shadow"
|
||||||
|
[ -f "${LOCALTPLDIR}/group" ] && group="${LOCALTPLDIR}/group"
|
||||||
umask 022
|
umask 022
|
||||||
|
|
||||||
echo -n "1 - Creating the chroot..."
|
echo -n "1 - Creating the chroot..."
|
||||||
|
@ -188,7 +194,9 @@ mk_jail() {
|
||||||
echo -n "2 - Copying essential files..."
|
echo -n "2 - Copying essential files..."
|
||||||
cp /proc/devices ${JAILDIR}/${jail}/proc
|
cp /proc/devices ${JAILDIR}/${jail}/proc
|
||||||
cp /etc/ssh/{ssh_host_rsa_key,ssh_host_dsa_key} ${JAILDIR}/${jail}/etc/ssh/
|
cp /etc/ssh/{ssh_host_rsa_key,ssh_host_dsa_key} ${JAILDIR}/${jail}/etc/ssh/
|
||||||
cp ${TPLDIR}/{passwd,shadow,group} ${JAILDIR}/${jail}/etc/
|
cp $passwd ${JAILDIR}/${jail}/etc/
|
||||||
|
cp $shadow ${JAILDIR}/${jail}/etc/
|
||||||
|
cp $group ${JAILDIR}/${jail}/etc/
|
||||||
echo "...OK"
|
echo "...OK"
|
||||||
|
|
||||||
echo -n "3 - Copying binaries..."
|
echo -n "3 - Copying binaries..."
|
||||||
|
@ -208,6 +216,10 @@ mk_jail() {
|
||||||
|
|
||||||
sub_init() {
|
sub_init() {
|
||||||
jail=$1
|
jail=$1
|
||||||
|
sshd_config="${TPLDIR}/sshd_config"
|
||||||
|
inctpl="${TPLDIR}/inc.tpl"
|
||||||
|
[ -f "${LOCALTPLDIR}/sshd_config" ] && sshd_config="${LOCALTPLDIR}/sshd_config"
|
||||||
|
[ -f "${LOCALTPLDIR}/inc.tpl" ] && inctpl="${LOCALTPLDIR}/inc.tpl"
|
||||||
if ( check_jail $jail ); then
|
if ( check_jail $jail ); then
|
||||||
echo "Jail $jail already exist ! Use '$0 update $jail' for update it" >&2
|
echo "Jail $jail already exist ! Use '$0 update $jail' for update it" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -221,13 +233,13 @@ sub_init() {
|
||||||
fi
|
fi
|
||||||
mk_jail $jail
|
mk_jail $jail
|
||||||
echo -n "4 - Copie default sshd_config..."
|
echo -n "4 - Copie default sshd_config..."
|
||||||
install -m 0640 ${TPLDIR}/sshd_config ${JAILDIR}/$jail/${SSHD_CONFIG}
|
install -m 0640 $sshd_config ${JAILDIR}/$jail/${SSHD_CONFIG}
|
||||||
echo "...OK"
|
echo "...OK"
|
||||||
echo -n "5 - Set usable sshd port..."
|
echo -n "5 - Set usable sshd port..."
|
||||||
set_port $jail auto
|
set_port $jail auto
|
||||||
echo "...OK"
|
echo "...OK"
|
||||||
echo -n "6 - Copie default inc configuration..."
|
echo -n "6 - Copie default inc configuration..."
|
||||||
install -m 0640 ${TPLDIR}/inc.tpl ${CONFDIR}/$jail
|
install -m 0640 $inctpl ${CONFDIR}/$jail
|
||||||
echo "...OK"
|
echo "...OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,6 +531,7 @@ main() {
|
||||||
[ -z "${JAILDIR}" ] && JAILDIR='/backup/jails'
|
[ -z "${JAILDIR}" ] && JAILDIR='/backup/jails'
|
||||||
[ -z "${INCDIR}" ] && INCDIR='/backup/incs'
|
[ -z "${INCDIR}" ] && INCDIR='/backup/incs'
|
||||||
[ -z "${TPLDIR}" ] && TPLDIR='/usr/share/bkctld'
|
[ -z "${TPLDIR}" ] && TPLDIR='/usr/share/bkctld'
|
||||||
|
[ -z "${LOCALTPLDIR}" ] && LOCALTPLDIR='/usr/local/share/bkctld'
|
||||||
[ -z "${LOG_DIR}" ] && LOG_DIR='/var/log'
|
[ -z "${LOG_DIR}" ] && LOG_DIR='/var/log'
|
||||||
[ -z "${SSHD_PID}" ] && SSHD_PID='/var/run/sshd.pid'
|
[ -z "${SSHD_PID}" ] && SSHD_PID='/var/run/sshd.pid'
|
||||||
[ -z "${SSHD_CONFIG}" ] && SSHD_CONFIG='/etc/ssh/sshd_config'
|
[ -z "${SSHD_CONFIG}" ] && SSHD_CONFIG='/etc/ssh/sshd_config'
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#JAILDIR='/backup/jails'
|
#JAILDIR='/backup/jails'
|
||||||
#INCDIR='/backup/incs'
|
#INCDIR='/backup/incs'
|
||||||
#TPLDIR='/usr/share/bkctld'
|
#TPLDIR='/usr/share/bkctld'
|
||||||
|
#LOCALTPLDIR='/usr/local/share/bkctld'
|
||||||
#LOG_DIR='/var/log'
|
#LOG_DIR='/var/log'
|
||||||
#SSHD_PID='/var/run/sshd.pid'
|
#SSHD_PID='/var/run/sshd.pid'
|
||||||
#SSHD_CONFIG='/etc/ssh/sshd_config'
|
#SSHD_CONFIG='/etc/ssh/sshd_config'
|
||||||
|
|
|
@ -130,6 +130,14 @@ Dir where jail template file is stored.
|
||||||
default : /usr/share/bkctld
|
default : /usr/share/bkctld
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
LOCALTPLDIR
|
||||||
|
.RS 4
|
||||||
|
Dir for surcharge jail templates.
|
||||||
|
.RE
|
||||||
|
.RS 4
|
||||||
|
default : /usr/local/share/bkctld
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
LOG_DIR
|
LOG_DIR
|
||||||
.RS 4
|
.RS 4
|
||||||
Emplacement of log directory.
|
Emplacement of log directory.
|
||||||
|
@ -194,7 +202,7 @@ Keep the incremental backup of the first january
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
.PP
|
.PP
|
||||||
Default value : keep incremental of last 4 days and last 2 months. Change default in $TPLDIR/inc.tpl.
|
Default value : keep incremental of last 4 days and last 2 months. Change default in $LOCALTPLDIR/inc.tpl.
|
||||||
|
|
||||||
+%Y-%m-%d.-0day
|
+%Y-%m-%d.-0day
|
||||||
+%Y-%m-%d.-1day
|
+%Y-%m-%d.-1day
|
||||||
|
|
Loading…
Reference in a new issue