Implement haraka

This commit is contained in:
Nawaz Dhandala
2020-02-17 22:00:41 +01:00
parent c48511786b
commit 6aa4b9499f
6 changed files with 157 additions and 230 deletions

View File

@@ -158,16 +158,7 @@ module.exports = {
});
return;
}
if(!EMAIL_ENABLED){
await EmailStatusService.create({
from: mailOptions.from,
to: mailOptions.to,
subject: mailOptions.subject,
template: mailOptions.template,
status: 'Email not enabled.'
});
return;
}
const info = await mailer.sendMail(mailOptions);
await EmailStatusService.create({
from: mailOptions.from,
@@ -615,14 +606,23 @@ module.exports = {
userName: addedByUser.name
}
};
if(!EMAIL_ENABLED){
await EmailStatusService.create({
from: mailOptions.from,
to: mailOptions.to,
subject: mailOptions.subject,
template: mailOptions.template,
status: 'Email not enabled.'
});
return;
}
const info = await mailer.sendMail(mailOptions);
await EmailStatusService.create({
from: mailOptions.from,
to: mailOptions.to,
subject: mailOptions.subject,
template: mailOptions.template,
status: 'Error'
status: 'Success'
});
return info;
} catch (error) {

View File

@@ -1,125 +1,125 @@
version: "3.7"
services:
mongo:
image: mongo:3.4
ports:
- "27017:27017"
volumes:
- mongodata:/data/db
# mongo:
# image: mongo:3.4
# ports:
# - "27017:27017"
# volumes:
# - mongodata:/data/db
redis:
image: redis:5.0.7
ports:
- "6379:6379"
command: redis-server
backend:
ports:
- "3002:3002"
build: ./backend
env_file:
- ./backend/.env.development
environment:
- MONGO_URL=mongodb://mongo:27017/fyipedb
- REDIS_HOST=redis
depends_on:
- mongo
- redis
accounts:
ports:
- "3003:3003"
build: ./accounts
env_file:
- ./accounts/.env
depends_on:
- backend
dashboard:
ports:
- "3000:3000"
build: ./dashboard
env_file:
- ./dashboard/.env
depends_on:
- backend
home:
ports:
- "1444:1444"
env_file:
- ./home/.env
build: ./home
status-page:
ports:
- "3006:3006"
build: ./status-page
env_file:
- ./status-page/.env
depends_on:
- backend
- accounts
- dashboard
admin-dashboard:
ports:
- "3100:3100"
env_file:
- ./admin-dashboard/.env
build: ./admin-dashboard
depends_on:
- backend
- accounts
http-test-server:
ports:
- "3010:3010"
env_file:
- ./http-test-server/.env
build: ./http-test-server
probe1:
ports:
- "3024:3024"
build: ./probe
env_file:
- ./probe/.env
environment:
- PORT=3024
- SERVER_URL=http://backend:3002
- PROBE_NAME=Probe 1
- PROBE_KEY=test-key
depends_on:
- backend
probe2:
ports:
- "3025:3025"
build: ./probe
env_file:
- ./probe/.env
environment:
- PORT=3025
- SERVER_URL=http://backend:3002
- PROBE_NAME=Probe 2
- PROBE_KEY=test-key
depends_on:
- backend
ngrok:
ports:
- "4040:4040"
image: wernight/ngrok:latest
command: ngrok http backend:3002
depends_on:
- backend
# haraka:
# redis:
# image: redis:5.0.7
# ports:
# - "25:25"
# build: ./haraka
# - "6379:6379"
# command: redis-server
# backend:
# ports:
# - "3002:3002"
# build: ./backend
# env_file:
# - ./backend/.env.development
# environment:
# - MONGO_URL=mongodb://mongo:27017/fyipedb
# - REDIS_HOST=redis
# depends_on:
# - mongo
# - redis
# accounts:
# ports:
# - "3003:3003"
# build: ./accounts
# env_file:
# - ./accounts/.env
# depends_on:
# - backend
# dashboard:
# ports:
# - "3000:3000"
# build: ./dashboard
# env_file:
# - ./dashboard/.env
# depends_on:
# - backend
# home:
# ports:
# - "1444:1444"
# env_file:
# - ./home/.env
# build: ./home
# status-page:
# ports:
# - "3006:3006"
# build: ./status-page
# env_file:
# - ./status-page/.env
# depends_on:
# - backend
# - accounts
# - dashboard
# admin-dashboard:
# ports:
# - "3100:3100"
# env_file:
# - ./admin-dashboard/.env
# build: ./admin-dashboard
# depends_on:
# - backend
# - accounts
# http-test-server:
# ports:
# - "3010:3010"
# env_file:
# - ./http-test-server/.env
# build: ./http-test-server
# probe1:
# ports:
# - "3024:3024"
# build: ./probe
# env_file:
# - ./probe/.env
# environment:
# - PORT=3024
# - SERVER_URL=http://backend:3002
# - PROBE_NAME=Probe 1
# - PROBE_KEY=test-key
# depends_on:
# - backend
# probe2:
# ports:
# - "3025:3025"
# build: ./probe
# env_file:
# - ./probe/.env
# environment:
# - PORT=3025
# - SERVER_URL=http://backend:3002
# - PROBE_NAME=Probe 2
# - PROBE_KEY=test-key
# depends_on:
# - backend
# ngrok:
# ports:
# - "4040:4040"
# image: wernight/ngrok:latest
# command: ngrok http backend:3002
# depends_on:
# - backend
haraka:
ports:
- "25:25"
build: ./haraka
volumes:
mongodata:

View File

@@ -3,33 +3,35 @@
# https://github.com/haraka/Haraka/blob/master/Dockerfile
##
FROM node:10-alpine
# NOTICE: This is user-contributed and not officially supported by the Haraka team. Use at your own risk.
#
# This file describes how to build Haraka into a runnable linux container with all dependencies installed
# To build:
# 1.) Install docker (http://docker.io)
# 2.) Clone Haraka repo if you haven't already: git clone https://github.com/haraka/Haraka.git
# 3.) Modify config/host_list with the domain(s) that you'd like to receive mail to
# 4.) Build: cd Haraka && docker build .
# 5.) Run:
# docker run -d <imageid>
#
# VERSION 0.1
# DOCKER-VERSION 0.5.3
#set language enviroments
ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
TIMEZONE="Asia/Shanghai" \
PORT=25 \
LOGLEVEL=warn \
DATADIR=/data \
DOMAIN="fyipe.com" \
HEADER="Haraka Server"
# See http://phusion.github.io/baseimage-docker/
# install software
COPY run.sh /
FROM node:10
# install dependence
RUN apk upgrade --update && \
apk add --no-cache -t .fetch-deps \
autoconf \
g++ \
gcc \
make \
python && \
addgroup -g 88 -S smtp && \
adduser -u 88 -D -S -G smtp -h /data smtp && \
#install haraka
npm install -g --unsafe-perm Haraka toobusy-js && \
# # Cleaning up
apk del --purge -r .fetch-deps && \
apk add --no-cache tzdata openssl execline ca-certificates && \
rm -rf /var/cache/apk/* /tmp/* ~/.pearrc && chmod 755 /run.sh
ENV HOME /root
RUN npm install -g Haraka --unsafe
RUN haraka -i /
ADD ./config/host_list /config/host_list
RUN npm install
EXPOSE 25
# Start the init daemon - runit will launch the Haraka process
CMD ["haraka -c /"]
CMD ["/run.sh"]

View File

@@ -1,2 +0,0 @@
# add hosts in here we want to accept mail for
fyipe.com

View File

@@ -1,71 +0,0 @@
# This file lists plugins that Haraka will run
#
# Plugin ordering often matters, run 'haraka -o -c /path/to/haraka/config'
# to see the order plugins (and their hooks) will run in.
#
# To see a list of all plugins, run 'haraka -l'
#
# To see the help docs for a particular plugin, run 'haraka -h plugin.name'
#status
#process_title
# Log to syslog (see 'haraka -h syslog')
# syslog
# CONNECT
#toobusy
#karma
#relay
# control which IPs, rDNS hostnames, HELO hostnames, MAIL FROM addresses, and
# RCPT TO address you accept mail from. See 'haraka -h access'.
# access
# p0f
# geoip
# asn
# fcrdns
# block mails from known bad hosts (see config/dnsbl.zones for the DNS zones queried)
dnsbl
# HELO
#early_talker
# see config/helo.checks.ini for configuration
helo.checks
# see 'haraka -h tls' for config instructions before enabling!
# tls
#
# AUTH plugins require TLS before AUTH is advertised, see
# https://github.com/haraka/Haraka/wiki/Require-SSL-TLS
# auth/flat_file
# auth/auth_proxy
# auth/auth_ldap
# MAIL FROM
# Only accept mail where the MAIL FROM domain is resolvable to an MX record
mail_from.is_resolvable
#spf
# RCPT TO
# At least one rcpt_to plugin is REQUIRED for inbound email. The simplest
# plugin is in_host_list, see 'haraka -h rcpt_to.in_host_list' to configure.
rcpt_to.in_host_list
#qmail-deliverable
#rcpt_to.ldap
#rcpt_to.routes
# DATA
#bounce
# Check mail headers are valid
data.headers
#data.uribl
#attachment
#clamd
#spamassassin
#dkim_sign
#limit
# QUEUE
# queues: discard qmail-queue quarantine smtp_forward smtp_proxy
# Queue mail via smtp - see config/smtp_forward.ini for where your mail goes
queue/smtp_forward
#watch

View File

@@ -1,2 +0,0 @@
#!/bin/sh
exec haraka -c /usr/local/haraka 2>&1