From 7fa153ea2e4ea939baa09e2e05f512e1d1b7278a Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 12 Oct 2006 13:53:36 +0000 Subject: added back MimeWrapMessage; admin replies are now sent encrypted --- firma | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) (limited to 'firma') diff --git a/firma b/firma index 713659b..0cc1983 100755 --- a/firma +++ b/firma @@ -1826,8 +1826,9 @@ function EmailListAdministration { ListAdministration $command fi done`" - # TODO: send encrypted - ComposeAndSendBounceMessage + GPG_MESSAGE="`echo -e "${PASSPHRASE}\n${MESSAGE_BODY}" | $GPG_ENCRYPT --recipient $SENDER_ADDRESS`" + MimeWrapMessage + echo "$MESSAGE" | $MAIL_AGENT $MAIL_AGENT_ARGS else # message was sent by a normal subscriber # this is the body of the message to be sent, so no indentation here @@ -1874,6 +1875,58 @@ function AllowMessageProcessing { return $return_code } + +function MimeWrapMessage { + #------------------------------------------------------------- + # MIME wrap message to be sent, adding needed headers and body parts + # + # parameter(s): none + # depends on variable(s): RECIPIENTS, SUBJECT, GPG_MESSAGE + # + # returns: 0 + #------------------------------------------------------------- + + local boundary + + boundary="`RandomString 15`" + + # these are the headers of the message to be sent, so no indentation here + MESSAGE_HEADERS="\ +From: $LIST_ADDRESS +To: ${RECIPIENTS} +Reply-To: $LIST_ADDRESS +Subject: ${SUBJECT_PREFIX}${SUBJECT} +MIME-Version: 1.0 +Content-Type: multipart/encrypted; + protocol=\"application/pgp-encrypted\"; + boundary=\"${boundary}\" +Content-Disposition: inline" + + # this is the body of the message to be sent, so no indentation here + MESSAGE_BODY="\ +This is an OpenPGP/MIME encrypted message (RFC 2440 and 3156) +--$boundary +Content-Type: application/pgp-encrypted +Content-Description: PGP/MIME version identification + +Version: 1 + +--$boundary +Content-Type: application/octet-stream; name=\"encrypted.asc\" +Content-Disposition: inline; filename=\"encrypted.asc\" +Content-Description: OpenPGP encrypted message + +${GPG_MESSAGE} + +--${boundary}--" + + # assemble entire message + MESSAGE="\ +${MESSAGE_HEADERS} + +${MESSAGE_BODY}" +} + #------------------------------------------------------------- # main() #------------------------------------------------------------- @@ -1950,7 +2003,8 @@ FUNCTIONS=" FixOwnership RandomString AdminLog - EmailListAdministration" + EmailListAdministration + MimeWrapMessage" for VAR in $GLOBAL_VARS; do declare $VAR -- cgit v1.2.3