summaryrefslogtreecommitdiff
path: root/plugins/dkimstatus
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dkimstatus')
-rw-r--r--plugins/dkimstatus/dkimstatus.php155
-rw-r--r--plugins/dkimstatus/images/authorsign.pngbin0 -> 699 bytes
-rw-r--r--plugins/dkimstatus/images/invalidsig.pngbin0 -> 618 bytes
-rw-r--r--plugins/dkimstatus/images/nosiginfo.pngbin0 -> 707 bytes
-rw-r--r--plugins/dkimstatus/images/thirdpty.pngbin0 -> 722 bytes
-rw-r--r--plugins/dkimstatus/localization/cs_CZ.inc16
-rw-r--r--plugins/dkimstatus/localization/de_DE.inc8
-rw-r--r--plugins/dkimstatus/localization/en_US.inc9
-rw-r--r--plugins/dkimstatus/localization/es_ES.inc9
-rw-r--r--plugins/dkimstatus/localization/fr_FR.inc10
-rw-r--r--plugins/dkimstatus/localization/it_IT.inc7
-rw-r--r--plugins/dkimstatus/localization/ja_JP.inc9
-rw-r--r--plugins/dkimstatus/localization/pl_PL.inc9
-rw-r--r--plugins/dkimstatus/localization/ro_RO.inc9
14 files changed, 241 insertions, 0 deletions
diff --git a/plugins/dkimstatus/dkimstatus.php b/plugins/dkimstatus/dkimstatus.php
new file mode 100644
index 000000000..a26fac4af
--- /dev/null
+++ b/plugins/dkimstatus/dkimstatus.php
@@ -0,0 +1,155 @@
+<?php
+
+/**
+ * This plugin displays an icon showing the status
+ * of dkim verification of the message
+ *
+ * @version 0.4.7
+ * @author Julien vehent
+ * @mail julien@linuxwall.info
+ *
+ * original plugin from Vladimir Mach - wladik@gmail.com
+ * http://www.wladik.net
+ *
+ * Changelog:
+ * 20110912 - Added X-Spam-Status for spamassassin (thanks Ashish Shukla for the patch)
+ * 20110619 - Added License information for GPLv2
+ * 20110406 - added italian translation from Roberto Puzzanghera
+ * 20110128 - updated german translation by Simon
+ * 20101118 - japanese translation from Taka
+ * 20100811 - from Sergio Cambra: SPF fix, image function and spanish translation
+ * 20100202 - fix for amavis and add cz translation
+ * 20100201 - add control of header.i and header.from to detect third party signature, change icons
+ * 20100115 - add 'no information' status with image using x-dkim-authentication-results
+ * 20090920 - fixed space in matching status (thanks Pim Pronk for suggestion)
+ */
+class dkimstatus extends rcube_plugin
+{
+ public $task = 'mail';
+ function init()
+ {
+ $rcmail = rcmail::get_instance();
+ if ($rcmail->action == 'show' || $rcmail->action == 'preview') {
+ $this->add_hook('imap_init', array($this, 'imap_init'));
+ $this->add_hook('message_headers_output', array($this, 'message_headers'));
+ } else if ($rcmail->action == '') {
+ // with enabled_caching we're fetching additional headers before show/preview
+ $this->add_hook('imap_init', array($this, 'imap_init'));
+ }
+ }
+
+ function imap_init($p)
+ {
+ $rcmail = rcmail::get_instance();
+ $p['fetch_headers'] = trim($p['fetch_headers'].' ' . strtoupper('Authentication-Results').' '. strtoupper('X-DKIM-Authentication-Results').' ' .strtoupper('X-Spam-Status'));
+ return $p;
+ }
+
+ function image($image, $alt, $title)
+ {
+ return '<img src="plugins/dkimstatus/images/'.$image.'" alt="'.$this->gettext($alt).'" title="'.$this->gettext($alt).$title.'" /> ';
+ }
+
+ function message_headers($p)
+ {
+ $this->add_texts('localization');
+
+ /* First, if dkimproxy did not find a signature, stop here
+ */
+ if($p['headers']->others['x-dkim-authentication-results'] || $p['headers']->others['authentication-results'] || $p['headers']->others['x-spam-status']){
+
+ $results = $p['headers']->others['x-dkim-authentication-results'];
+
+ if(preg_match("/none/", $results)) {
+ $image = 'nosiginfo.png';
+ $alt = 'nosignature';
+ } else {
+ /* Second, check the authentication-results header
+ */
+ if($p['headers']->others['authentication-results']) {
+
+ $results = $p['headers']->others['authentication-results'];
+
+ if(preg_match("/dkim=([a-zA-Z0-9]*)/", $results, $m)) {
+ $status = ($m[1]);
+ }
+
+ if(preg_match("/domainkeys=([a-zA-Z0-9]*)/", $results, $m)) {
+ $status = ($m[1]);
+ }
+
+
+ if($status == 'pass') {
+
+ /* Verify if its an author's domain signature or a third party
+ */
+
+ if(preg_match("/[@][a-zA-Z0-9]+([.][a-zA-Z0-9]+)?\.[a-zA-Z]{2,4}/", $p['headers']->from, $m)) {
+ $authordomain = $m[0];
+ if(preg_match("/header\.i=(([a-zA-Z0-9]+[_\.\-]?)+)?($authordomain)/", $results) ||
+ preg_match("/header\.from=(([a-zA-Z0-9]+[_\.\-]?)+)?($authordomain)/", $results)) {
+ $image = 'authorsign.png';
+ $alt = 'verifiedsender';
+ $title = $results;
+ } else {
+ $image = 'thirdpty.png';
+ $alt = 'thirdpartysig';
+ $title = $results;
+ }
+ }
+
+ }
+ /* If signature proves invalid, show appropriate warning
+ */
+ else if ($status) {
+ $image = 'invalidsig.png';
+ $alt = 'invalidsignature';
+ $title = $results;
+ }
+ /* If no status it can be a spf verification
+ */
+ else {
+ $image = 'nosiginfo.png';
+ $alt = 'nosignature';
+ }
+
+ /* Third, check for spamassassin's X-Spam-Status
+ */
+ } else if ($p['headers']->others['x-spam-status']) {
+
+ $image = 'nosiginfo.png';
+ $alt = 'nosignature';
+
+ /* DKIM_* are defined at: http://search.cpan.org/~kmcgrail/Mail-SpamAssassin-3.3.2/lib/Mail/SpamAssassin/Plugin/DKIM.pm */
+ $results = $p['headers']->others['x-spam-status'];
+ if(preg_match_all('/DKIM_[^,]+/', $results, $m)) {
+ if(array_search('DKIM_SIGNED', $m[0]) !== FALSE) {
+ if(array_search('DKIM_VALID', $m[0]) !== FALSE) {
+ if(array_search('DKIM_VALID_AU', $m[0])) {
+ $image = 'authorsign.png';
+ $alt = 'verifiedsender';
+ $title = 'DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU';
+ } else {
+ $image = 'thirdpty.png';
+ $alt = 'thirdpartysig';
+ $title = 'DKIM_SIGNED, DKIM_VALID';
+ }
+ } else {
+ $image = 'invalidsig.png';
+ $alt = 'invalidsignature';
+ $title = 'DKIM_SIGNED';
+ }
+ }
+ }
+ }
+ }
+ } else {
+ $image = 'nosiginfo.png';
+ $alt = 'nosignature';
+ }
+ if ($image && $alt) {
+ $p['output']['from']['value'] = $this->image($image, $alt, $title) . $p['output']['from']['value'];
+ }
+ return $p;
+ }
+}
diff --git a/plugins/dkimstatus/images/authorsign.png b/plugins/dkimstatus/images/authorsign.png
new file mode 100644
index 000000000..b43bf66b7
--- /dev/null
+++ b/plugins/dkimstatus/images/authorsign.png
Binary files differ
diff --git a/plugins/dkimstatus/images/invalidsig.png b/plugins/dkimstatus/images/invalidsig.png
new file mode 100644
index 000000000..ee42c1183
--- /dev/null
+++ b/plugins/dkimstatus/images/invalidsig.png
Binary files differ
diff --git a/plugins/dkimstatus/images/nosiginfo.png b/plugins/dkimstatus/images/nosiginfo.png
new file mode 100644
index 000000000..4701919cd
--- /dev/null
+++ b/plugins/dkimstatus/images/nosiginfo.png
Binary files differ
diff --git a/plugins/dkimstatus/images/thirdpty.png b/plugins/dkimstatus/images/thirdpty.png
new file mode 100644
index 000000000..a2928859f
--- /dev/null
+++ b/plugins/dkimstatus/images/thirdpty.png
Binary files differ
diff --git a/plugins/dkimstatus/localization/cs_CZ.inc b/plugins/dkimstatus/localization/cs_CZ.inc
new file mode 100644
index 000000000..1017148e8
--- /dev/null
+++ b/plugins/dkimstatus/localization/cs_CZ.inc
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Czech translation
+ *
+ * @version 0.4
+ * @author Vladimír Mach
+ * @mail wladik@gmail.com
+ *
+ */
+$labels = array();
+$labels['verifiedsender'] = 'Platný podpis z domény odesílatele. Ověřil: ';
+$labels['invalidsignature'] = 'Neplatný podpis! Ověřil: ';
+$labels['nosignature'] = 'Podpis není k dospozici.';
+$labels['thirdpartysig'] = 'Podpis odesílatele není k dispozici, ale je tu podpis třetí strany. Ověřil: ';
+
+?>
diff --git a/plugins/dkimstatus/localization/de_DE.inc b/plugins/dkimstatus/localization/de_DE.inc
new file mode 100644
index 000000000..4d52ddcdd
--- /dev/null
+++ b/plugins/dkimstatus/localization/de_DE.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['verifiedsender'] = 'Die Absenderdomain besitzt eine g&uuml;ltige Unterschrift! &Uuml;berpr&uuml;ft von ';
+$labels['invalidsignature'] = 'Die Unterschrift ist nicht g&uuml;ltig! &Uuml;berpr&uuml;ft von ';
+$labels['nosignature'] = 'Keine Informationen &uuml;ber die Unterschrift vorhanden.';
+$labels['thirdpartysig'] = 'Die Absenderdomain besitzt keine Unterschrift. Es gibt jedoch eine Unterschrift die bestätigt wurde durch ';
+?>
diff --git a/plugins/dkimstatus/localization/en_US.inc b/plugins/dkimstatus/localization/en_US.inc
new file mode 100644
index 000000000..ff20a6874
--- /dev/null
+++ b/plugins/dkimstatus/localization/en_US.inc
@@ -0,0 +1,9 @@
+<?php
+
+$labels = array();
+$labels['verifiedsender'] = 'Valid signature from the author\'s domain. verified by ';
+$labels['invalidsignature'] = 'Signature is not valid ! verified by ';
+$labels['nosignature'] = 'No signature information';
+$labels['thirdpartysig'] = 'No author\'s domain signature but a third party signature is present. verified by ';
+
+?>
diff --git a/plugins/dkimstatus/localization/es_ES.inc b/plugins/dkimstatus/localization/es_ES.inc
new file mode 100644
index 000000000..e7b518dff
--- /dev/null
+++ b/plugins/dkimstatus/localization/es_ES.inc
@@ -0,0 +1,9 @@
+<?php
+
+$labels = array();
+$labels['verifiedsender'] = 'Firma válida del dominio del autor. Verificada por ';
+$labels['invalidsignature'] = '¡La firma no es válida! Verificada por ';
+$labels['nosignature'] = 'Sin información de firma';
+$labels['thirdpartysig'] = 'No hay firma del dominio del autor pero hay una firma de terceros. Verificada por ';
+
+?>
diff --git a/plugins/dkimstatus/localization/fr_FR.inc b/plugins/dkimstatus/localization/fr_FR.inc
new file mode 100644
index 000000000..28fa05145
--- /dev/null
+++ b/plugins/dkimstatus/localization/fr_FR.inc
@@ -0,0 +1,10 @@
+<?php
+
+$labels = array();
+$labels['verifiedsender'] = 'Signature valide provenant du domaine de l\'auteur. verifie par ';
+$labels['invalidsignature'] = 'Signature invalide ! verifie par ';
+$labels['nosignature'] = 'Pas d\'information de signature';
+$labels['thirdpartysig'] = 'Pas de signature du domaine de l\'auteur, mais une signature tierce partie est presente. verifie par ';
+
+
+?>
diff --git a/plugins/dkimstatus/localization/it_IT.inc b/plugins/dkimstatus/localization/it_IT.inc
new file mode 100644
index 000000000..0bd68a124
--- /dev/null
+++ b/plugins/dkimstatus/localization/it_IT.inc
@@ -0,0 +1,7 @@
+<?php
+$labels = array();
+$labels['verifiedsender'] = 'Firma valida dal dominio del mittente. verificato da ';
+$labels['invalidsignature'] = 'La firma non valida! verificato da ';
+$labels['nosignature'] = 'Nessuna informazione sulla firma';
+$labels['thirdpartysig'] = 'Nessuna firma da parte del dominio del mittente ma presente una firma di terza parti. verificato da ';
+?> \ No newline at end of file
diff --git a/plugins/dkimstatus/localization/ja_JP.inc b/plugins/dkimstatus/localization/ja_JP.inc
new file mode 100644
index 000000000..f16829aa6
--- /dev/null
+++ b/plugins/dkimstatus/localization/ja_JP.inc
@@ -0,0 +1,9 @@
+<?php
+
+$labels = array();
+$labels['verifiedsender'] = '送信者のドメインによる正当な署名です。検証内容: ';
+$labels['invalidsignature'] = '不正な署名です! 検証内容: ';
+$labels['nosignature'] = '署名されていません';
+$labels['thirdpartysig'] = '送信者のドメインによる署名はありませんが、第三者による署名があります。検証内容: ';
+
+?>
diff --git a/plugins/dkimstatus/localization/pl_PL.inc b/plugins/dkimstatus/localization/pl_PL.inc
new file mode 100644
index 000000000..a237eb4e5
--- /dev/null
+++ b/plugins/dkimstatus/localization/pl_PL.inc
@@ -0,0 +1,9 @@
+<?php
+
+$labels = array();
+$labels['verifiedsender'] = 'Poprawna sygnatura domeny nadawczej. zweryfikowane przez ';
+$labels['invalidsignature'] = 'Sygnatura nie jest poprawna! zweryfikowane przez ';
+$labels['nosignature'] = 'Brak sygnatury';
+$labels['thirdpartysig'] = 'Brak sygnatury domeny nadawczej. Obecna inny typ sygnatury. zweryfikowane przez ';
+
+?>
diff --git a/plugins/dkimstatus/localization/ro_RO.inc b/plugins/dkimstatus/localization/ro_RO.inc
new file mode 100644
index 000000000..7842492fd
--- /dev/null
+++ b/plugins/dkimstatus/localization/ro_RO.inc
@@ -0,0 +1,9 @@
+<?php
+
+$labels = array();
+$labels['verifiedsender'] = 'Semnat in domeniul autorului. Semnatura comparata si validata de catre ';
+$labels['invalidsignature'] = 'Semnatura falsa! Comparata si invalidata de catre ';
+$labels['nosignature'] = 'Imposibil de comparat si validat semnatura de catre ';
+$labels['thirdpartysig'] = 'Nesemnat in domeniul autorului. O semnatura este prezenta intr-o terta pozitie. Comparat si validat cu aceasta semnatura de catre ';
+
+?>