/usr/share/doc/sanitizer/sanitizer.html is in sanitizer 1.76-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><title>The Anomy Sanitizer manual</title></head>
<BODY
BGCOLOR="#FFFFFF"
TEXT="#005500"
LINK="#880000"
ALINK="#880000"
VLINK="#880000">
<a name="top">
<h1>WARNING:</h1>
<p>This document is outdated! Please refer to the CHANGELOG for up-to-date
information on new features.</p>
<h1>The <a href="http://mailtools.anomy.net/">Anomy</a> Sanitizer</h1>
<p>
This file is slowly turning into the Anomy sanitizer's user manual.
The document is organized so that it makes sense to start at the
beginning, and read continuously until you reach the mailer-specific
configuration chapters. From that point on, everything is optional,
read what interests you. Well... the
<a href="#feedback">feedback chapter</a> isn't really optional.
Read it. <tt>:-)</tt>
</p>
<p>
<ul>
<li> <a href="#general">Introduction</a>
<li> <a href="#requirements">Requirements</a>
<li> <a href="#install">Installation, testing</a>
<li> <a href="#config">Configuration</a>
<ul>
<li> <a href="#conf-polvir">Policies and virus scanners</a>
<li> <a href="#conf-messages">Customizing messages</a>
<li> <a href="#conf-recommendations">Recommendations</a>
<li> <a href="#conf-real">A real-world configuration</a>
</ul>
<li> In-transit sanitizing
<ul>
<li> <a href="#in-transit-sendmail">sendmail</a>
<li> <a href="#in-transit-qmail">qmail</a>
<li> <a href="#in-transit-others">others</a>
</ul>
<li> Performance
<ul>
<li> <a href="#perf-cpu">CPU</a>
<li> <a href="#perf-memory">Memory</a>
</ul>
<li> Miscellanious hints / FAQs
<ul>
<li> <a href="#mh-scanner-codes">Virus scanning doesn't work!</a>
<li> <a href="#mh-anomy-env">The testcases succeed, but I can't run the Sanitizer!</a>
<li> <a href="#mh-anomy-env">What is the ANOMY environment variable for?</a>
<li> <a href="#pf-solaris-procmail">Solaris and procmail</a>
<li> <a href="#pf-postfix">Incoming mail and Postfix</a>
<li> <a href="#mh-memory-hog">Large messages and memory consumption</a>
<li> <a href="#mh-html-uuencode">Corrupt attachments from Outlook users</a>
<li> <a href="#mh-style-tag">Ugly HTML mail from Outlook users</a>
</ul>
</ul>
</p>
<p>
<ul>
<li> <a href="#hacking">Hacking the Anomy sanitizer</a>
<ul>
<li> <a href="#hack-design">Basic design</a>
<li> <a href="#hack-streams">Why treat the mail as a stream?</a>
<li> <a href="#hack-cruft">Rough edges</a>
<li> <a href="#hack-standards">Standards</a>
</ul>
</ul>
</p>
<p>
<ul>
<li> <a href="#feedback">Feedback</a>
<li> <a href="#credits">Credits & GPL</a>
</ul>
</p>
<!-- ---------------------------------------------------------------------- -->
<a name="general"><hr><h2> Introduction </h2>
<p>
The Anomy sanitizer is what most people would call "an email virus
scanner". That description is not totally accurate, but it does cover
one of the more important jobs that the sanitizer can do for you -
<b>it can scan email attachments for viruses</b>. Other things it can
do:
</p>
<p><ul>
<li>
Disable potentially dangerous HTML code, such as javascript, within
incoming email.
<li>
Protect you from email-based break-in attempts which exploit bugs in
common email programs (Outlook, Eudora, Pine, ...).
<li>
Block or "mangle" attachments based on their file names. This way if
you don't <i>need</i> to recieve e.g. visual basic scripts, then you
don't have to worry about the security risk they imply (the ILOVEYOU
virus was a visual basic program). This lets you protect yourself and
your users from whole classes of attacks, without relying on complex,
resource intensive and <i>outdated</i> virus scanning solutions.
</ul></p>
<p>
The sanitizer is designed not to waste important system resources
(<a href="#perf-cpu">CPU</a>, <a href="#perf-memory">memory</a>, disk
space) unnecessarily, and does so by treating it's input as a stream
which is scanned and rewritten a little bit at a time.
</p>
<p>
One of the core ideas behind the design of the sanitizer, is that just
because a message contains an infected attachment doesn't mean that the
rest of it shouldn't be delivered. Email often contains important
information, and it is vital that a tool like this interrupt the normal
flow of communication as little as possible. It's common courtesy to
<a href="#conf-messages">inform the user</a> of any changes that are
made. The Anomy sanitizer tries to follow these rules.
</p>
<p>
The sanitizer is based on solid foundations - most of the ideas
implemented in the first versions of the sanitizer were ported from John
D. Hardin's
"<a href="http://www.impsec.org/email-tools/procmail-security.html">email
security through procmail</a>" package. The sanitizer, like the code it
is based on, is <b>Free Software</b> in the
<a href="http://www.gnu.org/">GNU</a> sense of the term - the sanitizer
may be modified and redistributed according to the terms of the GNU
General Public License.
</p>
<p>
The following is a random sample of the attacks that are blocked by
the Anomy sanitizer in it's most common configurations (as of release
1.28):
</p>
<p><ul>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1899"
>Microsoft Windows 2000 ActiveX Control Buffer Overflow Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1869"
>Microsoft Exchange Server Invalid MIME Header charset = "" DoS
Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1718"
>Microsoft Internet Explorer / Outlook Express GetObject() File Disclosure
Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1709"
>Pine "From:" Buffer Overflow Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1481"
>Microsoft Outlook / Outlook Express GMT Field Buffer Overflow
Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1394"
>Microsoft Internet Explorer and Outlook/Outlook Express Remote File
Write Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1285"
>ITHouse Mail Server 1.04 Buffer Overflow Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1034"
>Microsoft Clip Art Buffer Overflow Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D962"
>MS Outlook Express 5 Javascript Email Access Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D775"
>Microsoft ActiveX CAB File Execution Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1754"
>Microsoft Virtual Machine com.ms.activeX.ActiveXComponent Arbitrary
Program Execution Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1502"
>Microsoft Outlook Express Persistent Mail-Browser Link Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D1195"
>Microsoft Outlook 98 / Outlook Express 4.x Long Filename Vulnerability</a>
<li><a href="http://www.securityfocus.com/frames/?content=/vdb/bottom.html%3Fvid%3D125"
>Multiple Vendor Buffer Overflow in MIME-aware Mail and News Clients
Vulnerability</a>
</ul></p>
<p>
In all cases the above exploits are blocked by some sort of generic
mechanism which will prevent a number of related attacks against similar
software with similar problems. This list doesn't include the
more common low-tech trojan-horse/social engineering attack methods
which are best handled with user education and an automatically
enforced attachment policy.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="requirements"><hr><h2> Requirements </h2>
<p>
The Anomy sanitizer is developed on a RedHat Linux system running
Perl 5.005_03. Any newer version of Perl on a Unix platform should
work fine. The sanitizer has very modest module requirements, and
only needs the following Perl modules to be present on your system:
</p>
<p><ul>
<li> MIME::Base64
<li> MIME::QuotedPrint
</ul></p>
<p>
Consult your perl documentation (hint: "man CPAN") for information on
how to install these if you haven't already.
</p>
<p>
The sanitizer makes no assumptions about what mailer you are using - it
has been configured to work well with
<a href="#in-transit-sendmail">sendmail</a> and
<a href="#in-transit-qmail">qmail</a>, and it should be relatively
easy to <a href="#in-transit-others">get it to work with others</a>,
such as postfix or exim.
</p>
<p>
For testing purposes, it may be a good idea to invoke the sanitizer from
within <a href="http://www.procmail.org/">procmail</a>, since
procmail does a very good job of recovering mail if the sanitizer
panics (e.g. because of an invalid configuration file) and can easily be
configured to keep backup copies of all processed messages.
</p>
<p>
If you want to scan attachments for viruses, you will need a third party
virus scanner which can be invoked from the command line to scan a
single file. The virus scanner must return an exit code describing
whether the file is infected or not, and may optionally also use exit
codes to indicate that the file was successfully disinfected.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="install"><hr><h2> Installation, testing </h2>
<p>
Download the most recent sanitizer from the web and install all the
<a href="#requirements">prerequisites</a>. The sanitizer can be
downloaded from it's home page,
<a href="http://mailtools.anomy.net/">mailtools.anomy.net</a>.
<p>
Unpack the tarball somewhere on your system, e.g. in <tt>/usr/local/</tt>
or your home directory. It will create a directory named <tt>anomy/</tt>
which will contain this file and a directory named <tt>bin/</tt>
containing the sanitizer itself and the MIME parsing module it depends on.
</p>
<p>
Next, you should run the included test cases to make sure that the
sanitizer functions properly on your system. Enter the
<tt>anomy/testcases</tt> directory, and give the command
<tt>./testall.sh</tt>. This will perform all included tests, and
compare their results to files named <tt>test-name.ok</tt> in the
subdirectory named results.def. You can examine these files to see how
the sanitizer alters email. If a test fails, a <tt>test-name.diff</tt>
file is created which shows the difference between the expected value
and the test result. Empty lines are usually harmless, but any other
failures should be reported back to the author.
</p>
<p>
If you cannot figure out why a test failed and wish to submit a bug
report, please include information about your operating system and a
copy of the relevant <tt>test-name.failed</tt> file. If all tests
succeed, then the sanitizer is ready to be used.
</p>
<p>
To test the sanitizer on one of your own messages, you can invoke the it
from the command line, like this (bourne shell syntax):
</p>
<p></p><font color=#000000><pre>
$ cd /path/to/anomy
$ export ANOMY=/path/to/anomy
$ ./bin/sanitizer.pl < /path/to/message |more
</pre></font>
<p>
This is an excellent way to test your first configuration file, simply
add the path to your configuration file to the command line invoking the
sanitizer, as the first argument:
</p>
<p></p><font color=#000000><pre>
$ ./bin/sanitizer.pl /etc/sanitizer.cfg < /path/to/message |more
</pre></font>
<p>
For a more extended test, you may want to sanitize only a single user's
mail until you are comfortable with the tool. How this is done depends
on your mailer, but one common case (sendmail and procmail) is very
simple. Just add the following lines to the user's <tt>.procmailrc</tt>
file:
</p>
<p></p><font color=#000000><pre>
:0 c
backup-mailbox
ANOMY=/path/to/anomy/
:0 fw
|/path/to/anomy/bin/sanitizer.pl
</pre></font>
<p>
The first rule creates a backup of all messages, in a mailbox named
<tt>backup-mailbox</tt>. Since you will probably make mistakes as you
define your first policy, this is probably a good idea in case the
sanitizer mistakenly destroys your mail. The second rule passes the
messages through the sanitizer, using procmail's filter feature,
possibly rewriting the message to deactivate virii, trojans, etc.
</p>
<p>
If you had created a configuration file named
<tt>/path/to/sanitizer.cfg</tt>, then the sanitization rule would be
modified to read as follows:
</p>
<p></p><font color=#000000><pre>
:0 fw
|/path/to/anomy/bin/sanitizer.pl /path/to/sanitizer.cfg
</pre></font>
<p>
Note that this is a completely valid way to invoke the sanitizer - if
your system administrator won't install it globally, but you have access
to your <tt>.procmailrc</tt> file, you can simply sanitizer your own mail
in this fashion. Also, instead of putting those rules in a
<tt>.procmailrc</tt> file, you can put them in <tt>/etc/procmailrc</tt>
instead and thus sanitize all mail delivered to local users.
<p>
</p>
<a href="http://www.procmail.org/">Procmail</a> is an excellent tool, and
it can be configured to work with most popular MTAs, including
<a href="http://www.sendmail.org/">sendmail</a>,
<a href="http://www.postfix.net/">postfix</a>,
<a href="http://www.qmail.org">qmail</a> and
<a href="http://www.exim.org/">exim</a>. Using procmail is
probably the easiest way to take advantage of the sanitizer.
</p>
<p>
<b>Note</b>: The above recipies may not be sufficient to get the
sanitizer to work on your platform - if you have problems, please be
sure to check the <a href="http://mailtools.anomy.net/sanitizer.html"
>newest version</a> of this manual for platform specific instructions,
as well as the <b>procmail(1)</b>, <b>procmailrc(1)</b> and
<b>procmailex(1)</b> man pages. Of particular interest when debugging
procmail related problems are the <tt>LOGFILE</tt> and <tt>VERBOSE</tt>
directives. Also be sure to check the <tt>contrib/</tt> directory of
the distribution for user-contributed tips and tricks.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="config"><hr><h2>Configuration</h2>
<p>
Most of the policies and messages generated by the sanitizer can be
customized. The sanitizer understands a single configuration syntax,
accepting configuration commands either on a line-by-line basis from one
or more text files, or via command-line arguements (each arguement
corrosponding to one line from a file). A simple configuration file
might look like this:
</p>
<p></p><font color=#000000><pre>
# this is a comment, bla bla
#
feat_log_stderr = 1 # enable logging to stderr
feat_log_inline = 0 # disable logging in the message itself
feat_trust_pgp = 1 # trust signed or encrypted messages
# Disable most of the advertisements the sanitizer would otherwise
# put in the header, replace them with our own bogus ones.
#
header_info = X-Virus-Scanned: Secured by FooCorp RealSecure MailWall
header_info += \nX-Garbage: \# this is not a comment # but this is
header_url = 0
header_rev = 0
# Include more configuration...
#
/path/to/policy/configuration/file
/path/to/another/configuration/file
</pre></font>
<p>
And could be activated like this:
</p>
<p></p><font color=#000000><pre>
$ sanitizer.pl /path/to/configuration/file
</pre></font>
<p>
The first setting (logging to standard error) could also have been
activated with this command line:
</p>
<p></p><font color=#000000><pre>
$ sanitizer.pl "feat_log_stderr = 1"
</pre></font>
<p>
The quotation marks are important, otherwise the shell would pass
"feat_log_stderr", "=" and "1" to the sanitizer as seperate arguements,
which wouldn't work. Please resist the urge to create configuration
files with have '='-signs in their names.
</p>
<p>
Configuration files may be nested arbitrarily, but to prevent infinite
loops the sanitizer will by default stop reading after 5 levels of
nesting. This maximum recursion level may be altered by setting the
"max_conf_recursion" variable.
</p>
<p>
Giving the sanitizer a bogus arguement will make it print an error
message and the current configuration to standard error. Appending a
nonsensical arguement to your normal command line will thus allow you to
compare the sanitizer's actual configuration with what you had in mind.
</p>
<p>
The example in the next section displays the complete list of
configuration variables. An effort will be made not to break
compatibility in future releases, although new variables will certainly
be introduced as the program evolves.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="conf-polvir"><hr><h2>Configuration - Policies and virus scanners</h2>
<p>
The Anomy sanitizer can process any attachments using a third party
virus scanner. Whether a virus scanner is used, and how it's results
are interpreted depends on the rules defined by the administrator.
</p>
<p>
Rules are defined by a set of policies. Each policy is assumed to apply
to all attachments not matching any previous policy, and whose file name
matches the policy's regulaur expression. The policies enforced can be
"accept", "defang", "mangle", "save" and "drop" in order of increasing
strictness. In addition, the "unknown" policy will tell the sanitizer
to check the next rule. The panic policy has been depraciated and is
(for backwards compatibility) equivalent to the "drop" policy.
</p>
<p>
Attachments which are accepted aren't altered at all. The defang and
mangle policies effect the attachment's file name, with mangle
destroying the original file name completely. The save and drop
policies will remove the attachment from the message, replacing it with
a text message. With drop the attachment will be deleted, with save it
will be left on the sanitizer's host file system for examination by an
administrator. If the policy is unknown, the attachment will be
compared with other, lower-priority policies.
</p>
<p>
Appending an exclamation mark (!) to a policy will make it have the
side-effect of increasing the internal "bug score" past the "score_bad"
value, causing the program to return with a non-zero exit code.
</p>
<p>
An example follows, illustrating most of the stuff involved in defining
a policy. Please note that this isn't necessarily a /good/ policy, it's
just an example.
</p>
<p></p><font color=#000000><pre>
#
# These are the default values for all feature switches.
#
feat_verbose = 1 # Warn user about unscanned parts, etc.
feat_log_inline = 1 # Inline logs: 0 = Off, 1 = Maybe, 2 = Force
feat_log_stderr = 1 # Print log to standard error
feat_log_xml = 0 # Don't use XML format for logs.
feat_log_trace = 0 # Omit trace info from logs.
feat_log_after = 0 # Don't add any scratch space to part headers.
feat_files = 1 # Enable filename-based policy decisions.
feat_force_name = 0 # Force all parts (except text/plain and
# text/html parts) to have file names.
feat_boundaries = 0 # Replace all boundary strings with our own
# NOTE: Always breaks PGP/MIME messages!
feat_lengths = 1 # Protect against buffer overflows and null
# values.
feat_scripts = 1 # Defang incoming shell scripts.
feat_html = 1 # Defang active HTML content.
feat_webbugs = 0 # Web-bugs are allowed.
feat_trust_pgp = 0 # Don't scan PGP signed message parts.
feat_uuencoded = 1 # Sanitize inline uuencoded files.
feat_forwards = 1 # Sanitize forwarded messages
feat_testing = 0 # This isn't a test-case configuration.
feat_fixmime = 1 # Fix invalid MIME, if possible.
feat_paranoid = 0 # Don't be excessively paranoid about MIME headers etc.
#
# Scoring
#
score_bad = 100 # Any message requring this many modifications
# will cause the sanitizer to return a non-zero
# exit code after processing the entire message.
#
# You may need to increase the following if you have a very
# complex configuration split between multiple files.
#
max_conf_recursion = 5 # The default is 5.
#
# Create temporary or saved files using this template.
# An attachment named "dude.txt" might be saved as
#
# /var/quarantine/att-dude-txt.A9Y
#
# Note: The directory must exist and be writable by
# the user running the sanitizer.
#
file_name_tpl = /var/quarantine/att-$F.$$$
# We have three policies, in addition to the default which is
# to defang file names.
#
file_list_rules = 3
file_default_policy = defang
file_default_filename = unnamed.file
# Delete obviously executable attachments. This list is VERY
# incomplete! This is a perl regular expression, see "man
# perlre" for info. The (?i) prefix makes the regexp case
# insensitive.
#
# There is only one policy, since we aren't using an external
# scanner. The file list is split accross two lines, for fun.
#
file_list_1 = (?i)\.(exe|com
file_list_1 += |cmd|bat)$
file_list_1_policy = drop
file_list_1_scanner = 0
# Scan mp3 files for Evil Viruses, using the imaginary mp3virscan
# utility. Always define FOUR potential policies, which depend on the
# exit code returned by the scanner. Which code means what is
# defined in the scanner line, which must contain THREE entries.
# The fourth policy is used for "anything else".
#
# "accept" if the file is clean (exit status 0 or 1)
# "mangle" if the file was dirty, but is now clean (2 or 4)
# "drop" if the file is still dirty (66)
# "save" if the mp3virscan utility returns some other exit code
# or an error occurs.
#
file_list_2 = (?i)\.(mp3|mp2|mpg)$
file_list_2_policy = accept:mangle:drop:save
file_list_2_scanner = 0,1:2,4:66:/path/to/mp3virscan -opt -f %FILENAME
# Scan WinWord and Excel attachments with built-in macro scanner.
# We consider anything exceeding the score of 25 to be dangerous,
# and save it in the quarantine.
#
file_list_3 = (?i)\.(doc|dot|xls|xlw)$
file_list_3_policy = accept:accept:save:save
file_list_3_scanner = 0:1:2:builtin/macro 25
</pre></font>
<p>
This probably needs to be documented better - if you are brave, you can
try reading the comments in <tt>sanitizer.pl</tt> and/or
<tt>bin/Anomy/Sanitizer.pm</tt> to get a better idea
of how this works. The text messages used to replace dropped or saved
attachments can be customized by setting the msg_file_save and
msg_file_drop variables.
</p>
<p>
Note that these rules don't apply to message parts without file names,
such parts are either treated as plain text, HTML, or left alone. In
the future policies based on MIME types or "magic" guessing might be
added to the sanitizer.
</p>
<p>
Please send me information about how to configure different
file_list_N_scanner lines for use with the commercial virus scanners out
there!
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="conf-messages"><hr><h2>Configuration - Customizing messages</h2>
<p>
All messages, except for the sanitizer log file can be customized
from within a sanitizer configuration file. An example:
</p>
<p></p><font color=#000000><pre>
#
# Add two lines of informational headers to each message.
#
header_info = X-Sanitizer: Gotcha!
header_info += \nX-Gotcha: Sanitizer!
#
# Disable these builtin headers.
#
header_url = 0
header_rev = 0
#
# Replace the "DEFANGED" string with "FIXED". This
# string is used to mangle file names, HTML and other
# stuff within the message, so the user might see it.
#
msg_defanged = FIXED
#
# Also replace a couple of other similar strings.
# These are only used by the filename mangling code.
#
msg_blacklisted = EVIL
#
# Replace the defaults with truly obnoxious messages.
# These two replace attachments which are dropped or
# saved.
#
msg_file_drop = *****\n
msg_file_drop += HA HA, I DROPPED YOUR ATTACHMENT!\n
msg_file_drop += Now you'll never see %FILENAME again!
msg_file_drop += *****\n
#
msg_file_save = *****\n
msg_file_save += Added %FILENAME as %SAVEDNAME to my\n
msg_file_save += stolen email collection.\n
msg_file_save += *****\n
#
# This is prepended to PGP signed/encrypted message
# parts, to warn the user.
#
msg_pgp_warning = WARNING: Unsanitized content follows.\n
#
# Tell the user what's going on. This prefixes the
# sanitizer log, which is always in english.
#
msg_log_prefix = This message has been sanitized. Stuff\n
msg_log_prefix += may have been altered - the following\n
msg_log_prefix += log explains what was done and why.\n
#
</pre></font>
<p>
Although I can't imagine why you would want to, you can also redefine
the messages "msg_usage" and "msg_current". These messages are only
displayed when you invoke the sanitizer incorrectly at the command line.
</p>
<p>
If you take advantage of this facility to translate the default messages
to your language, please consider sharing your translation with me so I
can include it in future releases of the sanitizer.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="conf-recommendations"><hr><h2>Configuration - Recommendations</h2>
<p>
In general, I recommend using "defang" as a default policy since keeping
track of which extensions are executable or scriptable in the windows
world this week strikes me as a rather daunting task. Defanging
(mangling the file names) allows the data to reach the user, but forces
users to take an extra step and think about what they are doing before
they can open and work with whatever they were sent.
</p>
<p>
A policy to "accept" safe extensions such as .gif, .jpg etc can be added
to make life easier for your users.
</p>
<p>
Microsoft Office documents, the most common executables, and archives
(zip etc.) should probably be scanned with a commercial virus scanner.
If you don't absolutely need to receive executable content via. email,
consider blocking it entirely.
</p>
<p>
It is rather important to block Microsoft application/ms-tnef files,
which are usually named "winmail.dat". The TNEF encoding is currently
not understood by the sanitizer, which means it can easily be used to
smuggle malicious attachments past the sanitizer unless it is blocked.
</p>
<p>
The default policies coded into the sanitizer try to accept all sorts of
plain text files, images, audio files, archives and movies. The most
common Microsoft documents are scanned by the internal macro scanner,
and if they exceed a threshold of 25 the attachments are removed and put
in quarantine. Note that their names are not defanged by default, since
that would probably get users up in arms. Anything else is defanged by
the default policy.
</p>
<p>
If you are paranoid, don't use the default configuration!
</p>
<p>
Finally, no matter what your policy - at least <i>try</i> to educate
your users. Do this both for security's sake, and to keep people from
getting mad when their email gets rewritten. If people know what is
going on and why, then they are much less likely to complain.
</p>
<p>
If you intend to use the program regularly, I recommend subscribing to
the anomy-list mailing list (see the
<a href="http://mailtools.anomy.net/">Anomy home page</a> for more
information). The traffic is currently very low, and is primarily used
to announce new versions or warn users of email-related hazards.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="conf-real"><hr><h2>A real-world configuration</h2>
<p>
The following instructions document a real-world configuration, very
similar to one currently in use in a production environment, on a
sendmail mail gateway. Instructions for configuring sendmail itself
are omitted since they are identical to those covered elsewhere in
this document.
</p>
<p>
The configuration itself is stored in <TT>/etc/sanitizer.cfg</TT>, and
looks about like this:
</p>
<p></p><font color=#000000><pre>
# Active features.
#
feat_boundaries = 0
feat_files = 1
feat_forwards = 1
feat_html = 1
feat_lengths = 1
feat_log_inline = 1
feat_log_stderr = 0
feat_scripts = 1
feat_trust_pgp = 0
feat_uuencoded = 1
feat_verbose = 1
file_list_rules = 4
#
# Note: This directory must exist and be writable by
# the user running the sanitizer.
#
file_name_tpl = /var/quarantine/att-$F-$T.$$
# Files we absolutely don't want (mostly executables).
#
file_list_1_scanner = 0
file_list_1_policy = save
file_list_1 = (?i)(winmail\.dat
file_list_1 += |\.(exe|vb[es]|c(om|hm)|bat|pif|s(ys|cr))
file_list_1 += (\.g?z|\.bz\d?)*)$
# Pure data, don't mangle this stuff (much).
#
file_list_2_scanner = 0
file_list_2_policy = accept
file_list_2 = (?i)\.(gif|jpe?g|pn[mg]|x[pb]m|dvi|e?ps|p(df|cx)|bmp
file_list_2 += |mp[32]|wav|au|ram?
file_list_2 += |avi|mov|mpe?g
file_list_2 += |t(xt|ex)|csv|l(og|yx)|sql|jtmpl
file_list_2 += |[ch](pp|\+\+)?|s|inc|asm|pa(tch|s)|java|php\d?
file_list_2 += |[ja]sp
file_list_2 += |can|pos|ux|reg|kbf|xal|\d+)(\.g?z|\.bz\d?)*$
file_list_3_scanner = 0
file_list_3_policy = accept
file_list_3 = ^[^\.]+$
# Archives and scriptable stuff - virus scan these.
# NOTE: There must be THREE groups of exit codes and FOUR policies,
# - the first three match the code groups, the fourth is default.
#
file_list_4_scanner = 0:5:3,4:/usr/local/bin/avp.sh %FILENAME
file_list_4_policy = accept:accept:save:save
file_list_4 = (?i)\.(xls|d(at|oc)|p(pt|l)|rtf|[sp]?html?
file_list_4 += |class|upd|wp\d?|m?db
file_list_4 += |z(ip|oo)|ar[cj]|lha|[tr]ar|rpm|deb|slp|tgz
file_list_4 += )(\.g?z|\.bz\d?)*$
# Default policy: accept, but mangle file name.
#
file_default_policy = defang
</pre></font>
<p>
This policy invokes the <a href="http://www.avp.ru/">AVP</a> virus
scanner for common Microsoft document formats and compressed archives.
The scanner (<TT>AvpLinux</TT>) is installed in <TT>/usr/local/avp</TT>,
and it's virus database is in the subdirectory <TT>avc</TT>. The scanner
is invoked by calling the <TT>/usr/local/bin/avp.sh</TT> script, which
looks like this:
</p>
<font color=#000000><pre>
#!/bin/bash
cd /usr/local/avp/avc
[ "$1" = "" ] && exit 21
[ -f "$1" ] || exit 20
exec ../AvpLinux -M -P -B -- $1 2>/dev/null >/dev/null
</pre></font>
<p>
Keeping the virus database in it's own special directory simplifies
updating it automatically. Such updates can be accomplished by invoking
a script once a week from cron. My script looks like this:
</p>
<font color=#000000><pre>
#!/bin/bash
#
cd /usr/local/avp/
rm -rf avc-old
mkdir avc-update || exit 1
cd avc-update || exit 1
ncftpget -V -R ftp.avp.ru . '/updates/*' || (echo 'Failed!'; exit 2)
../AvpLinux ../infected.doc >/dev/null 2>/dev/null
[ "$?" != "4" ] && (echo 'Failed!'; exit 3)
echo "OK, update complete, activating new files."
cd ..
mv avc avc-old && mv avc-update avc
</pre></font>
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="in-transit-sendmail"><hr><h2>In-transit sanitizing - sendmail</h2>
<p>
The following instructions describe <b>two</b> different methods to
sanitize in-transit email with sendmail. This works fine on a mail
gateway, but if you are just sanitizing mail being delivered to local
recipients (on the same machine as the sanitizer) then it is far simpler
and safer to use procmail as your local delivery agent and invoke the
sanitizer as described in the <a href="#install">installation chapter</a>.
</p>
<p>
One method involves using procmail as an intermediate layer between
sendmail and the sanitizer, the other method invokes the sanitizer
directly. The procmail method is recommended, since procmail provides
simple and robust error handling and logging functions. On the other
hand, the procmail method may be signifigantly slower, since it involves
at least twice as many I/O operations and perhaps some disk accesses as
well. On an already loaded system, this may not be acceptible overhead.
</p>
<p>
The choice is yours - but whatever you do <b>be careful</b>, and be sure
to test this carefully on a non-production machine before implementing
it anywhere important! Keep in mind that sendmail is a tricky beast and
this may not work on your system without lots of modifications. This
works for <i>me</i>, but <i>your</i> mileage may vary.
</p>
<p><ol>
<li><p>
If you <b>are</b> using procmail, skip steps 2. and 3.<br>
If you <b>are not</b> using procmail, skip steps 4. and 5.
</p>
<li><p>
If you <b>are</b> using procmail, <b>skip</b> this step.<br>
Create the following shell script, e.g. in
<tt>/usr/local/bin/sanitize</tt>.
</p>
<p></p><font color=#000000><pre>
#!/bin/sh
#
export ANOMY=/path/to/anomy
export CFG=/path/to/sanitizer/configuration
exec $ANOMY/bin/sanitizer.pl $CFG | /path/to/sendmail -oi -f ${@+"$@"}
</pre></font>
<p>
Be sure to set all the paths to whatever makes sense on your system.
Don't forget to make the script executable
(<tt>chmod +x /usr/local/bin/sanitize</tt>).
</p>
<li><p>
If you <b>are</b> using procmail, <b>skip</b> this step.<br>
Add the following mailer specification to <tt>sendmail.cf</tt>. It's a
good idea to add this to the part of the file containing the <i>other</i>
mailer definitions.
</p>
<p></p><font color=#000000><pre>
Msanitize,
P=/usr/local/bin/sanitize, F=DFMmhu,
S=11/31, R=21/31, T=DNS/RFC822/X-Unix, A=sanitize $f $u
</pre></font>
<li><p>
If you <b>are not</b> using procmail, <b>skip</b> this step.<br>
Create a procmail configuration file named <b>/etc/sanitizer.rc</b>
like this:
</p>
<p></p><font color=#000000><pre>
# Procmail filter rules for sanitizing email and then resending it.
# Uncomment the following lines to enable logging or verbose logging.
# VERBOSE=yes
# LOGFILE=/var/log/procmail-sanitizer.log
ANOMY=/path/to/anomy/
:0 f
| $ANOMY/bin/sanitizer.pl /path/to/sanitizer/configuration
:0
! -oi -f "$@"
</pre></font>
<p>
Be sure to set all the paths to whatever makes sense on your system.
</p>
<li><p>
If you <b>are not</b> using procmail, <b>skip</b> this step.<br>
Add the following mailer specification to <tt>sendmail.cf</tt>, if
it doesn't exist already. It's a good idea to add this to the part of
the file containing the <i>other</i> mailer definitions. Be sure to
adjust the path to the procmail binary to match your system.
</p>
<p></p><font color=#000000><pre>
Mprocmail,
P=/usr/bin/procmail, F=DFMmShu,
S=11/31, R=21/31, T=DNS/RFC822/X-Unix, A=procmail -m $h $f $u
</pre></font>
<li><p>
Add the following rules to sendmail.cf, either in ruleset 98 (local
hacks, on RedHat systems) or right before the virtual user stuff in
ruleset 0:
</p>
<p></p><font color=#000000><pre>
# Sanitize with procmail:
#R$* < @test.com. > $* $#procmail $@/etc/sanitizer.rc $:$1<@test.com.CLEAN.>$2
# Sanitize without procmail:
#R$* < @test.com. > $* $#sanitize $@anomy $:$1<@test.com.CLEAN.>$2
R$* < @ $+ .CLEAN. > $* $1<@$2.>$3
R$* < @ $+ .CLEAN > $* $1<@$2.>$3
^
use TABS here!
</pre></font>
<p>
<b>Notes:</b> Only one of the two .CLEAN rules are necessary -
which one seems slightly system-dependant. Having both won't hurt. Be
sure to replace "test.com" with the domain for which you want to
sanitize mail - the example will sanitize all messages destined for
someone@test.com. Multiple domains can be specified by repeating the
first line, once for each domain or by specifying a class of domains, as
described below.
</p>
<li><p>
Add the user sendmail runs as, on the mail port, to the list of trusted
users (the "<tt>t</tt>" class - search <tt>sendmail.cf</tt> for the phrase
"Trusted users"). This instructs sendmail not to generate a warning
header when the shell script sets the From-address when it resends the
sanitized mail. On RedHat 6.x systems this user is named "mail". This
step may not be necessary on some systems, but again, it won't hurt.
</p>
<li><p>
Finally, activate the sanitizing method you prefer (with or without
procmail) by uncommenting (removing the leading <tt>#</tt>-sign) the
relevant line added in step 6 and then restart sendmail.
</p>
</ol></p>
<p>
Please be careful to use TABs where necessary in the <tt>sendmail.cf</tt>
file. In the <tt>Msanitize</tt> and <tt>Mprocmail</tt> definitions above,
the lines have been split to improve readability - either copy the
entire text into a single line in your <tt>sendmail.cf</tt> or be sure
that the continuations begin with TAB characters, <b>not</b> spaces.
</p>
<p>
Although the above instructions all assume you are editing your
<tt>sendmail.cf</tt> file directly, they can easily be adapted for
people using the (recommended) m4 method to configure sendmail. Simply
append the mailer definitions to your m4 file in a section named
<tt>MAILER_DEFINITIONS</tt>, and the local hacks stuff to a section
named <tt>LOCAL_RULE_0</tt>. People interested in m4 configuration
might also find the <tt>anomy.m4</tt> and <tt>sendmail-m4.txt</tt>
files in the <tt>contrib/</tt> directory of the distribution helpful.
</p>
<p>
To match a class of domains (instead of just test.com), you could
replace the first R$* line(s) with something like this:
</p>
<p></p><font color=#000000><pre>
# Sanitize with procmail:
#R$* < @ $=w . > $* $#procmail $@/etc/sanitizer.rc $:$1<@$2.CLEAN.>$3
# Sanitize without procmail:
#R$* < @ $=w . > $* $#sanitize $@anomy $:$1<@$2.CLEAN.>$3
</pre></font>
<p>
This matches any host names in the "<tt>w</tt>" class (traditionally
<tt>/etc/sendmail.cw</tt>). An "<tt>X</tt>" class can be defined with
"<tt>CX host</tt>" or "<tt>FX/path/to/file</tt>" lines near the
beginning of the sendmail configuration file. People using m4
configuration can add such definitions after the <tt>LOCAL_CONFIG</tt>
directive in their m4 files.
</p>
<p>
If you are somewhat reckless (or are sure you know what you are doing),
you can just sanitize everything, like this:
</p>
<p></p><font color=#000000><pre>
# Sanitize with procmail:
#R$* < @ $+ . > $* $#procmail $@/etc/sanitizer.rc $:$1<@$2.CLEAN.>$3
# Sanitize without procmail:
#R$* < @ $+ . > $* $#sanitize $@anomy $:$1<@$2.CLEAN.>$3
</pre></font>
<p>
Please note that sanitizing everything like this is <b>not
recommended</b>, since it will sanitize both incoming and outgoing email.
</p>
<p>
It is the author's humble opinion, that incoming and outgoing email
should be handled in fundamentally different ways; incoming email should
always be delivered to the recipient, if at all possible (but it's a
good idea to defang the dangerous bits first), but outgoing email should
be bounced back to the sender if it contains a virus or security hazard.
You don't want to send partial messages out of your organization - you
want to notify the sender so they can fix the problem and re-send the
content as quickly as possible. Future revisions of this document will
describe how to use the Sanitizer to simply block risky outgoing mail.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="in-transit-qmail"><hr><h2>In-transit sanitizing - qmail</h2>
<p>
The following instructions describe one way to use the Anomy sanitizer
with qmail to filter in-transit email. This is not the simplest way
to sanitize mail destined for local users, but is quite useful on a
gateway machine.
</p>
<p><ol>
<li><p>
Install qmail with the qmail-queue-patch and qmail-qfilter.
</p>
<p>
From <a href="http://www.qmail.org/">qmail.org</a>: "Bruce Guenter has
written a patch which causes any program that would run qmail-queue to
look for an environment variable QMAILQUEUE. If it is present, it is
used in place of the string "bin/qmail-queue" when running qmail-queue.
This could be used, for example, to add a program into the
qmail-smtpd->qmail-queue pipeline that could do filtering, rewrite
broken headers, etc."
</p>
<p>
This is just what we are going to use. You will find the
qmail-queue-patch here:
<a href="http://www.math.ntnu.no/mirror/www.qmail.org/qmailqueue-patch">http://www.math.ntnu.no/mirror/www.qmail.org/qmailqueue-patch</a>
(and on every other qmail-mirrior site).
</p>
<p>
qmail-qfilter is found here:
<a href="http://em.ca/~bruceg/qmail-qfilter/">http://em.ca/~bruceg/qmail-qfilter/</a>.
</p>
<li><p>
Install tcpserver (ucspi).
</p>
<p>
You can find this here:
<a href="http://em.ca/~bruceg/rpms/ucspi-tcp/">http://em.ca/~bruceg/rpms/ucspi-tcp/</a>.
</p>
<li>
<p>
Make tcpserver set the qmail-queue-parameter/variable
</p>
<p>
This is done by editing the <tt>/etc/tcpcontrol/smtp.rules</tt> file.
The file should look something like:
</p>
<p></p><font color=#000000><pre>
# Myself going through the filter
127.0.0.1:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/filters/smtpd-queue"
# Server(s) allowed to relay, but not going through the filter
xxx.xxx.xxx.xxx:allow,RELAYCLIENT=""
# Default (everyone else must go through)
:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/filters/smtpd-queue"
</pre></font>
<p>
Compile the file (tcpserver uses a compiled version of this file with a
.cdb-extension). If you also use qmail-qmqpd or any other
qmail daemon that receives incoming mail, be sure to edit and
recompile the corrosponding rule file (e.g.
<tt>/etc/tcpcontrol/qmqp.rules</tt>) and use the same value for
QMAILQUEUE in both (or all) places.
</p>
<p>
Now you have tcpserver accepting connections, sending the incoming email
with the QMAILQUEUE-variable set to the script "smtpd-queue".
</p>
<p>
The script smtpd-queue (or whatever you choose to call it) should look
something like:
</p>
<p></p><font color=#000000><pre>
#!/bin/sh
exec /usr/bin/qmail-qfilter
/var/qmail/filters/sanitizer /var/qmail/filters/sanitizer.cfg
</pre></font>
<p>
Note: the exec command has been split between lines for readability.
It should all be in one line.
</p>
<p>
What happens here is that qmail-qfilter passes the email to sanitizer
(which starts with a config-file in this example). When sanitizer is
finished with it, it is passed back qmail so it can be sent the usual
way.
</p>
<li><p>
Configure qmail to act as a relay server.
</p>
<p>
Read the FAQ if you don't know how to do this.
</p>
</ol></p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="in-transit-others"><hr><h2>In-transit sanitizing - others</h2>
<p>
In general, the sanitizer should be able to work with any mail transfer
agent that runs on Unix (and with minor tweaks, the sanitizer should be
able to run just fine on e.g. Windows).
</p>
<p>
The thing to look for, are filtering hooks in your MTA. If your MTA has
a filtering API already defined, then try and get it to spit messages
out to the sanitizer on standard input and recapture the sanitizer's
standard output. If that doesn't work, then you can probably wrap your
local delivery agent with a shell script that passes messages through
the sanitizer first. Use your imagination! Let me know how it goes.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="perf-cpu"><hr><h2> Performance - CPU </h2>
<p>
Perl may not be a very fast language, but if speed isn't critical it is
a good choice for a program like this, since it has good pattern
matching facilities and there are no buffer overflows to worry about.
Implementing the scanner in C or C++ would be somewhat more efficient,
but would be much harder to make as secure and flexible.
</p>
<p>
But I still want the script lean enough to be useable on a production
mail server with lots and lots of traffic. To achieve this I will try
to keep the script's CPU usage O(length-of-message) and consumption of
other resources as close to a constant as possible, so the script will
scale well. I won't create temporary files unless/until I add support
for third party virus scanners (like AMaViS has).
</p>
<p>
I ran a few tests on revision 1.10 to see if my choice of language would
make these design constraints pointless (basically, I wanted to answer
the question of whether Perl can do the job or not).
</p>
<h3>Test data:</h3>
<p>
The sanitizer was tested on my 525Mhz Celeron (bus OC'ed to 95Mhz), with
the following messages.
</p>
<p></p><font color=#000000><pre>
file size description
--------- --------- -----------
Dev.test1 2206 a plain RFC822 message with no attachment
Dev.test2 26227 3 parts:
a text part with a UU-encoded evil HTML snippet
a html part with evil html
a harmless plain text part
Dev.test3 2342 a multipart/signed message containing clean text
Dev.test4 17139 3 parts:
a uu-encoded text part
a plain text part with an UU-encoded perl script
an unencoded perl script (8bit, text/plain)
Dev.test6 4984617 a multipart mixed message with a big base64-encoded
jpeg attachment.
</pre></font>
<h3>Results:</h3>
<p></p><font color=#000000><pre>
[bre@diskordiah bin]$ time ./sanitizer.pl </dev/null
0.10user 0.01system 0:00.10elapsed 101%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (282major+194minor)pagefaults 0swaps
[bre@diskordiah bin]$ time ./sanitizer.pl <../Dev.test1 >/dev/null
0.12user 0.00system 0:00.14elapsed 85%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (287major+201minor)pagefaults 0swaps
[bre@diskordiah bin]$ time ./sanitizer.pl <../Dev.test2 >/dev/null
0.47user 0.00system 0:00.47elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (289major+283minor)pagefaults 0swaps
[bre@diskordiah bin]$ time ./sanitizer.pl <../Dev.test3 >/dev/null
0.13user 0.00system 0:00.12elapsed 101%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (287major+204minor)pagefaults 0swaps
[bre@diskordiah bin]$ time ./sanitizer.pl <../Dev.test4 >/dev/null
0.20user 0.03system 0:00.25elapsed 91%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (288major+223minor)pagefaults 0swaps
[bre@diskordiah bin]$ time ./sanitizer.pl <../Dev.test6 >/dev/null
12.63user 0.05system 0:13.00elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (970major+257minor)pagefaults 0swaps
</pre></font>
<h3>What it all means:</h3>
<p>
The worst case (bytes/sec) is the smallest message, due to the overhead
of starting perl and compiling the parser (about 0.10 seconds). This
case only gives us a throughput of 15Kb/sec (kilobytes/sec), which is
actually rather appalling (just imagine the case if we were forking 10
processes, instead of one).
</p>
<p>
The best case, Dev.text6, has a througput of over 350Kb/sec. Most of
the work done in this case is just decoding/copying/encoding the Base64
attachment, without even examining the contents (it's a jpeg). The
decoding and encoding could easily be optimized away for attachments we
don't intend to sanitize (such as graphics). So large attachments
aren't a problem, CPU-wise - not compared to the small messages anyway.
</p>
<p>
Since someone told me that the average size of email these days is close
to 20k, then either Dev.test2 (55Kb/sec) or Dev.test4 (68Kb/sec) might
be representative of the average throughput of the sanitizer on my
system.
</p>
<p>
So for any network connection under 1MB/sec (1 megabit), a dual 500Mhz
PIII should be able to sanitize all the incoming mail, without any
noticable delays and with cycles to spare - even during peak hours. If
you don't mind a slight delay (and aren't expecting any mail bombs...)
you can probably get away with less hardware, more bandwidth or both.
</p>
<p>
Is this good enough? Please <a href="mailto:bre@netverjar.is">let me
know</a> what you think.
</p>
<p>
Since the performance is almost entirely CPU bound, throughput could be
increased linearly by simply adding more processing power, e.g. by
adding more or faster CPUs to your mail server, or by creating a
sanitizer farm.
</p>
<p>
Another method to speed things up would be to change the sanitizer into
some sort of daemon, thus avoiding the startup- and compilation costs of
perl entirely. Since initialization accounts for 25-45% of the time it
takes to process the "average message", and over 75% of the time for the
small messages (which are very common), this would make quite a
difference.
</p>
<p>
OTOH, the performance is only going to get worse, once external virus
scanners are added to the mix...
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="perf-memory"><hr><h2> Performance - Memory </h2>
<p>
<b>Note:</b> <a href="#mh-memory-hog">read this</a> if you are having
problems with excessive memory consumption when sanitizing very large
messages.
</p>
<p>
While scanning the big message (Dev.test6), top consistantly reported
memory usage as (SIZE, RSS, SHARE) = (2084, 2084, 1052). For Dev.test4
the numbers were (1952, 1952, 1056) and for Dev.test1 they were (1860,
1860, 1052).
</p>
<p>
The difference is probably due to Dev.test6 maxing out all the IO
buffers it had available, which the other tests were too small to do. I
verified this theory by tripling the size of Dev.test6 - the resulting
numbers were almost identical (2088 instead of 2084). Cool!
</p>
<p>
This doesn't mean that more memory usage is impossible - the sanitizer
allocates a new set of buffers for each level of nesting within the
message. A memory DoS attack could be launched by deeply nesting
uuencoded parts within each other - this could at the moment raise the
memory (and CPU) usage arbitraily. But this would be a deliberate
attack, such messages are rarely, if at all, created by normal mailers.
</p>
<p>
This could be addressed by adding a maximum recursion limit to the
sanitizer, but I haven't done so yet and am not sure it's necessary.
Aren't there easier ways to attack a mail server?
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="mh-scanner-codes"><hr><h2>Virus scanning doesn't work!</h2>
<p>
The most common reason people have a hard time getting external virus
scanners to work, is they enter incorrect <tt>file_list_N_scanner</tt>
and/or <tt>file_list_N_policy</tt> lines.
</p>
<p>
There must be <b>four</b> policies, and <b>three</b> groups of exit
codes, otherwise the scan won't work. The rationale for having three
code groups and four policies is that virus scan results fall into the
following categories:
</p>
<p>
<ol>
<li> Clean files - no infections found.
<li> Cleaned files - infectiosn found but were successfully disinfected.
<li> Infected files - unremovable infections were found.
<li> Errors.
</ol>
</p>
<p>
The <a href="#conf-real">real world configuration</a> example illustrates
this.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="mh-anomy-env"><hr><h2>The testcases succeed, but I can't run the sanitizer!<br>
What is the ANOMY environment variable for?</h2>
<p>
The ANOMY environment tells the Sanitizer script where to look for
it's modules, MIMEStream.pm and Sanitizer.pm. Unless it is set, the
Sanitizer won't run. The test cases all set this variable properly,
which is why they succeed even though you can't run it yourself.
</p>
<p>
Alternatives:
<ul>
<li>Add the <tt>/path/to/anomy/bin/</tt> directory to
your PERL5LIB environment variable in some global place such as
<tt>/etc/profile</tt>.
<li>Add a symbolic link to some other directory normally searched by Perl
for libraries. The symbolic link should be named "Anomy" and should
link to <tt>/path/to/anomy/bin/Anomy/</tt> directory.
</ul>
</p>
<p>
Which method is best is simply a matter of taste.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="pf-solaris-procmail"><hr><h2> Solaris and Procmail </h2>
<p>
A few users have reported that to get the Sanitizer to work from
within procmail on Solaris the following lines must be added either
to <tt>/etc/procmailrc</tt> or the <tt>.procmailrc</tt> file which
invokes the sanitizer:
</p>
<p></p><font color=#000000><pre>
PATH="/usr/bin:$PATH"
SHELL=/bin/sh
</pre></font>
<p>
Special thanks to <b>Peter Burkholde</b> for his detailed feedback.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="pf-postfix"><hr><h2> Incoming mail and Postfix </h2>
<p>
Patrick Duane Dunston
<<a href="mailto:duane@duane.yi.org">duane@duane.yi.org</a>> and
Bill Kenworthy contributed a short how-to on configuring Postfix to
filter messages through the sanitizer before delivery. Their instructions
may be found in the <tt>contrib/</tt> directory of the program distribution.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="mh-memory-hog"><hr><h2>Large messages and memory consumption</a></h2>
<p>
Some people have reported problems with very large messages
and excessive memory consumption when invoking the sanitizer from within
procmail. These problem is caused by procmail, not the sanitizer. If
you have this problem, consider limiting incoming message size to
something that will fit in your mail server's memory or invoking the
sanitizer directly (without procmail).
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="mh-html-uuencode"><hr><h2>Corrupt attachments from Outlook users</a></h2>
<p> <b>Q:</b> <i>
My problem is that attachments from Exchange/Outlook users get
corrupted. The end result is that the document is completely unreadable
when detached. One of the symptoms is that it ends up with the word
"DEFANGED" being inserted into the body of the attachment:
<ul>
<tt>M````````````````><DEFANGED.35 M`````````````````````````</tt>
</ul>
</i></p>
<p> <b>A:</b>
This is HTML defanging, defanging the contents of an UU-encoded
attachment. This only happens when the following conditions are all
met:
<ol>
<li> Users send attachments UU-encoded, instead of using the standard
MIME encoding.
<li> HTML defanging is on (feat_html=1).
<li> UUencoded attachment support is off (feat_uuencoded=0).
</ol>
</p>
<p>
The solution is to turn on uuencoded attachment support, or turn off
HTML defanging. The latter is not recommended.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="mh-style-tag"><hr><h2>Ugly HTML mail from Outlook users</a></h2>
<p>
<b>Note:</b> This problem was hopefully solved when the HTML cleanup
code was rewritten for revision 1.45 of the sanitizer.
</p>
<p> <b>Q:</b>
<i>I'm not sure if this is a bug per se, but mail received
from Outlook XP using Word as the editor in HTML format looks very ugly.
I've attached an example. I'm using anomy 1.35. I'd really appreciate
any hints on how to configure or patch anomy to handle this!</i>
</p>
<p> <b>A:</b>
This is a known issue with the sanitizer, inherited from John
Hardin's procmail ruleset.
</p>
<p>
It has to do with the defanging of <STYLE>...</STYLE>
blocks, which were invented by someone with no clue of HTML design
philosopy. Instead of the style settings being attributes or "funny
tags" they are simply written out as a CSS definition following the
<STYLE> tag - when the <STYLE> tag gets defanged, the CSS
info is revealed as text where it used to be invisible.
</p>
<p>
The reason this is all so stupid is <i>the exact same thing happens</i>
if the un-defanged HTML is viewed in a browser that doesn't know about
STYLE tags.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="hacking"><hr><h2>Hacking the Anomy sanitizer</h2>
<p>
These are short introductory chapters, for those interested in hacking
on the Anomy sanitizer. The source code is somewhat commented, but it's
probably pretty hard to grasp the overall organization of the code by
jumping right in. So start here. :-)
</p>
<p><ul>
<li> <a href="#hack-design">Basic design</a>
<li> <a href="#hack-streams">Why treat the mail as a stream?</a>
<li> <a href="#hack-cruft">Rough edges</a>
<li> <a href="#hack-standards">Standards</a>
</ul></p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="hack-design"><hr><h2>Hacking - Basic design</h2>
<p>
The sanitizer is built around my MIMEStream (Anomy::MIMEStream) module,
which lives in the <tt>anomy/bin/Anomy/</tt> directory. This module was
designed to allow parsing and editing of arbitrarily complex MIME
streams. It contains facilities for decoding MIME streams, as well as
routines for rebuilding or creating such streams from scratch.
</p>
<p>
The MIMEStream module contains a MIME parsing engine which interprets
the basic RFC822/MIME structure of the message and hands each part to a
handler provided by the application using it (in this case the
sanitizer).
</p>
<p>
Handlers are selected based on the MIME-type of the given part. At
initialization, the sanitizer registers it's handlers with the parsing
engine, and then essentially says "Go forth and parse" - and that's
that. The actual flow of the program is controlled by MIMEStream, but
most of the work takes place within the part handlers.
</p>
<p>
Each handler makes use of Read() and Write() functions provided by the
parser engine, to read the decoded message part, possibly modify it, and
send the results back to the parser. The parser re-encodes the data and
ultimately sends the results to the output stream. The Read() and
Write() functions hide all buffering, decoding and encoding involved in
"stream editing" a typical MIME message.
</p>
<p>
The decoding and encoding mechanism is designed to handle nested
encodings, even though such messages would violate the MIME standard
(you aren't allowed to e.g. Base64-encode a multipart/ part). The need
for this becomes apparent when you consider that non-MIME attachments
(uuencoded files, forwarded messages) should be scanned as well. For
example, a well formed MIME message may have a Base64 encoded text/plain
part, which itself contains a uuencoded file. If that uuencoded file
happens to contain a RFC822 message with multipart-MIME attachments,
then it can be argued that the message hasn't been scanned completely
unless the parser nests it's decoding/encoding all the way down and
scans the contents of the uuencoded message.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="hack-streams"><hr><h2>Hacking - Why treat the mail as a stream?</h2>
<p>
The reason I'm focusing on streams of data instead of messages on disk,
is because in my opinion streams more accurately reflect the real world
the sanitizer must work in. The mail system has no control over the
length of the messages that are sent through it, so preferably resource
usage should be influenced as little as possible by the size of those
messages. This is not merely a performance issue, but also one of
security - the sanitizer is supposed to be a tool for <i>enhancing</i>
security, so I want to ensure that installing it opens up as few new
attack routes as possible.
</p>
<p>
The pros of using a stream-based model:
<ul>
<li>
Memory and disk space usage is not proportional to the size of the
message being processed, instead it is proportional to the complexity
of the message (MIME nesting depth etc.) and the nature of the
security policy (third party virus scanners generally hog both memory
and disk space). This makes the sanitizer much more scalable that it
would be otherwise.
<li>
Solving the basic problem of a MIME-stream decoder/encoder almost
automatically involved solving the deeply nested encoding problem
described above.
</ul>
</p>
<p>
The cons:
<ul>
<li>
There are tight constraints on what the sanitizer can do. Once it has
moved forward in it's input stream, it must eventually flush some of
it's buffers and commit their contents to the output stream - and once
it has done so, there is no turning back. So in general, aside from
very limited "look ahead" tests, all output must be based the
corrosponding input data or data that came before it. For example,
message headers cannot be altered based on a signature at the end of
the message body - by the time we reach the end of the message, the
headers will have been committed to the output stream long ago.
<li>
The constraints imposed by streaming can lead to hairy code,
especially where two unrelated scans are forced to run simultaniously
(e.g. in the text scanner, which must check simultaniously for
uuencoded attachments and HTML content - two fundamentally different
things).
<li>
Sometimes, the stream model just doesn't work and I have to resort to
dumping part of the message to disk anyway and working with it from
there. External virus scanners all (AFAIK) require this sort of
compromise.
</ul>
</p>
<p>
Obviously, I think the benefits of streaming (scalability) are more valuable
than making my life as a programmer easier. Besides, writing it the hard
way is much more fun!
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="hack-cruft"><hr><h2>Hacking - Rough edges</h2>
<p>
There are quite a few things which need fixing and cleaning up in the
sanitizer's code. To name a few:
</p>
<p>
<ul>
<li>
The sanitizer and MIMEStream are too tightly coupled - there is no well
defined, clear interface between them. The sanitizer's handlers
shamelessly assume things about how MIMEStream works and mess directly
with MIMEStream objects' internal variables.
<li>
There's so much work to be done on standards compliance, that I've
devoted a <a href="#hack-standards">whole section</a> to the topic.
<li>
The documentation needs lots of work. Specifically, the sanitizer
should be able to work with any MTA out there, but unless I document it
then people won't do it.
<li>
I really need to allow people to define policies based on MIME types or
"magic" in addition to the current filename policies.
<li>
The sanitizer could really use a virus-scanner front end tool which
could do all the neat unpacking things that
<a href="http://www.amavis.org/">AMaViS</a> does. It should be easy
enough to remove the email-related stuff from AMaViS...
</ul>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="hack-standards"><hr><h2>Hacking - Standards</h2>
<p>
There are a relatively large number of MIME standards which the MIME
stream editor and the sanitizer need to take into account. In general
security has been favored over strict compliance, especially when the
standards mandate "ignoring" certain message parts, such as signed parts
or message/rfc822 headers. We sanitize those parts anyway, unless
expressly told not to.
</p>
<p>
Most features which are known to violate the MIME standards are optional
and efforts will be made to make the rest of them optional as well.
</p>
<p>
Currently, if given non MIME-compliant input, the sanitizer will
probably generate non MIME-compliant output. One such example is an
illegally encoded multipart type (neither 7bit or 8bit) or an illegal
value for the Content-Transfer-Encoding headers. The scanner will
accept and scan messages with some illegal encoding combinations, but
won't correct the error.
</p>
<p><b>RFC822:</b></p>
<p>
The sanitizer and MIMEStream module conforms to this RFC - almost.
Currently there are probably bugs to do with header comments and
end-of-line markers (CRLF).
</p>
<p>
These problems will be fixed Real Soon Now.
</p>
<p>
<b>RFC2045-9</b>: Multipurpose Internet Mail Extensions (MIME)<br>
<b>RFC2424</b>: Content Duration MIME Header Definition<br>
<b>RFC2387</b>: The MIME Multipart/Related Content-type
</p>
<p>
The sanitizer appears to conform to these RFCs, as long as all scanned
data is completely "clean" and no defanging or rewriting is necessary to
enforce the selected policy.
</p>
<p>
All exceptions involve possibly rewriting parts which the RFC mandates
that MTAs treat as opaque, such as message/rfc822. In the future a list
of such deviations will be created, and switches added to the code to
make such devations optional, where possible.
</p>
<p>
Support for message/partial parts is currently incomplete, and may never
be supported since reassembling messages is beyond the scope of this
program and would have serious performance implications.
</p>
<p>
<b>RFC2231</b>: MIME Parameter Value and Encoded Word Extensions.
</p>
<p>
Partially compliant, as of 1.45. This on my TODO list.
</p>
<p>
<b>RFC1847</b>: Security Multiparts for MIME<br>
<b>RFC2015</b>: MIME Security with Pretty Good Privacy (PGP)<br>
<b>RFC2480</b>: Gateways and MIME Security Multiparts
</p>
<p>
The sanitizer and MIMEStream module conform to these RFCs, with the
exception of optionally sanitizing and modifying the contents of signed
parts. Encrypted parts probably won't be be understood by the sanitizer
anyway, so they shouldn't be effected. But don't be surprised if the
sanitizer breaks PGP signatures!
</p>
<p>
It's a matter of opinion whether I conform to RFC2480, which discusses
exactly these problems. At the moment there is plenty of room for
improvments within the sanitizer, and conformance with this RFC is one
of my goals.
</p>
<p>
<b>RFC2311</b>: S/MIME Version 2 Message Specification<br>
<b>RFC2312</b>: S/MIME Version 2 Certificate Handling
</p>
<p>
Compliant, subject to the caveats above about rewriting signed parts,
but support is very incomplete since the contents of S/MIME messages may
not be sanitized by the scanner since it doesn't currently recognize
them.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="feedback"><hr><h2> Feedback </h2>
<p>
Please let me know if you use this program!
</p>
<p>
Without feedback I might get discouraged and start playing video games
or work on my juggling - writing this is alot of work and at the moment
I'm not getting paid at all to do it. IMHO the least you can do is send
me email...
</p>
<p>
My email address is
<a href="mailto:bre@netverjar.is?Subject=Sanitizer">bre@netverjar.is</a>,
please put "sanitizer" somewhere in the subject line.
</p>
<p>
Some questions:
</p>
<p><ol>
<li>
Are you, or do you intend to use the program? If not, why not?
<li>
At what sort of site(s) are you using the sanitizer?
<li>
What sort of email are you sanitizing? Incoming? Outgoing? Commercial?
Private? Mailing lists?
<li>
Would you mind sharing your policies with other users of the program?
<li>
What do you think is the biggest problem with the sanitizer?
<li>
What do you think is it's best feature?
<li>
Is the sanitizer fast enough for you? Approximately how much mail does
it process for you every day? For how many users?
<li>
Would you be willing to pay for future enhancements or support? How
much? What kind of enhancements or support? Would you be willing to
donate money as a token of gratitude for what I've already done?
<li>
Have you purchased any third party virus scanners, to use with the
sanitizer? Which one(s)?
</ol></p>
<p>
Finally, if the program proves useful to you and you haven't time to
contribute code, documentation or bug reports - then please consider
<A HREF="http://orders.kagi.com/?35Q">supporting the project with
a cash donation</A>. I'm doing this in my spare time, and all
encouragement helps.
</p>
<p>
Thanks!
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<a name="credits"><hr><h2>Credits & GPL</h2>
<p>
Copyright (C) 2000
<a href="http://bre.klaki.net/">Bjarni R. Einarsson</a>
<<a href="mailto:bre@netverjar.is">bre@netverjar.is</a>>.<br>
All rights reserved.
</p>
<p>
Development of the Anomy Sanitizer, from versions 1.35 onwards, has been
primarily sponsored by <a href="http://www.f-prot.com/">FRISK Software
International</a>. Please consider buying their anti-virus products to
show your appreciation.
</p>
<p>
The sanitizer contains code and implements ideas by John D. Hardin
<<a href="mailto:jhardin@wolfenet.com">jhardin@wolfenet.com</a>>.
</p>
<p>
Kim Johnny Mathisen
<<a href="mailto:Kim.Mathisen@haukeland.no">Kim.Mathisen@haukeland.no</a>>
contributed the instructions for
<a href="#in-transit-qmail">in-transit sanitizing with qmail</a>.<br>
Mark Salazar
<<a href="mailto:msalazar@schaferdc.com">msalazar@schaferdc.com</a>>
submitted improvements to the qmail chapter as well.<br>
Sterling Hanenkamp
<<a href="mailto:Sterling@nrg-inc.com">Sterling@nrg-inc.com</a>>
contributed pointers on in-transit configuration of sendmail, using the
recommended m4 method.<br>
</p>
<p>
Ideas were also borrowed from <a href="http://www.amavis.org/">AMaViS</a>
and <a href="http://www.inflex.co.za/">Inflex</a>.
</p>
<p>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
</p>
<p>
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
</p>
<p>[ <a href="#top">contents</a> ]</p>
<!-- ---------------------------------------------------------------------- -->
<hr>
<p>$Id: sanitizer.html,v 1.20 2003/04/30 01:45:24 bre Exp $</p>
</body></html>
|