Enabling and disabling gpgit

This commit is contained in:
Bob Mottram 2016-11-14 09:25:57 +00:00
parent 8bec2b165c
commit 24f89a0323
1 changed files with 12 additions and 8 deletions

View File

@ -32,14 +32,16 @@ function enable_email_encryption_at_rest {
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if grep '#/usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
sed -i 's|#/usr/bin/gpgit.pl|/usr/bin/gpgit.pl|g' /home/$USERNAME/.procmailrc
if grep '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
sed -i 's|#:0 f|:0 f|g' /home/$USERNAME/.procmailrc
fi
fi
done
if grep '#/usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
sed -i 's|#/usr/bin/gpgit.pl|/usr/bin/gpgit.pl|g' /etc/skel/.procmailrc
if grep '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
sed -i 's|#:0 f|:0 f|g' /etc/skel/.procmailrc
fi
}
@ -47,14 +49,16 @@ function disable_email_encryption_at_rest {
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if ! grep '#/usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
sed -i 's|/usr/bin/gpgit.pl|#/usr/bin/gpgit.pl|g' /home/$USERNAME/.procmailrc
if ! grep '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
sed -i 's|:0 f|#:0 f|g' /home/$USERNAME/.procmailrc
fi
fi
done
if ! grep '#/usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
sed -i 's|/usr/bin/gpgit.pl|#/usr/bin/gpgit.pl|g' /etc/skel/.procmailrc
if ! grep '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
sed -i 's|:0 f|#:0 f|g' /etc/skel/.procmailrc
fi
}