Add local dir for surcharge default templates files

This commit is contained in:
Victor LABORIE 2017-02-17 12:53:39 +01:00
parent f945ad2b2c
commit 031723d26a
3 changed files with 26 additions and 4 deletions

19
bkctld
View file

@ -172,6 +172,12 @@ set_firewall() {
mk_jail() {
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
echo -n "1 - Creating the chroot..."
@ -188,7 +194,9 @@ mk_jail() {
echo -n "2 - Copying essential files..."
cp /proc/devices ${JAILDIR}/${jail}/proc
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 -n "3 - Copying binaries..."
@ -208,6 +216,10 @@ mk_jail() {
sub_init() {
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
echo "Jail $jail already exist ! Use '$0 update $jail' for update it" >&2
exit 1
@ -221,13 +233,13 @@ sub_init() {
fi
mk_jail $jail
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 -n "5 - Set usable sshd port..."
set_port $jail auto
echo "...OK"
echo -n "6 - Copie default inc configuration..."
install -m 0640 ${TPLDIR}/inc.tpl ${CONFDIR}/$jail
install -m 0640 $inctpl ${CONFDIR}/$jail
echo "...OK"
}
@ -519,6 +531,7 @@ main() {
[ -z "${JAILDIR}" ] && JAILDIR='/backup/jails'
[ -z "${INCDIR}" ] && INCDIR='/backup/incs'
[ -z "${TPLDIR}" ] && TPLDIR='/usr/share/bkctld'
[ -z "${LOCALTPLDIR}" ] && LOCALTPLDIR='/usr/local/share/bkctld'
[ -z "${LOG_DIR}" ] && LOG_DIR='/var/log'
[ -z "${SSHD_PID}" ] && SSHD_PID='/var/run/sshd.pid'
[ -z "${SSHD_CONFIG}" ] && SSHD_CONFIG='/etc/ssh/sshd_config'

View file

@ -5,6 +5,7 @@
#JAILDIR='/backup/jails'
#INCDIR='/backup/incs'
#TPLDIR='/usr/share/bkctld'
#LOCALTPLDIR='/usr/local/share/bkctld'
#LOG_DIR='/var/log'
#SSHD_PID='/var/run/sshd.pid'
#SSHD_CONFIG='/etc/ssh/sshd_config'

View file

@ -130,6 +130,14 @@ Dir where jail template file is stored.
default : /usr/share/bkctld
.RE
.PP
LOCALTPLDIR
.RS 4
Dir for surcharge jail templates.
.RE
.RS 4
default : /usr/local/share/bkctld
.RE
.PP
LOG_DIR
.RS 4
Emplacement of log directory.
@ -194,7 +202,7 @@ Keep the incremental backup of the first january
.RE
.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.-1day