Automated installation - Seed and Password??

General discussion about netjukebox
Locked
nshenry03
User
Posts: 2
Joined: Tue Mar 23, 2010 6:43 pm

Automated installation - Seed and Password??

Post by nshenry03 »

Hello,

I am trying to automate the installation of netjukebox and I am running into some problems with automatically changing the username and password of the admin user...

Does anyone know how I can generate a valid password/seed using bash and/or php so that I can simply update the user table with the correct info?

Thanks!
nshenry03
User
Posts: 2
Joined: Tue Mar 23, 2010 6:43 pm

Re: Automated installation - Seed and Password??

Post by nshenry03 »

Nevermind, this works:

Code: Select all

...
z_passwd_randkey=$( $PHP_BIN -r "define('ABSPATH','${WWW_CODE_DIR}/'); require_once( ABSPATH . 'include/library.inc.php' ); fwrite(STDOUT, randomKey());" )
z_passwd_njhash=$( $PHP_BIN -r "define('ABSPATH','${WWW_CODE_DIR}/'); require_once( ABSPATH . 'include/library.inc.php' ); fwrite(STDOUT, hmacsha1(hmacsha1('${z_passwd}', '${z_passwd_randkey}'), '${z_passwd_randkey}'));" )

mysql --database="myDatabase" --user="myUsername" --password="myPassword" --execute="UPDATE user SET password = '${z_passwd_njhash}', seed = '${z_passwd_randkey}', username = '${z_defaultuser}' WHERE user_id = '1';"
...
Thanks!
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Re: Automated installation - Seed and Password??

Post by wbartels »

Another possibility is to modify the default password in the “sql/netjukebox_xx.sql” file.

Code: Select all

-- --------------------------------------------------------

-- 
-- Default users
--

INSERT INTO `user` VALUES ('admin', '4008750ce237101f5e39ec63c8ae46f134a40a65', 'xrR1KfV9FfLAwj2YMfeK1cttaMRHafauezAmbg51', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, NULL);
INSERT INTO `user` VALUES ('anonymous', 'adf8efe68157cf37503f86d602bec6d593750c33', 'I33sJY_HNVMlbGL1nBzY0VdXebb4oSkJIGcnZzLZ', 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
$seed = randomKey();

First item is username: username
Second item is password: hmacsha1(hmacsha1('password', $seed, $seed));
Third item is seed: $seed;
Fourth item: 1

Where the anonymous password must be the same as the anonymous username, normally: "anonymous"
Locked