[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] perl->c supporting Mac extensions? (fwd)



According to Chris Nandor:
> 
<snip>
> Yes, it is doable (I think!).  No, it is not desirable (I am not speaking
> for Matthias here, but for the general sentiment of the Perl community).
> 
> Perl is founded on openness of code.  Of course, there is nothing forcing
> you to comply with that philosophy, but when you realize that without such
> openness you never would have been able to do or learn what you have done
> and learned, then it becomes hard to justify non-readable scripts.
<snip>

I can see a couple of reasons why someone would want to be
able to hide the code.  The first is security, the second
is to prevent thief.

On a system where you can disable FTPing of files and you
can prevent someone from executing commands through
sendmail.  Or in other words - if you can make it so only
your web server can get to the files, then you can try the
following.  It isn't guaranteed to work but it can help.

A. Create your Perl files.
B. Set them to be owned by the web server.
C. Set their chmod to 000.
D. Create a new Perl program.
D1. Make this program accept the names of files to execute.
D2. Make this program first chmod the file to be read to
	400 and then include the file into the program or chmod
	the program to 700 and use the system command to execute it.
E. Reset the chmod to 000 on the file.

This would make your scripts execute slower but it gives
you a two step filter which, even if the person knew what
the file name was - they would not be able to view the file
and/or retrieve it because the file doesn't allow anyone to
do anything with the file until it has been chmod'd.  So
long as the person can not execute commands on your system,
this should be fairly secure.