zjorz / Public-AD-Scripts

AD Scripts
GNU General Public License v3.0
272 stars 76 forks source link

add feature: smime sign emails #1

Closed mwarth closed 1 year ago

mwarth commented 4 years ago

Thanks for this great script, i love it!

To meet our company security standards i needed to smime sign all emails sent by the script.

This PR adds the ability to smime sign emails. Requires Cpi.Net.SecureMail.dll to be compiled manually from https://www.codeproject.com/Articles/41727/An-S-MIME-Library-for-Sending-Signed-and-Encrypted

Feature is completely customizable through AD-Exp-Notify.xml:

<!-- Enable/Disable SMIME signing of emails: ON or OFF -->
<mailSign>OFF</mailSign>

<!-- Full path of Cpi.Net.SecureMail.dll -->
<!-- Dll Source Code: https://www.codeproject.com/Articles/41727/An-S-MIME-Library-for-Sending-Signed-and-Encrypted -->
<mailSignDllFile>C:\AD-Support\Scripts\AD-Expiry-Notification\Cpi.Net.SecureMail.dll</mailSignDllFile>

<!-- Full path of a .pfx certificate file used to sign the email message -->
<mailSignCertFile>C:\AD-Support\Scripts\AD-Expiry-Notification\cert.pfx</mailSignCertFile>

<!-- The password for the .pfx certificate file -->
<mailSignCertPassword>abcdefghijklmnopqrstuvwxyz</mailSignCertPassword>