Updated repo to reflect compatability with iRedMail 1.3.1, script uniformity updates, bug fixes
This commit is contained in:
parent
b3d3459cf3
commit
0180177c42
|
@ -1,4 +1,4 @@
|
|||
| iRedMail version compatibility | 1.2.1 |
|
||||
| iRedMail version compatibility | 1.3.1 |
|
||||
| ------------- | ------------- |
|
||||
|
||||
Administrative scripts for iRedMail, useful if you do not use iRedAdmin, or you do not have iRedAdmin Pro.
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -32,4 +32,4 @@ if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; th
|
|||
exit 0
|
||||
fi
|
||||
|
||||
printf "INSERT INTO domain VALUES domain = '$domain' AND active ='1';\n"
|
||||
printf "INSERT INTO domain (domain, active) VALUES ('${domain}', 1); \n"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -29,6 +29,7 @@ sendToEmail="$2"
|
|||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
printf "Purpose: Add a user to an alias in iRedmail. \n"
|
||||
printf "Note: The alias needs to exist first before you can add users to it. \n"
|
||||
printf "Usage: sh add-user-to-alias.sh alias@mydomain.com jeff@gmail.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -18,17 +18,19 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
dlName="$1"
|
||||
domainName="$2"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Creates an alias in iRedmail, email sent to an alias goes to all addresses added onto the alias. \n"
|
||||
printf "Usage: sh create-alias.sh alias@mydomain.com mydomain.com \n"
|
||||
printf "Usage: sh create-alias.sh alias@mydomain.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "INSERT INTO alias (address, domain, active) VALUES ('${dlName}', '${domainName}', 1); \n"
|
||||
domain=$(echo $dlName | cut -f 2 -d '@')
|
||||
|
||||
printf "INSERT INTO alias (address, domain, active) VALUES ('${dlName}', '${domain}', 1); \n"
|
||||
printf "UPDATE domain SET aliases = aliases + 1 WHERE domain = '${domain}';\n"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/create-new-user-bulk.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/create-new-user-bulk.sql;
|
||||
#
|
||||
# --------- CHANGE THESE VALUES ----------
|
||||
|
@ -78,11 +78,11 @@ get_script_dir() {
|
|||
# Leave here to get scripts running location
|
||||
get_script_dir
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -lt 1 ]; then
|
||||
echo "The CSV file used must have the format of email address,full name,password. Example: jeff@example.com,Jeff Gretzky,12345678"
|
||||
echo "Invalid command arguments. Usage:"
|
||||
echo "bash create-new-user-bulk.sh new-users.csv"
|
||||
exit 255
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
echo "Purpose: Bulk creation of new user accounts in iRedmail setup with an SQL backend."
|
||||
echo "Note: The CSV file used must have the format of email address,full name,password. Example: jeff@example.com,Jeff Gretzky,12345678"
|
||||
echo "Usage: bash create-new-user-bulk.sh new-users.csv"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Time stamp, will be appended in maildir.
|
||||
|
@ -149,6 +149,8 @@ while read csv; do
|
|||
done
|
||||
fi
|
||||
|
||||
printf "UPDATE domain SET mailboxes = mailboxes + 1 WHERE domain = '${domain}';\n"
|
||||
|
||||
count=`expr $count + 1`
|
||||
done < "$1"
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# --------- CHANGE THESE VALUES ----------
|
||||
|
@ -37,7 +37,7 @@ STORAGE_BASE_DIRECTORY="/var/vmail/vmail1"
|
|||
#
|
||||
# Password scheme. Available schemes: BCRYPT, SSHA512, SSHA, MD5, NTLM, PLAIN.
|
||||
# Check file Available
|
||||
PASSWORD_SCHEME='BCRYPT'
|
||||
PASSWORD_SCHEME='SSHA512'
|
||||
|
||||
# Default mail quota (in MB).
|
||||
DEFAULT_QUOTA='1024'
|
||||
|
@ -59,10 +59,10 @@ ALIAS_ARRAY=("")
|
|||
# Default hash level is 3.
|
||||
MAILDIR_STYLE='hashed' # hashed, normal.
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -lt 2 ]; then
|
||||
echo "Invalid command arguments. Usage:"
|
||||
echo "bash create-new-user.sh user@example.com plain_password"
|
||||
exit 255
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
echo "Purpose: Create a new user account in iRedmail setup with an SQL backend."
|
||||
echo "Usage: bash create-new-user.sh user@example.com plain_password"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Time stamp, will be appended in maildir.
|
||||
|
@ -124,3 +124,4 @@ if [ ! -z "$ALIAS_ARRAY" ]; then
|
|||
done
|
||||
fi
|
||||
|
||||
printf "UPDATE domain SET mailboxes = mailboxes + 1 WHERE domain = '${domain}';\n"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -30,6 +30,7 @@ domain="$1"
|
|||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Disables enablepop3,enablepop3secured,enablepop3tls in the mailbox table for a given domain to be 0 (disabled) in iRedmail so to disable pop3. \n"
|
||||
printf "Note: This is a one time change for all CURRENT user accounts, future accounts require the use of disable-pop3-for-user.sh to disable pop3 for an individual account. \n"
|
||||
printf "Usage: sh disable-pop3-for-domain.sh example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
domain="$1"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Re-enables a disabled domain in iRedMail. \n"
|
||||
printf "Purpose: Re-enable a disabled domain in iRedMail. \n"
|
||||
printf "Usage: sh enable-domain.sh example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -30,6 +30,7 @@ domain="$1"
|
|||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Enables enablepop3,enablepop3secured,enablepop3tls in the mailbox table for a given domain to be 1 (enabled) in iRedmail so to enable pop3. \n"
|
||||
printf "Note: This is a one time change for all CURRENT user accounts, future accounts require the use of enable-pop3-for-user.sh to disable pop3 for an individual account. \n"
|
||||
printf "Usage: sh enable-pop3-for-domain.sh example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
username="$1"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Re-enables a disabled user account in iRedmail. \n"
|
||||
printf "Purpose: Re-enable a disabled user account in iRedmail. \n"
|
||||
printf "Usage: sh enable-user.sh jeff@example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -27,6 +27,7 @@ address="$1"
|
|||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Determine if a given email address has forwards set from itself to other email addreses in iRedmail. \n"
|
||||
printf "Note: If you see an address to itself in the forwarding column this is normal and is required for a regular account and mailbox to function. \n"
|
||||
printf "Usage: sh is-forward-to.sh jeff@example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -gt 0 ]; then
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -gt 0 ]; then
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -gt 0 ]; then
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -gt 0 ]; then
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -gt 0 ]; then
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -gt 0 ]; then
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -gt 0 ]; then
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
#
|
||||
# Author: Daulton
|
||||
# Website: daulton.ca
|
||||
# Purpose: Creates an alias address which can be used to send email to multiple users at once when they are added 'onto' the alias in iRedmail.
|
||||
# Purpose: Removes an already existing alias in iRedmail.
|
||||
# License: 2-clause BSD license
|
||||
#
|
||||
# Example usage: sh create-dl.sh alias@mydomain.com mydomain.com
|
||||
# Example usage: sh remove-alias.sh alias@mydomain.com
|
||||
#
|
||||
# This will print SQL commands on the console directly, you can redirect the
|
||||
# output to a file for further use like this:
|
||||
#
|
||||
# sh create-dl.sh alias@mydomain.com mydomain.com > output.sql
|
||||
# sh remove-alias.sh alias@mydomain.com > output.sql
|
||||
#
|
||||
# Import output.sql into SQL database like below:
|
||||
#
|
||||
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -26,8 +26,11 @@ aliasName="$1"
|
|||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Creates an alias address which can be used to send email to multiple users at once when they are added 'onto' the alias in iRedmail. \n"
|
||||
printf "Usage: \n"
|
||||
printf "Usage: sh remove-alias.sh alias@mydomain.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
domain=$(echo $dlName | cut -f 2 -d '@')
|
||||
|
||||
printf "DELETE from alias WHERE address = '${aliasName}'; \n"
|
||||
printf "UPDATE domain SET aliases = aliases - 1 WHERE domain = '${domain}';\n"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -27,6 +27,7 @@ domain="$1"
|
|||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Remove a domain from iRedMail. This does not remove associates mail accounts or mailboxes. \n"
|
||||
printf "Note: Once the domain is removed from the database, you can they use remove-user.sh script to remove user accounts. \n"
|
||||
printf "Usage: sh remove-domain.sh example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -30,5 +30,8 @@ if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; th
|
|||
exit 0
|
||||
fi
|
||||
|
||||
domain=$(echo $address | cut -f 2 -d '@')
|
||||
|
||||
printf "DELETE from forwardings WHERE address = '${address}' AND forwarding = '${address}'; \n"
|
||||
printf "DELETE from mailbox WHERE username = '${address}'; \n"
|
||||
printf "UPDATE domain SET mailboxes = mailboxes - 1 WHERE domain = '${domain}';\n"
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
address="$1"
|
||||
destinationAddress="$2"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Removes the whole forwarding address and all forwards associated to it in iRedMail. \n"
|
||||
printf "Usage: sh remove-whole-forward.sh contact@mydomain.com \n"
|
||||
exit 0
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
username="$1"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -lt 1 ] || [ $# -gt 1 ]; then
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -lt 1 ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Revokes a users domain administrator permission in iRedMail. \n"
|
||||
printf "Usage: sh revoke-domain-admin.sh user@example.com \n"
|
||||
exit 0
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Author: Daulton
|
||||
# Website: daulton.ca
|
||||
# Purpose: Re-activates, or turns back on, an alias in iRedmail.
|
||||
# Purpose: Re-activates an alias in iRedmail.
|
||||
# License: 2-clause BSD license
|
||||
#
|
||||
# Example usage: sh set-alias-active.sh alias@mydomain.com
|
||||
|
@ -18,14 +18,14 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
aliasName="$1"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Re-activates, or turns back on, an alias in iRedmail. \n"
|
||||
printf "Purpose: Re-activates an alias in iRedmail. \n"
|
||||
printf "Usage: sh set-alias-active.sh alias@mydomain.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
|
|
@ -25,25 +25,26 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Password scheme. Available schemes: BCRYPT, SSHA512, SSHA, MD5, NTLM, PLAIN.
|
||||
# Check file Available
|
||||
PASSWORD_SCHEME='SSHA512'
|
||||
|
||||
# Read input
|
||||
address="$1"
|
||||
password="$2"
|
||||
plain_password="$2"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
printf "Purpose: Updates the password for a user account in iRedmail. \n"
|
||||
printf "Note: You can also use this script to change hashing algorithms. If you made an account with SHA512 but actually wanted bcrypt you can change that by updating the password."
|
||||
printf "Instructions:
|
||||
1) First you must get the hashed password, use the following example. SSHA512 is recommended on Linux systems. BCRYPT is recommended on BSD systems.\n
|
||||
SHA512: doveadm pw -s 'ssha512' -p '123456'
|
||||
bcrypt: doveadm pw -s 'blf-crypt' -p '123456'
|
||||
|
||||
2) Next use the hash with this script to get the SQL required to update the specified user account. Note for bcrypt passwords surround the password with an apostrophe on each side. \n"
|
||||
|
||||
printf "Usage: sh update-account-password.sh jeff@example.com {SSHA512}ZJrxEEz44aTyd/srPRU3RH4zThW4PHFIDSGYyADEE/D3QUyrgWmiKHyajWN2SQA4+VAk6X5ePaqwbMQqqICj3BCnhYgc/SDc \n"
|
||||
printf "Note: Default password scheme is SSHA512, enter a different scheme as the third parameter if you wish to override. Available schemes: BCRYPT, SSHA512, SSHA, MD5, NTLM, PLAIN. \n"
|
||||
printf "Usage: sh update-account-password.sh jeff@example.com Password123 \n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "UPDATE mailbox SET password = '$password' where username = '$address';\n"
|
||||
# Crypt the password given in $2
|
||||
export CRYPT_PASSWD="$(python ./generate_password_hash.py ${PASSWORD_SCHEME} ${plain_password})"
|
||||
|
||||
printf "UPDATE mailbox SET password = '${CRYPT_PASSWD}', passwordlastchange = NOW() WHERE username = '$address';\n"
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
domain="$1"
|
||||
quota="$2"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 1 ]; then
|
||||
printf "Purpose: Updates the default quota for mailbox size for all domains, setting applies to all newly created mailboxes, in iRedmail. \n"
|
||||
printf "Usage: sh update-all-domain-quota.sh 2048 \n"
|
||||
exit 0
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
|
@ -28,6 +28,7 @@ quota="$2"
|
|||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
printf "Purpose: Updates the default quota for mailbox size for a domain in iRedmail. \n"
|
||||
printf "Note: example.com is the name of your domain and 2048 is the new domain quota for NEWLY created mailboxes. \n"
|
||||
printf "Usage: sh update-domain-quota.sh example.com 2048 \n"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -21,17 +21,23 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
current="$1"
|
||||
new="$2"
|
||||
domain="$3"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 3 ]; then
|
||||
printf "Purpose: Updates the storagebasedirectory in iRedmail, this by default is /var/vmail. \n"
|
||||
printf "Usage: sh update-storagebasedirectory.sh /var/vmail /var/someNewLocation \n"
|
||||
printf "Note: This can apply to all user accounts regardless of domain, or you can specify a domain. In the third parameter put ALL for every domain, or list a specific domain. \n"
|
||||
printf "Usage: sh update-storagebasedirectory.sh /var/vmail /var/someNewLocation example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "UPDATE mailbox SET storagebasedirectory = '$new' WHERE storagebasedirectory = '$current';\n"
|
||||
if [ "$domain" = "all" ] || [ "$domain" = "ALL" ]; then
|
||||
printf "UPDATE mailbox SET storagebasedirectory = '$new' WHERE storagebasedirectory = '$current';\n"
|
||||
else
|
||||
printf "UPDATE mailbox SET storagebasedirectory = '$new' WHERE storagebasedirectory = '$current' AND domain = '$domain';\n"
|
||||
fi
|
||||
|
|
|
@ -21,17 +21,23 @@
|
|||
# mysql> USE vmail;
|
||||
# mysql> SOURCE /path/to/output.sql;
|
||||
#
|
||||
# psql -d vmail
|
||||
# psql -U vmailadmin -d vmail
|
||||
# sql> \i /path/to/output.sql;
|
||||
|
||||
# Read input
|
||||
current="$1"
|
||||
new="$2"
|
||||
domain="$3"
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 2 ]; then
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -ne 3 ]; then
|
||||
printf "Purpose: Updates the storagenode in iRedmail, this by default is vmail1. \n"
|
||||
printf "Usage: sh update-storagenode.sh vmail1 vmail2 \n"
|
||||
printf "Note: This can apply to all user accounts regardless of domain, or you can specify a domain. In the third parameter put ALL for every domain, or list a specific domain. \n"
|
||||
printf "Usage: sh update-storagenode.sh vmail1 vmail2 example.com \n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "UPDATE mailbox SET storagenode = '$new' WHERE storagenode = '$current';\n"
|
||||
if [ "$domain" = "all" ] || [ "$domain" = "ALL" ]; then
|
||||
printf "UPDATE mailbox SET storagenode = '$new' WHERE storagenode = '$current';\n"
|
||||
else
|
||||
printf "UPDATE mailbox SET storagenode = '$new' WHERE storagenode = '$current' AND domain = '$domain';\n"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue