change jail flag, defaults to enabled
This commit is contained in:
parent
6850a5b6e2
commit
fa65c5dac2
|
@ -13,14 +13,14 @@ help()
|
||||||
thisfilename=$(basename -- "$0")
|
thisfilename=$(basename -- "$0")
|
||||||
echo "Add virtualhost to this server, including shell user and MySQL database."
|
echo "Add virtualhost to this server, including shell user and MySQL database."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -d <domain> [-u <username>] [-p <password>] [-x <fpmmax>] [-j] [-w] [-h]"
|
echo "usage: $thisfilename -d <domain> [-u <username>] [-p <password>] [-x <fpmmax>] [-j <0|1>] [-w] [-h]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h Print this help."
|
echo " -h Print this help."
|
||||||
echo " -d <domain> Domain name of VirtualHost to remove."
|
echo " -d <domain> Domain name of VirtualHost to remove."
|
||||||
echo " -u <username> Username to use for this virtualhost. Optional, defaults to first 8 alphanumeric characters of virtualhost."
|
echo " -u <username> Username to use for this virtualhost. Optional, defaults to first 8 alphanumeric characters of virtualhost."
|
||||||
echo " -p <password> Password for username. Optional, random password generated if none specified."
|
echo " -p <password> Password for username. Optional, random password generated if none specified."
|
||||||
echo " -x <fpmmax> PHP-FPM pm.max_children. Optional, defaults to 4, recommended range 2-12 on Shared Server."
|
echo " -x <fpmmax> PHP-FPM pm.max_children. Optional, defaults to 4, recommended range 2-12 on Shared Server."
|
||||||
echo " -j Whether or not to jail the user. Optional, default is to not jail user."
|
echo " -j <0|1> Whether or not to jail the user. 0 = no, 1 = yes. Default is 1, which can be overriden in main config."
|
||||||
echo " -w Write user & mysql info to files."
|
echo " -w Write user & mysql info to files."
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,12 @@ if ! grep -q "^$username:" /etc/passwd; then
|
||||||
else
|
else
|
||||||
/usr/local/bin/vhost-user-add.sh -u $username -p "$password" -x $fpmmax
|
/usr/local/bin/vhost-user-add.sh -u $username -p "$password" -x $fpmmax
|
||||||
fi
|
fi
|
||||||
# if jail option is set then jail user
|
# check for and set jail option
|
||||||
if [[ -n $jail ]]; then
|
if [[ -z $jail ]]; then
|
||||||
|
jail=$JAIL_USER
|
||||||
|
fi
|
||||||
|
# if jail option is yes (1) then jail user
|
||||||
|
if [[ $jail == 1 ]]; then
|
||||||
# job is run in the background as it can take about 1 minute to complete
|
# job is run in the background as it can take about 1 minute to complete
|
||||||
/usr/local/bin/vhost-user-jail.sh -u $username >/dev/null 2>/dev/null &
|
/usr/local/bin/vhost-user-jail.sh -u $username >/dev/null 2>/dev/null &
|
||||||
# pause to give above script time to create jail home dir which is used by vhost-add.sh below
|
# pause to give above script time to create jail home dir which is used by vhost-add.sh below
|
||||||
|
|
|
@ -13,6 +13,7 @@ fi
|
||||||
# constants
|
# constants
|
||||||
|
|
||||||
FPM_MAX=4
|
FPM_MAX=4
|
||||||
|
JAIL_USER=1
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
|
|
||||||
|
@ -87,8 +88,12 @@ function vhost:getoptions () {
|
||||||
u ) # username
|
u ) # username
|
||||||
username=${OPTARG,,}
|
username=${OPTARG,,}
|
||||||
;;
|
;;
|
||||||
j ) # jail - if enabled user will be jailed
|
j ) # jail - Whether or not to jail the user. 0 = no, 1 = yes.
|
||||||
jail=true
|
jail=${OPTARG}
|
||||||
|
if [[ $jail != "0" ]] && [[ $jail != "1" ]]; then
|
||||||
|
echo "ERROR: Invalid jail setting: -j $jail."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
n ) # dry-run
|
n ) # dry-run
|
||||||
dryrun=true
|
dryrun=true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user