You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jason Leidigh <jl...@uol.com.ar> on 2000/12/18 16:08:27 UTC

Precompile to protect code?

I have a mod_perl module which I would like to protect.  The code is very "private" and I would like to have it exist only as perl byte code... which can be used each time the server may be restarted... is this possible?  How?  Thanks in advance and to those wo responded to may last question "Help me beat Java..." 

Jason Z. Leidigh
Project Leader
UOL Internacional
Av.Libertador 1068 - Piso 3
Capital Federal - ( C1112ABN )
Buenos Aires - Argentina
T.E: 0054-11-5777-2446
Fax:      0054-11-5777-2402
www.uol.com.ar
jleidigh@uol.com.ar

Re: Precompile to protect code?

Posted by Ernest Lergon <Er...@virtualitas.com>.
Jason Leidigh wrote:
>
> I have a mod_perl module which I would like to protect.  The code
> is very "private" and I would like to have it exist only as perl byte
> code... which can be used each time the server may be restarted... is
> this possible?  How?

Just out of my head:

Make a directory like /lib/perl/private and chmod 700 it.
Put your module MyModule.pm there and chmod 600 it.
In your startup.pl (called from httpd.conf) put

use lib qw ( /lib/perl/private );
use MyModule;

I think this would work, because httpd is started from root, so it can
read the module.

For all other users than root the directory and module is invisible.

I have not tested it - maybe I'm wrong...

Ernest




--
Yours sincerely
Mit freundlichen Grüßen

Ernest Lergon

                VIRTUALITAS
Artists online, Fine Arts online, Poets online
        http://www.virtualitas.com/



Re: Precompile to protect code?

Posted by Matt Sergeant <ma...@sergeant.org>.
On Mon, 18 Dec 2000, Jason Leidigh wrote:

> I have a mod_perl module which I would like to protect.  The code is
> very "private" and I would like to have it exist only as perl byte
> code... which can be used each time the server may be restarted... is
> this possible?  How?  Thanks in advance and to those wo responded to
> may last question "Help me beat Java..."

If you're writing it as a handler, or mostly as a module, you can do this
using a source filter and some obfuscation. But note that this is *only*
obfuscation, and not compilation. However the same is true of Java
bytecode decompilers - they can produce *very* clean code from decompiling
bytecode. There's an example of an XOR filter in the Filter module source
code (I'm not talking about Apache::Filter here by the way, this is the
Filter.pm module from CPAN).

There are other techniques possible, but none are particularly reliable
and none will be 100% secure.

-- 
<Matt/>

    /||    ** Director and CTO **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // **     Personal Web Site: http://sergeant.org/     **
     \\//
     //\\
    //  \\