I use the below module as a layer of security between my database accessing perl scripts and potential trouble makers. I'm sure there are better ways to implement this, however this is what I use.
My question is regarding the directory and file permissions of the module and the directory containing the module. What settings would be the most secure. This will be hosted on a shared UNIX hosting provider. Currently both file and directory are set at 755.
Thanks.
package DB;
use strict;
use DBI;
sub connect
{
my $db_name = "xxx";
my $host_name = "xxx";
my $user_name = "xxxxxx";
my $password = "xxxx";
my $dsn = "DBI:mysql:host=$host_name;database=$db_name";
return (DBI->connect ($dsn, $user_name, $password,
{ PrintError => 0, RaiseError => 1}));
}
1;
If there are safer means of accomplishing this ( removing user and pass info out of the script ) please mention them.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.