If someone feels up to it, the right way to do this is to write a module that will take each file it is used in and checks a PGP signature against a list of known valid PGP signatures. It would skip any file with a known MD5 signature. The list of MD5 signatures would, of course, correspond to the existing installed modules and the list of PGP signatures would correspond to the public keys of authorized developers. Both lists would be installed by root and therefore could not easily be modified by users. (You need two lists because you might run into trouble if you alter existing installed modules. PGP allows people to sign modules. MD5 avoids having to change the module.)

It is easy to use this module liberally. What should be doable is modifying perl to insert the check for every single file that is loaded.

This anti-virus protection would take some work, would be a pain in the rear end, and would slow Perl. But you could at long last sleep at night confident that your Perl code was not being modified without the knowledge and consent of an authorized person. Unless the PGP keys got compromised, but then you can rescind keys.

BTW anyone heading down the path of cryptographically signed Perl code should look at some of the other possible uses for cryptography. If your imagination fails, look at ACME::Bleach and friends...


In reply to Re (tilly) 1: Virus protection for Perl scripts by tilly
in thread Virus protection for Perl scripts by tachyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.