AM,

If you're just trying to prevent the casual user from seeing the password and then connecting to your db another way, a better approach is to lock down on the database server side. Create a stored-proc (or a view) that returns (or contains) just the data the script would return. Then grant your script user permission to access just that stored-proc (or view).

Trying to lock down the script is just not the right approach. Even if it was compilied (and the binary fit your size reqs), It would be in the text area of the binary (accessible via strings). You could obfuscate it but it will still go out on the wire unencrypted (unless you're going to encrypt the wire to).

If it's a web script, don't worry about it. Ensure your db is properly secured (ala para 1) and your web server is properly secured and your firewall is properly secured (all your onion layers) and just embed the password in the script. If everything is correct, just the web user would be able to read it and only your admins could become the web user.

If it's a regular script and you don't want to go to para 1 lengths, you could set up a pki infastructure but that's going to be way more time consuming.

-derby

Update: FoxtrotUniform Good idea but I think the interface to the mysql connect needs the cleartext password (and even if it just needed the hash, you'd still have a problem cause then all I'd need is the hash - same problem different format).


In reply to Re: Hiding Passwords by derby
in thread Hiding Passwords by Anonymous Monk

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.