Added scripts to enable or disable pop3 for all users of a given domain

This commit is contained in:
daulton 2019-02-26 17:48:06 -06:00
parent 86b4f5cf77
commit 33414554c3
3 changed files with 80 additions and 0 deletions

View file

@ -16,8 +16,10 @@ There are scripts so far to do the following administrative functions:
| | list-inactive-accounts.sh | List inactive user accounts |
| | list-all-but-regular-accounts.sh | Lists all from the forwardings table that are not just regular accounts |
| | enable-pop3-for-user.sh | Enables pop3 for a user account, enables usage of this protocol |
| | enable-pop3-for-domain.sh | Enables pop3 for all accounts on a given domain |
| | enable-imap-for-user.sh | Enables IMAP for a user account, enables usage of this protocol |
| | disable-pop3-for-user.sh | Disables pop3 for a user account, prevents usage of this protocol |
| | disable-pop3-for-domain.sh | Disables pop3 for all accounts on a given domain |
| | disable-imap-for-user.sh | Disables IMAP for a user account, prevents usage of this protocol |
| | increase-mailbox-quota.sh | Increases the mail box quota size for a given user |
| Aliases | | |

View file

@ -0,0 +1,39 @@
#!/bin/sh
#
# Author: Daulton
# Website: daulton.ca
# Purpose: Disables enablepop3,enablepop3secured,enablepop3tls in the mailbox table for a given domain to be 0 (disabled) in iRedmail so to disable pop3.
# License: 2-clause BSD license
# 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.
#
# Usage: sh disable-pop3-for-domain.sh example.com
#
# Note: You can verify if this was successful with the following command:
# select username,domain,enablepop3,enablepop3secured,enablepop3tls FROM mailbox;
#
# This will print SQL commands on the console directly, you can redirect the
# output to a file for further use like this:
#
# sh disable-pop3-for-domain.sh example.com > output.sql
#
# Import output.sql into SQL database like below:
#
# mysql -uroot -p
# mysql> USE vmail;
# mysql> SOURCE /path/to/output.sql;
#
# psql -d vmail
# sql> \i /path/to/output.sql;
# Read input
domain="$1"
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -eq 0 ]; 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 "Usage: sh disable-pop3-for-domain.sh example.com \n"
exit 0
fi
printf "UPDATE mailbox SET enablepop3 = '0' WHERE domain = '$domain';\n"
printf "UPDATE mailbox SET enablepop3secured = '0' WHERE domain = '$domain';\n"
printf "UPDATE mailbox SET enablepop3tls = '0' WHERE domain = '$domain';\n"

View file

@ -0,0 +1,39 @@
#!/bin/sh
#
# Author: Daulton
# Website: daulton.ca
# Purpose: Enables enablepop3,enablepop3secured,enablepop3tls in the mailbox table for a given domain to be 1 (enabled) in iRedmail so to enable pop3.
# License: 2-clause BSD license
# 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.
#
# Usage: sh enable-pop3-for-domain.sh example.com
#
# Note: You can verify if this was successful with the following command:
# select username,domain,enablepop3,enablepop3secured,enablepop3tls FROM mailbox;
#
# This will print SQL commands on the console directly, you can redirect the
# output to a file for further use like this:
#
# sh enable-pop3-for-domain.sh example.com > output.sql
#
# Import output.sql into SQL database like below:
#
# mysql -uroot -p
# mysql> USE vmail;
# mysql> SOURCE /path/to/output.sql;
#
# psql -d vmail
# sql> \i /path/to/output.sql;
# Read input
domain="$1"
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "/h" ] || [ $# -eq 0 ]; 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 "Usage: sh enable-pop3-for-domain.sh example.com \n"
exit 0
fi
printf "UPDATE mailbox SET enablepop3 = '1' WHERE domain = '$domain';\n"
printf "UPDATE mailbox SET enablepop3secured = '1' WHERE domain = '$domain';\n"
printf "UPDATE mailbox SET enablepop3tls = '1' WHERE domain = '$domain';\n"