View previous topic :: View next topic |
Author |
Message |
DijiTao Tux's lil' helper
Joined: 23 Nov 2003 Posts: 94
|
Posted: Wed Mar 23, 2005 3:21 pm Post subject: Making mod_php / cracklib / cracklib-words / PECL-crack work |
|
|
I've currently have an apache2 web sever running mod_php and everything is working correctly however when trying to write a php script that makes use of cracklib I run into problems.
I get the following error:
Code: | Warning: crack_opendict(): Unable to open a crack dictionary in /var/www/localhost/htdocs/test.php on line 3
Unable to open CrackLib dictionary
|
Ive emerged cracklib, cracklib-words, and PECL-crack and I didnt seem to have any problems. I did an emerge --newuse after adding the cracklib use flag, it didnt seem to effect anything.
Here is my php code
Code: | <?php
// Open CrackLib Dictionary
$dictionary = crack_opendict('/usr/share/dict/cracklib-words')
or die('Unable to open CrackLib dictionary');
// Perform password check
$check = crack_check($dictionary, 'gx9A2s0x');
// Retrieve messages
$diag = crack_getlastmessage();
echo $diag; // 'strong password'
// Close dictionary
crack_closedict($dictionary);
?>
|
This code is directly ripped off from here: http://php.planetmirror.com/manual/en/ref.crack.php with the only change being made to reflect where gentoo likes to put cracklibs dictionary.
Here are my current USE flags:
Code: | USE="-qt -kde gtk gnome X apache2 mysql php pam ssl xml xml2 berkdb innobd tcpd acpi gd gd-external openssl jpg png gif session cracklib"
|
Here is my /etc/portage/package.keywords
Code: | net-analyzer/snort ~x86
net-analyzer/acid ~x86
dev-php/jpgraph ~x86
dev-php/PECL-crack ~x86
|
Here is my /var/lib/portage/world
Code: | media-libs/gd
app-forensics/chkrootkit
media-sound/alsa-utils
sys-fs/reiserfsprogs
x11-misc/xscreensaver
net-mail/sendEmail
dev-php/jpgraph
sys-kernel/linux-headers
dev-db/mysql
www-client/links
dev-php/adodb
net-analyzer/acid
sys-kernel/gentoo-dev-sources
app-editors/vim
sys-apps/cracklib-words
sys-process/vixie-cron
net-libs/libnet
mail-mta/postfix
sys-boot/grub
app-misc/colordiff
app-admin/pwgen
net-www/apache
sys-power/apcupsd
net-misc/dhcpcd
gnome-base/gnome
net-fs/samba
net-analyzer/snort
sys-libs/glibc
app-admin/syslog-ng
app-editors/nano
net-misc/openssh
app-admin/logrotate
dev-php/mod_php
app-office/openoffice
app-portage/gentoolkit
net-analyzer/oinkmaster
dev-php/PECL-crack
dev-php/php |
|
|
Back to top |
|
|
beandog Bodhisattva
Joined: 04 May 2003 Posts: 2072 Location: /usa/utah
|
Posted: Thu Mar 24, 2005 11:47 pm Post subject: |
|
|
I'm not using the crack extension, but I am using some other PECL modules -- do you have "extension=crack.so" somewhere in your php.ini?
Also, what does php -m say? _________________ If it ain't broke, tweak it. dvds | blurays | blog | wiki |
|
Back to top |
|
|
unixtime n00b
Joined: 21 Dec 2004 Posts: 2 Location: US
|
Posted: Fri Mar 25, 2005 6:43 am Post subject: php |
|
|
Try to test your script with register_global on. |
|
Back to top |
|
|
DijiTao Tux's lil' helper
Joined: 23 Nov 2003 Posts: 94
|
Posted: Fri Mar 25, 2005 2:57 pm Post subject: Figured it out the hardway.. |
|
|
In PHP4 you don't need the PECL modules. Secondly despite what PHP's documentation says opening the dictionary from inside of a php file doesn't seem to work. However if you modify the [crack] section of '/etc/apache2/conf/php.ini' to have the following:
Code: |
[Crack]
; Modify the setting below to match the directory location of the cracklib
; dictionary files. Include the base filename, but not the file extension.
crack.default_dictionary = "/usr/lib/cracklib_dict"
|
Everything worked after that. |
|
Back to top |
|
|
|