Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Apr 24, 2024
1 parent 3b60ba1 commit 4e9a3dd
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
48 changes: 48 additions & 0 deletions bin/add-user-email.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
USAGE="Usage: $0 EMAIL PASSWORD [BASEDIR]";

if [ ! -n "$2" ]
then
echo $USAGE;
exit 1;
fi

USERNAME=$(echo "$1" | cut -f1 -d@);
DOMAIN=$(echo "$1" | cut -f2 -d@);
ADDRESS=$1;
PASSWD=$2;

if [ -n "$3" ]
then
if [ ! -d "$3" ]
then
echo $USAGE;
echo "BASEDIR must be a valid directory!";
echo "I would have tried, $(postconf | grep ^virtual_mailbox_base | cut -f3 -d' ')";
exit 2;
else
BASEDIR="$3";
fi
else
BASEDIR="$(postconf | grep ^virtual_mailbox_base | cut -f3 -d' ')";
fi

if [ -f /etc/postfix/vmailbox ]
then
echo "Adding Postfix user configuration..."
echo $ADDRESS $DOMAIN/$USERNAME/ >> /etc/postfix/vmailbox
postmap /etc/postfix/vmailbox

if [ $? -eq 0 ]
then
echo "Adding Dovecot user configuration..."

echo $ADDRESS::5000:5000::$BASEDIR/$DOMAIN/$ADDRESS

echo $ADDRESS::5000:5000::$BASEDIR/$DOMAIN/$ADDRESS>> $BASEDIR/$DOMAIN/passwd
echo $ADDRESS":"$(doveadm pw -p $PASSWD) >> $BASEDIR/$DOMAIN/shadow
chown vmail:vmail $BASEDIR/$DOMAIN/passwd && chmod 775 $BASEDIR/$DOMAIN/passwd
chown vmail:vmail $BASEDIR/$DOMAIN/shadow && chmod 775 $BASEDIR/$DOMAIN/shadow
/etc/init.d/postfix reload
fi
fi
4 changes: 3 additions & 1 deletion web/app/Installers/Server/Applications/DovecotInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public function install()
{
$commands = [];
$commands[] = 'echo "Installing dovecot..."';
$commands[] = 'apt-get install -y telnet dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd';

// postfix - internet site
$commands[] = 'apt-get install -y telnet postfix dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd';



Expand Down

0 comments on commit 4e9a3dd

Please sign in to comment.