Page Menu
Home
WMGMC Issues
搜索
Configure Global Search
登录
Files
F15879
sa-rules.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
订阅
标记用于日后
授予令牌
Size
1 KB
Referenced Files
None
订阅者
None
sa-rules.sh
View Options
#!/bin/bash
# Create temp directories
[[
!
-d
/tmp/sa-rules-heinlein
]]
&&
mkdir
-p
/tmp/sa-rules-heinlein
# Hash current SA rules
if
[[
!
-f
/etc/rspamd/custom/sa-rules
]]
;
then
HASH_SA_RULES
=
0
else
HASH_SA_RULES
=
$(
cat
/etc/rspamd/custom/sa-rules
|
md5sum
|
cut
-d
' '
-f1
)
fi
# Deploy
if
curl
--connect-timeout
15
--retry
5
--max-time
30
https://www.spamassassin.heinlein-support.de/
$(
dig
txt
1
.4.3.spamassassin.heinlein-support.de
+short
|
tr
-d
'"'
|
tr
-dc
'0-9'
)
.tar.gz
--output
/tmp/sa-rules-heinlein.tar.gz
;
then
if
gzip
-t
/tmp/sa-rules-heinlein.tar.gz
;
then
tar
xfvz
/tmp/sa-rules-heinlein.tar.gz
-C
/tmp/sa-rules-heinlein
cat
/tmp/sa-rules-heinlein/*cf
>
/etc/rspamd/custom/sa-rules
fi
else
echo
"Failed to download SA rules. Exiting."
exit
0
# Must be 0 otherwise dovecot would not start at all
fi
sed
-i
-e
's/\([^\\]\)\$\([^\/]\)/\1\\$\2/g'
/etc/rspamd/custom/sa-rules
if
[[
"
$(
cat
/etc/rspamd/custom/sa-rules
|
md5sum
|
cut
-d
' '
-f1
)
"
!
=
"
${
HASH_SA_RULES
}
"
]]
;
then
CONTAINER_NAME
=
rspamd-mailcow
CONTAINER_ID
=
$(
curl
--silent
--insecure
https://dockerapi.
${
COMPOSE_PROJECT_NAME
}
_mailcow-network/containers/json
|
\
jq
-r
".[] | {name: .Config.Labels[\"com.docker.compose.service\"], project: .Config.Labels[\"com.docker.compose.project\"], id: .Id}"
|
\
jq
-rc
"select( .name | tostring | contains(\"
${
CONTAINER_NAME
}
\")) | select( .project | tostring | contains(\"
${
COMPOSE_PROJECT_NAME
,,
}
\")) | .id"
)
if
[[
!
-z
${
CONTAINER_ID
}
]]
;
then
curl
--silent
--insecure
-XPOST
--connect-timeout
15
--max-time
120
https://dockerapi.
${
COMPOSE_PROJECT_NAME
}
_mailcow-network/containers/
${
CONTAINER_ID
}
/restart
fi
fi
# Cleanup
rm
-rf
/tmp/sa-rules-heinlein
/tmp/sa-rules-heinlein.tar.gz
File Metadata
详情
附加的
Mime Type
text/x-shellscript
Expires
9月 9 Tue, 5:46 AM (3 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5367
默认替代文本
sa-rules.sh (1 KB)
Attached To
Mode
rMAILCOW mailcow-tracking
附加的
Detach File
Event Timeline
Log In to Comment