Add test framework to test

- Mail encryption (when expected)
- Introducer listing, adding and removing
- Locals listing, adding and removing
This commit is contained in:
Malte Meiboom
2026-05-20 14:27:28 +02:00
parent aed368e90d
commit 1f8d7e9a3f
19 changed files with 303 additions and 96 deletions
+4 -1
View File
@@ -52,10 +52,13 @@ RUN apt-get update -yqq && \
openssh-client \
sudo \
postfix \
postfix-pcre \
rsyslog \
postgresql \
openssl \
sq
sq \
bind9-host \
inotify-tools
RUN adduser --shell /bin/bash --disabled-password --gecos "" hockeypuck
+2 -2
View File
@@ -41,9 +41,9 @@ myhostname = example.com
myorigin = example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.localdomain, localhost
mydestination = $myhostname, localhost.localdomain, localhost, example.com, example.org
#relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 0.0.0.0/0
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
+21 -1
View File
@@ -4,4 +4,24 @@ sequoia_home = "/tmp/sq_home"
logfile_config = "./log4rs.yml"
keyservers = [ "hkps://example.com" ]
keyservers = [ "hkp://example.com" ]
[logging.appenders.console]
kind = "console"
[logging.appenders.console.encoder]
pattern = "{d(%Y-%m-%d %H:%M:%S)(local)} {h({l})} [{t}] {m}{n}"
[logging.appenders.file]
kind = "file"
path = "/tmp/husk.log"
[logging.appenders.file.encoder]
pattern = "{d(%Y-%m-%d %H:%M:%S)(local)} {h({l})} [{t}] {m}{n}"
[logging.root]
level = "debug"
appenders = ["file"]
[logging.loggers."husk"]
level = "debug"
@@ -35,7 +35,7 @@ webroot="/var/www/"
bind="$IP:11371"
[hockeypuck.hkps]
bind="$IP:443"
bind="$IP:4443"
logRequestDetails=false
cert="$CERTS/$DOMAIN.crt"
key="$CERTS/$DOMAIN.key"
+2 -3
View File
@@ -24,8 +24,8 @@ sq key export --cert $ALICE_FPR > $TMP/alice_sk.pgp
sq key export --cert $CA_FPR > $TMP/ca_sk.pgp
# only certs
sq cert export --cert $BOB_FPR > $TMP/bob_pk.pgp
sq network keyserver publish --server hkps://example.com --cert $CAROL_FPR
sq network keyserver publish --server hkps://example.com --cert $DAVE_FPR
sq network keyserver publish --server hkp://example.com --cert $CAROL_FPR
sq network keyserver publish --server hkp://example.com --cert $DAVE_FPR
# create store
export SEQUOIA_HOME=$SEQUOIA_TARGET
@@ -41,4 +41,3 @@ sq pki link authorize --unconstrained --cert $CA_FPR --all --domain example.com
# bob@example.com has a local cert, which is certified by ca@example.com
# carol@example.com is published on a keyserver and certified by ca@example.com
# dave@example.com is published on a keyserver but uncertified
+20 -8
View File
@@ -3,29 +3,32 @@
BRANCH=$1
## create domain
echo "127.0.0.1 " $(hostname) > /etc/hosts
echo "127.0.0.1 " $(hostname) >> /etc/hosts
echo "127.0.0.2 example.com" >> /etc/hosts
echo "127.0.0.3 example.org" >> /etc/hosts
## build milter
if [ -f /opt/husk/mapped/Cargo.toml ] ; then
HUSK_BIN=/opt/husk/mapped/target/release/husk
else
HUSK_BIN=/opt/husk/mapped/target/debug/husk
HUSK_DIR=/opt/husk/mapped/
else
cd /opt/husk
git clone https://gitlab.com/husk-project/husk-milter.git
cd husk-milter
if [ "$BRANCH" != "" ] ; then
git checkout $BRANCH
fi
cargo build --release
cargo build
HUSK_BIN=/opt/husk/husk-milter/target/release/husk
HUSK_BIN=/opt/husk/husk-milter/target/debug/husk
HUSK_DIR=/opt/husk/husk-milter/
fi
## start rsyslogd
/usr/sbin/rsyslogd -n -iNONE &
## start postfix
sudo postfix start
sudo postfix start
## start and prepare postgres
DOMAINS="example.com"
@@ -52,5 +55,14 @@ done
bash /usr/bin/gen_sq_home.sh
## start milter
cd /opt/husk
$HUSK_BIN config.toml &
cd $HUSK_DIR/config
$HUSK_BIN daemon start --config config.toml &
## extract SEQUOIA_HOME from the configuration
SEQUOIA_HOME=$(grep "sequoia_home" config.toml | cut -d '=' -f 2 | tr -d ' ')
cat << EO_ENV > /tmp/env.sh
export HUSK_BIN=$HUSK_BIN
export HUSK_DIR=$HUSK_DIR
export SEQUOIA_HOME=$SEQUOIA_HOME
EO_ENV
+5 -4
View File
@@ -1,19 +1,20 @@
#!/usr/bin/bash
echo "test message" | sendmail -t root@example.com
adduser --shell /bin/bash --disabled-password --gecos "" mtatest
echo "test message" | sendmail -t mtatest@example.com
sleep 1
## simple test if mail passes
if [ -f /var/mail/root ] ; then
if [ -f /var/mail/mtatest ] ; then
echo "success"
rm /var/mail/root
rm /var/mail/mtatest
else
echo "failure"
exit 1
fi
## test encryption
## bob@example.com has an authenticated certificate in
## bob@example.com has an authenticated certificate in
## the cert store
echo "test message" | sendmail -t bob@example.com
sleep 1