| Server IP : 188.114.96.4 / Your IP : 104.23.243.201 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/guillaumea/script/admin/ |
Upload File : |
#!/bin/bash
clear
cat header.txt
RED='\033[0;31m'
read option
if [ $option = "1" ]
then
echo " Option 1 Selected ..."
echo " please enter domain name (example.com)"
read domain
mkdir /var/mail/vmail/$domain
chown -R vmail:vmail /var/mail/vmail
echo -e "$domain\n" >> /etc/postfix/domain-list
echo "${RED} success √"
elif [ $option = "2" ]
then
echo "Option 2 Selected ..."
echo " please enter domain (example.com)"
read domain
#var1 = $domain
echo " please enter user"
read user
mkdir /var/mail/vmail/$domain/$user
chown -R vmail:vmail /var/mail/vmail
doveadm pw -s SHA512-CRYPT
echo " plesae copy password after {SHA512-CRYPT} "
read pass
email=$user'@'$domain
echo "$email on creating... confirm?"
read ok
mysql --host=localhost --user=root --password=3E7sdKd9 -v postfix << EOF
INSERT INTO \`addresses\` (\`id\`, \`active\`, \`email\`, \`pwd\`) VALUES ('', '1', '$email', '$pass');
INSERT INTO \`aliases\` (\`id\`, \`source\`, \`target\`) VALUES ('','$email', '$email');
EOF
postfix reload
echo "${RED} success √"
elif [ $option = "3" ]
then
echo "Option 3 Selected ..."
echo "enter email to forward"
read email1
echo "enter email to receive"
read email2
echo "forward to $email2... confirm?"
read ok
mysql --host=localhost --user=root --password=3E7sdKd9 -v postfix << EOF
INSERT INTO \`aliases\` (\`id\`, \`source\`, \`target\`) VALUES ('','$email1', '$email2');
EOF
postfix reload
echo "${RED} success √"
elif [ $option = "4" ]
then
tail -f /var/log/mail.log
elif [ $option = "5" ]
then
echo "Option 5 Selected ..."
echo "enter emaill to config"
read email
doveadm pw -s SHA512-CRYPT
echo " plesae copy password after {SHA512-CRYPT} "
read pass
echo "edit $email password... confirm?"
read ok
mysql --host=localhost --user=root --password=3E7sdKd9 -v postfix << EOF
UPDATE \`addresses\` SET \`addresses\`.\`pwd\` = '$pass' WHERE \`addresses\`.\`email\` = '$email';
EOF
postfix reload
echo "${RED} success √"
elif [ $option = "q" ]
exit
then
else
echo "Please select a correct option"
fi