Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
edd8a42e2d | |||
fe0bd0470c | |||
1d92622f21 | |||
16e35505d6 | |||
5819107340 | |||
f08937111e | |||
dbb79dd567 | |||
e1d0f95a72 | |||
a2b000a05b |
@ -17,7 +17,7 @@ steps:
|
|||||||
scan_image:
|
scan_image:
|
||||||
image: aquasec/trivy
|
image: aquasec/trivy
|
||||||
commands:
|
commands:
|
||||||
- trivy image $FORGE_NAME/$CI_REPO:$CI_COMMIT_SHA --quiet --exit-code 1
|
- env TRIVY_DISABLE_VEX_NOTICE=1 trivy image $FORGE_NAME/$CI_REPO:$CI_COMMIT_SHA --quiet --exit-code 1
|
||||||
when:
|
when:
|
||||||
- event: [push, tag]
|
- event: [push, tag]
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ ENV SMARTHOST_USER=""
|
|||||||
ENV SMARTHOST_PASS=""
|
ENV SMARTHOST_PASS=""
|
||||||
# ip addresses or networks to allow for relaying, separate multiple ones by semicolon
|
# ip addresses or networks to allow for relaying, separate multiple ones by semicolon
|
||||||
ENV RELAYNETS="127.0.0.1/32"
|
ENV RELAYNETS="127.0.0.1/32"
|
||||||
|
# whitelist of recipient domains, colon-separated, if empty all no restrictions
|
||||||
|
ENV WHITELISTED_RECIPIENTS=""
|
||||||
|
|
||||||
|
|
||||||
RUN apk add --no-cache exim m4
|
RUN apk add --no-cache exim m4
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: smtp
|
name: smtp
|
||||||
|
namespace: system
|
||||||
labels:
|
labels:
|
||||||
app: smtp
|
app: smtp
|
||||||
annotations:
|
annotations:
|
||||||
@ -18,7 +19,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: smtp
|
- name: smtp
|
||||||
image: quay.io/wollud1969/exim-docker:0.2.1
|
image: quay.io/wollud1969/exim-docker:0.3.2
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: smtp-secrets
|
name: smtp-secrets
|
||||||
@ -30,6 +31,7 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: smtp
|
name: smtp
|
||||||
|
namespace: system
|
||||||
spec:
|
spec:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
selector:
|
selector:
|
||||||
|
@ -62,7 +62,6 @@ acl_check_rcpt:
|
|||||||
accept
|
accept
|
||||||
hosts = RELAYNETS
|
hosts = RELAYNETS
|
||||||
ifelse(WHITELISTED_RECIPIENTS, `', `', `
|
ifelse(WHITELISTED_RECIPIENTS, `', `', `
|
||||||
accept
|
|
||||||
domains = WHITELISTED_RECIPIENTS
|
domains = WHITELISTED_RECIPIENTS
|
||||||
')
|
')
|
||||||
deny
|
deny
|
||||||
|
@ -12,6 +12,7 @@ Four environment variables are used to configure the container:
|
|||||||
* `SMARTHOST_PASS`: Password for smarthost.
|
* `SMARTHOST_PASS`: Password for smarthost.
|
||||||
* `LOCALMAILNAME`: The domain name which shall be used as the domain part of the sender address in every outgoing mail. If not required, skip it.
|
* `LOCALMAILNAME`: The domain name which shall be used as the domain part of the sender address in every outgoing mail. If not required, skip it.
|
||||||
* `RELAYNETS`: Networks exim in this container accepts for relaying. Separate multiple networks by semicolon.
|
* `RELAYNETS`: Networks exim in this container accepts for relaying. Separate multiple networks by semicolon.
|
||||||
|
* `WHITELISTED_RECIPIENT`: Colon-separated list of whitelisted recipient domains, if empty no recipient restrictions will be applied
|
||||||
|
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
@ -24,7 +25,7 @@ Typically, don't expose the smtp port of this container to the default network o
|
|||||||
```
|
```
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
IMAGE=quay.io/wollud1969/exim-docker:0.2.2
|
IMAGE=quay.io/wollud1969/exim-docker:0.3.2
|
||||||
MAILER_NETWORK=mailer-network
|
MAILER_NETWORK=mailer-network
|
||||||
|
|
||||||
docker network create $MAILER_NETWORK || echo "mailer-network already exists"
|
docker network create $MAILER_NETWORK || echo "mailer-network already exists"
|
||||||
@ -38,6 +39,7 @@ docker run \
|
|||||||
-e SMARTHOST=smarthost.example.com \
|
-e SMARTHOST=smarthost.example.com \
|
||||||
-e LOCALMAILNAME=krohne.com \
|
-e LOCALMAILNAME=krohne.com \
|
||||||
-e RELAYNETS=$RELAYNETS \
|
-e RELAYNETS=$RELAYNETS \
|
||||||
|
-e WHITELISTED_RECIPIENT="example-recipients.com" \
|
||||||
--network $MAILER_NETWORK \
|
--network $MAILER_NETWORK \
|
||||||
--name mailer \
|
--name mailer \
|
||||||
--restart always \
|
--restart always \
|
||||||
|
64
tools/smtp-dialog.exp
Executable file
64
tools/smtp-dialog.exp
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/expect
|
||||||
|
|
||||||
|
package require base64
|
||||||
|
|
||||||
|
|
||||||
|
# SMTP-Server und Port definieren
|
||||||
|
set smtp_server "localhost"
|
||||||
|
set smtp_port "25"
|
||||||
|
set timeout 25
|
||||||
|
|
||||||
|
# Absender, Empfänger und Nachricht
|
||||||
|
set sender $env(SMTP_SENDER)
|
||||||
|
set recipient "test@hottis.de"
|
||||||
|
set message "Subject: Test Email\r\n\r\nThis is a test email sent via an expect script."
|
||||||
|
|
||||||
|
set smtp_user $env(SMTP_USER)
|
||||||
|
set smtp_pass $env(SMTP_PASS)
|
||||||
|
|
||||||
|
set smtp_user_64 [base64::encode $smtp_user]
|
||||||
|
set smtp_pass_64 [base64::encode $smtp_pass]
|
||||||
|
|
||||||
|
|
||||||
|
# Verbindung herstellen
|
||||||
|
spawn nc -C $smtp_server $smtp_port
|
||||||
|
|
||||||
|
# Begrüßung vom Server erwarten
|
||||||
|
expect "220 *"
|
||||||
|
|
||||||
|
# HELO/EHLO senden
|
||||||
|
send "EHLO de01rdsi01.krohnegroup.com\n"
|
||||||
|
expect "250 *"
|
||||||
|
|
||||||
|
send "AUTH LOGIN\n"
|
||||||
|
expect "334 VXNlcm5hbWU6"
|
||||||
|
|
||||||
|
send "$smtp_user_64\n"
|
||||||
|
expect "334 UGFzc3dvcmQ6"
|
||||||
|
|
||||||
|
send "$smtp_pass_64\n"
|
||||||
|
expect "235 2.7.0 Authentication successful"
|
||||||
|
|
||||||
|
# Absender definieren
|
||||||
|
send "MAIL FROM:<$sender>\n"
|
||||||
|
expect "250 *"
|
||||||
|
|
||||||
|
# Empfänger definieren
|
||||||
|
send "RCPT TO:<$recipient>\n"
|
||||||
|
expect "250 *"
|
||||||
|
|
||||||
|
# Datenübertragung starten
|
||||||
|
send "DATA\n"
|
||||||
|
expect "354 *"
|
||||||
|
|
||||||
|
# Nachricht senden und Übertragung abschließen
|
||||||
|
send "$message\n.\n"
|
||||||
|
expect "250 *"
|
||||||
|
|
||||||
|
# Verbindung schließen
|
||||||
|
send "QUIT\n"
|
||||||
|
expect "221 *"
|
||||||
|
|
||||||
|
# Beenden
|
||||||
|
interact
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user