How can I encrypt or hide passwords in a Perl script used to connect to mysql database -
i wondering best way store usernames , password connect mysql database?
an easy , safe way — if right — config file. dbi/dbd mysql connection string like–
dbi:mysql:my_dbname;mysql_read_default_file=/non-web/path/to/.my.cnf
–and pass no user or password dbi connection call.
the .my.cnf file have password. ways keep safe include–
- file only readable webuser.
- file outside web root; visiting url cannot possibly reach it.
- the config file contains bare minimum connect, not need user name example.
- make sure there no exploits in application might allow browsing of file system.
- the webuser's mysql account has limited privileges: no grant, no create|drop tables, etc, etc.
Comments
Post a Comment