0x1949 Team - FAZEMRX - MANAGER
Edit File: cpanel-mailman.postinst
#!/bin/sh set -e ## <asset scriplets/post> set -e USER=mailman GROUP=mailman MAILMAN_ROOT=/usr/local/cpanel/3rdparty/mailman SERVICE_NAME=mailman post() { echo "# mailman post: start" # create default mailman list if missing [ -d ${MAILMAN_ROOT}/archives ] || mkdir -m 02775 ${MAILMAN_ROOT}/archives [ -d ${MAILMAN_ROOT}/archives/public ] || mkdir -m 02750 ${MAILMAN_ROOT}/archives/public [ -d ${MAILMAN_ROOT}/archives/private ] || mkdir -m 02750 ${MAILMAN_ROOT}/archives/private chown $USER ${MAILMAN_ROOT}/archives chown $USER ${MAILMAN_ROOT}/archives/public chown $USER ${MAILMAN_ROOT}/archives/private ( ${MAILMAN_ROOT}/bin/list_lists -b | grep mailman ) || ( /usr/local/cpanel/bin/mmpass | ${MAILMAN_ROOT}/bin/newlist --stdin_passwd -q -l en mailman root@`hostname` && ${MAILMAN_ROOT}/bin/config_list -i ${MAILMAN_ROOT}/data/sitelist.cfg mailman ) ||: if [ -d "${MAILMAN_ROOT}/logs" ]; then find ${MAILMAN_ROOT}/logs -type f -exec chmod 664 {} ';' ||: fi /bin/rm -f ${MAILMAN_ROOT}/qfiles/out/* ||: # should move that script to the rpm /usr/local/cpanel/bin/cleandeadqfiles ||: # update web UI icons (should be a unit test) /bin/find ${MAILMAN_ROOT}/icons -maxdepth 1 -type f -exec /bin/cp -f {} /usr/local/cpanel/img-sys/ ';' touch /var/cpanel/mailman2 ||: # chmod log files /bin/find ${MAILMAN_ROOT}/logs -maxdepth 1 -type f -exec chown mailman:mailman {} ';' /bin/find ${MAILMAN_ROOT}/logs -maxdepth 1 -type f -exec chmod 0664 {} ';' # that file is not listed by the rpm ( maybe can make it a ghost file ? ) touch ${MAILMAN_ROOT}/archives/public/index.html # Additional check_perms rules for cPanel package chown ${USER}:${GROUP} ${MAILMAN_ROOT}/archives/public/index.html chmod 0644 ${MAILMAN_ROOT}/archives/public/index.html # chown is going to strip the setuid bit, need to recover them just after # Avoid recursive chown/chmod of the archives directory. See CPANEL-10276 and CPANEL-36604. /bin/find ${MAILMAN_ROOT} -path ${MAILMAN_ROOT}/archives -prune -o -exec chown ${USER}:${GROUP} {} '+' chown ${USER}:${GROUP} ${MAILMAN_ROOT}/archives chmod 6755 ${MAILMAN_ROOT}/cgi-bin/admin chmod 6755 ${MAILMAN_ROOT}/cgi-bin/admindb chmod 6755 ${MAILMAN_ROOT}/cgi-bin/confirm chmod 6755 ${MAILMAN_ROOT}/cgi-bin/edithtml chmod 6755 ${MAILMAN_ROOT}/cgi-bin/listinfo chmod 6755 ${MAILMAN_ROOT}/cgi-bin/options chmod 6755 ${MAILMAN_ROOT}/cgi-bin/private chmod 6755 ${MAILMAN_ROOT}/cgi-bin/roster chmod 6755 ${MAILMAN_ROOT}/cgi-bin/subscribe chmod 4755 ${MAILMAN_ROOT}/bin/setuid-wrapper chown root:${GROUP} ${MAILMAN_ROOT}/Mailman/mm_cfg.py chmod 0644 ${MAILMAN_ROOT}/Mailman/mm_cfg.py chmod 2770 ${MAILMAN_ROOT}/logs chmod 2770 ${MAILMAN_ROOT}/qfiles #Fix up anything else we missed echo "# mailman post: check_perms" ${MAILMAN_ROOT}/bin/check_perms --fix --noarchives ||: enable_services } enable_services() { echo "# mailman post: enable service" # install mailman service if [ "x${USE_INITD}" = "x1" ]; then /sbin/chkconfig --add ${SERVICE_NAME} else /usr/bin/systemctl daemon-reload # on ubuntu the service can be masked /usr/bin/systemctl enable ${SERVICE_NAME} || ( /usr/bin/systemctl unmask ${SERVICE_NAME} ||:; /usr/bin/systemctl enable ${SERVICE_NAME} ) fi echo "# mailman post: restartsrv_mailman" # If we can, start it up. if [ -x /usr/local/cpanel/scripts/restartsrv_mailman ] && grep -qs 'skipmailman=0' /var/cpanel/cpanel.config then # This depends on JSON::XS being installed which is in cpanel-perl(Cpanel::CORE::Dependencies) /usr/local/cpanel/bin/servers_queue --plugin=CpServicesTasks queue "restartsrv mailman" fi echo "# mailman post: done" } ## </asset> case "$1" in configure) post; ;; esac exit 0