{"id":7046,"date":"2017-11-15T19:09:47","date_gmt":"2017-11-15T19:09:47","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=7046"},"modified":"2017-11-15T19:24:40","modified_gmt":"2017-11-15T19:24:40","slug":"qmail-qfilter-filtern-bevor-es-in-die-queue-kommt","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=7046","title":{"rendered":"qmail-qfilter: Filtern bevor es in die Queue kommt"},"content":{"rendered":"<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ cat \/usr\/local\/vpopmail\/etc\/tcp.smtp\r\n127.:allow,RELAYCLIENT=&quot;&quot;\r\n:allow,QMAILQUEUE=&quot;\/var\/qmail\/bin\/qmail-localfilter.sh&quot;,GREYLIST=&quot;Y&quot;\r\n\r\n$ cat \/var\/qmail\/bin\/qmail-localfilter.sh\r\n#!\/bin\/sh\r\nexec \/usr\/local\/bin\/qmail-qfilter ${SPAMC_BIN}\/spamc ${SPAMC_FLAGS} -- ${QMAIL_LOCALFILTER_BIN}\/qmail-localfilter.pl ${QMAIL_LOCALFILTER_FLAGS}\r\n\r\n$ file \/usr\/local\/bin\/qmail-qfilter\r\n\/usr\/local\/bin\/qmail-qfilter: ELF 64-bit LSB executable, x86-64, version 1 (OS), dynamically linked, interpreter \/libexec\/ld-elf.so.1, for OS x.y stripped\r\n\r\n$ file \/var\/qmail\/bin\/qmail-localfilter.pl\r\n\/var\/qmail\/bin\/qmail-localfilter.pl: a \/usr\/local\/bin\/perl script, ASCII text executable\r\n<\/pre>\n<p><a href=\"https:\/\/untroubled.org\/qmail-qfilter\/\">qmail-qfilter<\/a>, qmail-queue multi-filter front end<br \/>\n<a href=\"https:\/\/tomclegg.ca\/qmail-qfilter\">Installing qmail-qfilter<\/a><\/p>\n<pre class=\"brush: perl; title: ; notranslate\" title=\"\">\r\n\r\n# &#x5B;...]\r\n\r\n$log_facility = &quot;mail&quot;;\r\nif($opt_s)\r\n{\r\n    $log_facility = $opt_s;\r\n}\r\n\r\n# &#x5B;...]\r\n\r\n# Begin by processing the mail header...\r\nwhile(&lt;&gt;) {\r\n\r\n  # &#x5B;...]\r\n\r\n  # Check for an &quot;X-Spam-Flag: YES&quot; line\r\n  # If we find one, this piece of crap is busted.\r\n  if (\/^X-Spam-Flag: YES\/oi) {\r\n    $spam = 1;\r\n    $opt_d and warn &quot;DEBUG: Mail is spam!\\n&quot;;\r\n  }\r\n\r\n  # &#x5B;...]\r\n}\r\n\r\n#\r\n# If this is spam, log that we have rejected it, (with the\r\n# &quot;from&quot; and &quot;to&quot; lines if possible), include the reason why it\r\n# was rejected, (if we have it), and exit with status code 31.\r\n#\r\nif ($spam) {\r\n  setlogsock('unix');\r\n  openlog('qmail-localfilter.pl','0',$log_facility);\r\n  if ($have_from) {\r\n    syslog('info',&quot;Rejected spam $from $to&quot;);\r\n  } else {\r\n    if ($have_to) {\r\n      syslog('info',&quot;Rejected spam $to&quot;);\r\n    } else {\r\n    syslog('info',&quot;Rejected spam.&quot;);\r\n    }\r\n  }\r\n  if ($have_reason) {\r\n    syslog('info',&quot;$reason&quot;);\r\n  }\r\n  exit 31\r\n}\r\n\r\n# &#x5B;...]\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$ cat \/usr\/local\/vpopmail\/etc\/tcp.smtp 127.:allow,RELAYCLIENT=&quot;&quot; :allow,QMAILQUEUE=&quot;\/var\/qmail\/bin\/qmail-localfilter.sh&quot;,GREYLIST=&quot;Y&quot; $ cat \/var\/qmail\/bin\/qmail-localfilter.sh #!\/bin\/sh exec \/usr\/local\/bin\/qmail-qfilter ${SPAMC_BIN}\/spamc ${SPAMC_FLAGS} &#8212; ${QMAIL_LOCALFILTER_BIN}\/qmail-localfilter.pl ${QMAIL_LOCALFILTER_FLAGS} $ file \/usr\/local\/bin\/qmail-qfilter \/usr\/local\/bin\/qmail-qfilter: ELF 64-bit LSB executable, x86-64, version 1 (OS), dynamically linked, interpreter \/libexec\/ld-elf.so.1, for OS x.y stripped $ file \/var\/qmail\/bin\/qmail-localfilter.pl \/var\/qmail\/bin\/qmail-localfilter.pl: a \/usr\/local\/bin\/perl script, ASCII text executable qmail-qfilter, qmail-queue multi-filter front end Installing qmail-qfilter # &#x5B;&#8230;] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7046","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/7046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7046"}],"version-history":[{"count":5,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/7046\/revisions"}],"predecessor-version":[{"id":7051,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/7046\/revisions\/7051"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}