Jail: mail


one time
.

create jail
export JAIL=mail
export JAILHOSTNAME=mail
export JAILDOMAIN=ahlawat.com
export JAILIP=100
export JAILUSER=X
export JAILUSERID=1000
export JAILUSERVNC=false

/root/FreeBSD/jails/create.sh $JAIL $JAILHOSTNAME $JAILDOMAIN $JAILIP $JAILUSER $JAILUSERID $JAILUSERVNC

iocage exec $JAIL "service sendmail stop"
iocage exec $JAIL "sysrc sendmail_enable=NONE"
iocage exec $JAIL "sysrc sendmail_submit_enable=NO"
iocage exec $JAIL "sysrc sendmail_msp_queue_enable=NO"

iocage exec $JAIL "cp /mnt/config/periodic.conf /etc"

iocage exec $JAIL "mkdir -p /data"
iocage fstab -a $JAIL /mnt/ship/email /data nullfs rw 0 0
iocage fstab -l $JAIL

iocage exec $JAIL "pkg install -r pkgp121 openldap-sasl-client"
iocage exec $JAIL "pkg lock -y openldap-sasl-client"

iocage exec $JAIL "pkg install -y postfix dovecot dovecot-pigeonhole rspamd dcc-dccd apache-solr redis"
## need to make postfix dovecot dovecot-pigeonhole rspamd dcc-dccd in pkgp
## https://www.rhyolite.com/dcc/
## https://www.dcc-servers.net/dcc/FAQ.html

iocage exec $JAIL 'echo "root: jail-root@ahlawat.com" >> /etc/mail/aliases'
iocage exec $JAIL "ln -s /etc/mail/aliases.db /etc/"
iocage exec $JAIL "newaliases"

iocage exec $JAIL "sysrc postfix_enable=YES"
iocage exec $JAIL "service postfix start"
iocage exec $JAIL "sysrc dovecot_enable=YES"
iocage exec $JAIL "service dovecot start"
iocage exec $JAIL "sysrc solr_enable=YES"
iocage exec $JAIL "service solr start"
iocage exec $JAIL "sysrc rspamd_enable=YES"
iocage exec $JAIL "service rspamd start"
iocage exec $JAIL "sysrc redis_enable=YES"
iocage exec $JAIL "service redis start"
iocage exec $JAIL "sysrc dccifd_enable=YES"
iocage exec $JAIL "service dccifd start"



Notes:

Call service provider to setup reverse dns (PTR record) for IP to map to mail.ahlawat.com and mail-backup.ahlawat.com

Archived Notes:
##iocage exec $JAIL "mkdir -p /mnt/oldmail"
##iocage fstab -a $JAIL /mnt/ship/mail /mnt/oldmail nullfs rw 0 0
##iocage exec $JAIL "mkdir -p /mnt/backup"
##iocage fstab -a $JAIL /mnt/data/apps/$JAIL /mnt/backup nullfs rw 0 0

crontab -l
#15 2 * * *  /usr/local/solr/bin/solr /usr/local/bin/curl -s 'http://localhost:8983/solr/dovecot/update?optimize=true' > /dev/null
#*/5 * * * * /usr/local/solr/bin/solr /usr/local/bin/curl -s 'http://localhost:8983/solr/dovecot/update?commit=true' > /dev/null
0 2 * * * /usr/bin/find /usr/local/dcc/log/ -not -newermt '1 days ago' -delete
8 0 * * * /mnt/config/postfix-reload.sh

Showcased here is a capital and operational cost effective approach, using minimal server and networking hardware with multiple virtualized applications for Home and Business. This solution template can be easily scaled out and adapted for larger Enterprise deployments.
drop by the diyIT Matrix public room at #diyit:matrix.ahlawat.com
if you have any IT questions/feedback or to request pro bono consulting for a nonprofit

message me privately at @sharad:matrix.ahlawat.com
or email me at - sharad@ahlawat.com - pgpkey: 68DD6B89
Networking and Security Technologist.
EngineerĀ andĀ an avid Programmer.

https://sharad.ahlawat.com
strive to learn and pass on the knowledge to the next generation
one day humanity will understand the meaning of life and hopefully it will be more than ASCII 42 = "*" regex for whatever you want it to be,
and destiny is more than just a roll of a pair of dice with 42 dots (Lets nail down Quantum Entanglement)

May you Live Long (Intelligently) and Prosper and work on technology that matters.
© 2024 Sharad Ahlawat

No personal identifying data is collected or any form of analytics/metrics reported to a third-party by this website.