[use DBI] - how to improve security in perl script (
am 17.05.2011 23:46:26 von hye-jin.wooDo you know how to improve security on perl?
Do you know how to encrypt the ID and PW in perl
Specious guy can get ID and PW in perl script.
I have been making the script to get DB healthcheck info about 20 DB server=
s everyday.
I use DBI module.
But, I have to enter id and pw in perl script.(example below)
It make security weak.
Thank you in advance
use strict;
use DBI;
##################### DBI configuration ########################
my $hostip =3D "127.0.0.1";
my $username =3D "hr"; <- how to encrypt id
my $password =3D "hr"; <- how to encrypt pw
my $sid =3D "orcl";
my $dsn =3D "DBI:Oracle:host=3D$hostip;sid=3D$sid";
my %attr =3D ( RaiseError =3D> 1, AutoCommit =3D> 0 );
# howto 1
my $dbh =3D DBI->connect ($dsn, $username, $password, \%attr) || die "Datab=
ase connection not mode : $DBI::errstr";
# howto 2
#my $dbh =3D DBI->connect ("DBI:Oracle:host=3D$hostip;sid=3D$sid", $usernam=
e, $password, \%attr);
my $que =3D "select * from jobs";
my $i1;
my $cursor =3D $dbh->selectall_arrayref($que);
for (@$cursor) {
print "@{$_} \n";
}
$dbh->disconnect;
##################### DBI configuration ########################
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/