user permissions checks

This commit is contained in:
Matthew Saunders Brown 2021-03-19 11:58:35 -07:00
parent 50dc67106d
commit 9b5c51bcc9
20 changed files with 25 additions and 20 deletions

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
# check for and set virtualhost # check for and set virtualhost
if [ -n "$1" ]; then if [ -n "$1" ]; then

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
# check for and set virtualhost # check for and set virtualhost
if [ -n "$1" ]; then if [ -n "$1" ]; then

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
# check for and set virtualhost # check for and set virtualhost
if [ -n "$1" ]; then if [ -n "$1" ]; then

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
help() help()
{ {

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /usr/local/etc/vmail.conf source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
# only continue if vmail dir exists # only continue if vmail dir exists
if [ -d $VMAIL_DIR ]; then if [ -d $VMAIL_DIR ]; then

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /opt/stack/include/config.inc source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
# check for and set virtualhost # check for and set virtualhost
if [ -n "$1" ]; then if [ -n "$1" ]; then

View File

@ -5,7 +5,7 @@
# MIT License Copyright (c) 2021 Matthew Saunders Brown # MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config # load config
source /opt/stack/include/config.inc source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
# check for and set virtualhost # check for and set virtualhost
if [ -n "$1" ]; then if [ -n "$1" ]; then

View File

@ -6,11 +6,16 @@ if [ "$USER" != "vmail" ]; then
fi fi
# constants # constants
readonly MYSQL_CONNECTION_INFO_FILE=/usr/local/etc/vmail-db-info.conf readonly MYSQL_CONNECTION_INFO_FILE=/usr/local/etc/vmail-db-info.conf
readonly VMAIL_DIR=/var/vmail readonly VMAIL_DIR=/var/vmail
readonly VMAIL_DB=vmail readonly VMAIL_DB=vmail
# check that MYSQL_CONNECTION_INFO_FILE exists and is readable
if [ ! -f "$MYSQL_CONNECTION_INFO_FILE" ]; then
echo "ERROR: MySQL connection info file ($MYSQL_CONNECTION_INFO_FILE) does not exist or is not readable."
exit
fi
# functions # functions
# crude but good enough domain name format validation # crude but good enough domain name format validation