From 398af5c4a88cbc57c7ab1663ba903ea95e39a209 Mon Sep 17 00:00:00 2001 From: cranix Date: Sun, 26 Feb 2017 19:11:22 +0100 Subject: Added action encrypt --- kuvert | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/kuvert b/kuvert index 321f89e..fc62934 100755 --- a/kuvert +++ b/kuvert @@ -515,6 +515,13 @@ sub process_file return @res if (@res); } + #Check if mail needs to be dropped due to + #encrypt option being specyfied and lack of key + if (grep($_ eq "drop",values(%actions))) + { + return "Dropping mail due to lack of encryption key. Mail would be sent to: @rawrecips"; + } + my ($orig_header,$cryptoin); # prepare various stuff we need only when encrypting or signing if(grep($_ ne "none",values(%actions))) @@ -628,7 +635,7 @@ sub findaction } # next: check individual action=x directives - if ($a->[4] =~/action=(none|fallback-all|fallback|signonly)/) + if ($a->[4] =~/action=(none|fallback-all|fallback|signonly|encrypt)/) { my $thisaction=$1; $actions{$addr}=$thisaction; @@ -640,7 +647,13 @@ sub findaction $specialkeys{$addr}=$1; dlogit("local key override: $specialkeys{$addr} for $addr"); } - + + #Encrypt or drop everything + if ($actions{$addr}=~/^encrypt/) + { + $actions{$addr}=$specialkeys{$addr}||$email2key{$addr}||"drop"; + } + # now test for key existence and downgrade action to signonly # where necessary. if ($actions{$addr}=~/^fallback/) @@ -1738,6 +1751,11 @@ of this email are sent out: if we can we use encryption for everybody, or otherwise everybody gets it signed (or even unsigned). (Bcc'd recipients are the exception.) +=item encrypt + +Encrypts and signs mail if key is found for given recipent. +If no key is found mail is dropped + =back =head2 Specifying Actions -- cgit v1.2.3