-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
3,562 additions
and
1,898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,54 @@ | ||
name: CI Tests | ||
|
||
on: [ push, pull_request ] | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
shellcheck: | ||
name: Shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- name: Run ShellCheck | ||
uses: ludeeus/action-shellcheck@master | ||
env: | ||
SHELLCHECK_OPTS: -s bash -e SC1004,SC1091,SC2009,SC2016,SC2039,SC2086,SC2119,SC2153 | ||
|
||
bats: | ||
name: Bats | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Bats | ||
run: git submodule update --init --recursive | ||
- name: bats test | ||
run: | | ||
./test/bats/bin/bats test/*.bats | ||
./test/bats/bin/bats test/include/*.bats | ||
freebsd: | ||
if: false | ||
runs-on: ubuntu-latest | ||
name: FreeBSD | ||
env: | ||
MYTOKEN : ${{ secrets.MYTOKEN }} | ||
MYTOKEN2: "value2" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Test in FreeBSD | ||
id: test | ||
uses: vmactions/freebsd-vm@v1 | ||
with: | ||
envs: 'MYTOKEN MYTOKEN2' | ||
usesh: true | ||
prepare: | | ||
pkg install -y curl | ||
run: | | ||
pwd | ||
ls -lah | ||
whoami | ||
env | ||
freebsd-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ node_modules | |
*.tar.gz | ||
*.txt | ||
*.php | ||
*.mt6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "test/bats"] | ||
path = test/bats | ||
url = https://github.com/bats-core/bats-core.git | ||
[submodule "test/test_helper/bats-support"] | ||
path = test/test_helper/bats-support | ||
url = https://github.com/bats-core/bats-support.git | ||
[submodule "test/test_helper/bats-assert"] | ||
path = test/test_helper/bats-assert | ||
url = https://github.com/bats-core/bats-assert.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
disable=SC1004,SC1091,SC2009,SC2016,SC2039,SC2086,SC2119,SC2120,SC2153,SC2154,SC3033,SC3043 | ||
disable=1004,1091,2009,2016,2039,2086,2119,2120,2153,2154,3033,3037,3043 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
# shellcheck disable=SC2044 | ||
for _f in $(find /data/vpopmail/ -type f -name .qmail); do | ||
|
||
# ignore files that don't specify maildrop | ||
if ! grep -q maildrop "$_f"; then continue; fi | ||
|
||
_lines=$(wc -l < "$_f" | bc) | ||
if [ "$_lines" = 1 ]; then | ||
# files with only a mailfilter rule can be deleted | ||
echo "$_lines: rm $_f" | ||
rm "$_f" | ||
continue | ||
fi | ||
|
||
# multiple delivery rules are in the file (see 'man dot-qmail') | ||
|
||
# extract all that isn't a maildrop invocation | ||
_contents=$(grep -v maildrop "$_f") | ||
|
||
# replace the maildrop rule with fully qualified path to Maildir | ||
_maildir="$(dirname "$_f" | sed -e 's|/data/vpopmail/home|/usr/local/vpopmail|')/Maildir/" | ||
|
||
echo "$_lines" | ||
echo "$_f" | ||
echo | ||
|
||
#echo "$_contents" | ||
#echo | ||
|
||
# write a new .qmail with the FQ Maildir + other delivery rules | ||
echo "$_contents" > "$_f.new" || exit 1 | ||
echo "$_maildir" >> "$_f.new" || exit 1 | ||
chown 89:89 "$_f.new" || exit 1 | ||
chmod 600 "$_f.new" || exit 1 | ||
|
||
# atomically replace the existing .qmail | ||
#echo "mv $_f.new $_f" | ||
#mv "$_f.new" "$_f" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
# pfrule.sh | ||
# | ||
# Use pfctl to load and unload PF config files into named PF anchors. | ||
# Config files are named for the anchor they'll be inserted | ||
# at. See https://github.com/msimerson/Mail-Toaster-6/wiki/PF | ||
# | ||
# Matt Simerson, matt@tnpi.net, 2023-06 | ||
|
||
_etcpath="$(dirname -- "$( readlink -f -- "$0"; )";)" | ||
|
||
usage() { | ||
echo " usage: $0 [ load | unload ]" | ||
echo " " | ||
exit 1 | ||
} | ||
|
||
for _f in "$_etcpath"/*.conf; do | ||
[ -f "$_f" ] || continue | ||
|
||
_anchor=$(basename $_f .conf) # nat, rdr, allow | ||
_jailname=$(basename "$(dirname "$(dirname $_etcpath)")") | ||
|
||
case "$1" in | ||
"load" ) | ||
_cmd="pfctl -a $_anchor/$_jailname -f $_f" | ||
;; | ||
"unload" ) | ||
_cmd="pfctl -a $_anchor/$_jailname -F all" | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
|
||
echo "$_cmd" | ||
$_cmd || exit 1 | ||
done | ||
|
||
exit |
Oops, something went wrong.