Git Product home page Git Product logo

mailserver's People

Contributors

gardient avatar

Watchers

 avatar  avatar

mailserver's Issues

Install apt packages

  • postfix postfix-mysql
    debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
    debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
    
  • apache2
  • libapache2-mod-php php-imagick php-curl php-fpm php-gd php-imap php-intl php-ldap php-mbstring php-mysql php-xml php-zip php
  • rspamd
  • swaks
  • mutt
  • dovecot-mysql dovecot-pop3d dovecot-imapd dovecot-managesieved dovecot-lmtpd
  • adminer
  • ca-certificates

Script to collect info needed

info needed:

  • get hostname of machine (fqdn that goes into MX)
    • detect default from current hostname
  • get the domain the mailserver will serve for (the domain the MX is created for)
    • detect default from current hostname (drop the first part of the above)
  • get mariadb superadmin password
  • get webmaster password
  • get postfixadmin setup password

acquisition methods:

  • get above from environment ($MAILSRV_*)
  • get above from cli
  • offer to auto generate passwords

Create base install script

  • install base dependencies (git, jq, curl, wget, pwgen)
  • can detect whether it's piped to bash or properly executed
  • can get any branch of the repo
  • can find latest tag based on GH release (and get that one)

Set up dovecot

first thing's first
https://github.com/postfixadmin/postfixadmin/blob/master/DOCUMENTS/DOVECOT.txt

  • ensure /var/vmail exists
  • create vmail user and group (id 5000)
    groupadd -g 5000 vmail
    useradd -g vmail -u 5000 vmail -d /var/vmail -m
  • chown -R vmail:vmail /var/vmail
  • update dovecot configuration
    • 10-auth.conf: set auth_mechanisms = plain login; enable auth-sql.conf.ext
    • auth-sql.conf.ext: set userdb { driver = sql; args = /etc/dovecot/dovecot-sql.conf.ext; }
    • 10-mail.conf: set mail_location = maildir:~/Maildir
      add auto = subscribe to mailboxes in namespace
    • 10-master.conf: set
      # Postfix smtp-auth
      unix_listener /var/spool/postfix/private/auth {
        mode = 0660
        user = postfix
        group = postfix
      }
      
      # and the lmtp service
      service lmtp {
        unix_listener /var/spool/postfix/private/dovecot-lmtp {
          group = postfix
          user = postfix
          mode = 0600
        }
      }
      
    • 10-ssl.conf: set ssl = required
      ssl_cert = </etc/letsencrypt/live/webmail.example.org/fullchain.pem
      ssl_key = </etc/letsencrypt/live/webmail.example.org/privkey.pem
      
    • 20-lmtp.conf: mail_plugins = $mail_plugins sieve
    • /etc/dovecot/dovecot-sql.conf.ext: as described in the postfixadmin documentation
    • fix permissions on /etc/dovecot/dovecot-sql.conf.ext owner root mode 0600

Prepare the DB

  • create databases:
    postfix
    roundcube

  • create mariadb users: (CREATE USER '<user>'@'127.0.0.1' IDENTIFIED BY '<password>';)
    superadmin
    sa-postfix-ro
    sa-dovecot-ro
    sa-roundcube-rw
    sa-rc-pass-rw
    sa-postfixadm-rw

  • give permissions: (GRANT <priv_lvl> ON <db>.* TO '<user>'@'127.0.0.1';)
    superadmin: priv_lvl=ALL; db=*
    sa-postfix-ro: priv_lvl=SELECT; db=postfixadmin
    sa-dovecot-ro: priv_lvl=SELECT; db=postfixadmin
    sa-roundcube-rw: priv_lvl=ALL; db=roundcubedb
    sa-rc-pass-rw: priv_lvl=SELECT, UPDATE; db=postfixadmin
    sa-postfixadm-rw: priv_lvl=ALL; db=postfixadmin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.