Yubico Forum

...visit our web-store at store.yubico.com
It is currently Tue Jan 30, 2018 7:06 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Jan 29, 2009 9:58 pm 
Offline

Joined: Tue Jan 27, 2009 10:36 am
Posts: 12
I'm confused I think I've had about every problem you can have setting these things up, it might be just me doing everything completely wrong but should not these packages be compatible with each other?

The yubiphpbase database setup script would drop the tables created while installing server-j, this is not really a problem but still stupid.
The config.php script contained a few minor errors lines that should have been commented but were not so the installer failed.
A few references to kms, the package I downloaded was called yms, is there another package?
There was a dependency in HTTP_ROOT/wsapi so I had to download yubikey-val-server-php which was not supposed to be a dependency.
In key_lib.php there is a function, verifyYubikeyOtp that set ID to 28 if not specified by the function call, which it is not.

After solving the issues above I was able to get everything up and running until I tried to add a new yubikey where it failed trying to select something from a table called stats which I don't have where can I find the layout of that table?

-M


Top
 Profile  
Reply with quote  

Share On:

Share on Facebook FacebookShare on Twitter TwitterShare on Tumblr TumblrShare on Google+ Google+

PostPosted: Fri Jan 30, 2009 10:40 am 
Offline
Yubico Team
Yubico Team

Joined: Wed Oct 01, 2008 8:11 am
Posts: 210
We are not able to reproduce the problem at our end.
We would appreciate if you can provide us following information:

    1) The sequence of steps you performed which lead to the error you are facing
    2) The YMS log file (/tmp/yms.log)


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 30, 2009 11:53 am 
Offline

Joined: Tue Jan 27, 2009 10:36 am
Posts: 12
Sure.

yms logs:
2009-01-29 17:23:46: Check time? 1 by 10.20.0.29
2009-01-29 17:23:50: SELECT id, pin FROM admin WHERE keyid= by 10.20.0.29
2009-01-29 17:23:50: Invalid query -- SELECT id, pin FROM admin WHERE keyid= -- by 10.20.0.29
2009-01-29 17:24:17: SELECT id, pin FROM admin WHERE keyid= by 10.20.0.29
2009-01-29 17:24:17: Invalid query -- SELECT id, pin FROM admin WHERE keyid= -- by 10.20.0.29
2009-01-29 17:24:33: Check time? 1 by 10.20.0.29
2009-01-29 17:24:42: SELECT id, pin FROM admin WHERE keyid= by 10.20.0.29
2009-01-29 17:24:42: Invalid query -- SELECT id, pin FROM admin WHERE keyid= -- by 10.20.0.29
2009-01-29 17:24:49: SELECT id, pin FROM admin WHERE keyid= by 10.20.0.29
2009-01-29 17:24:49: Invalid query -- SELECT id, pin FROM admin WHERE keyid= -- by 10.20.0.29
2009-01-29 17:24:51: SELECT id, pin FROM admin WHERE keyid= by 10.20.0.29
2009-01-29 17:24:51: Invalid query -- SELECT id, pin FROM admin WHERE keyid= -- by 10.20.0.29
2009-01-29 17:24:56: SELECT id, pin FROM admin WHERE keyid= by 10.20.0.29
2009-01-29 17:24:56: Invalid query -- SELECT id, pin FROM admin WHERE keyid= -- by 10.20.0.29
2009-01-29 17:31:57: Check time? 1 by 10.20.0.29
2009-01-29 17:32:04: SELECT id, pin FROM admin WHERE keyid=1 by 10.20.0.29
2009-01-29 17:32:26: # act=find_client, client=-1 by 10.20.0.29
2009-01-29 17:46:21: Del adm key 2 by 10.20.0.29
2009-01-29 17:46:28: Del adm key 2 by 10.20.0.29
2009-01-29 17:46:37: Del adm key 1 by 10.20.0.29
2009-01-29 17:46:38: Del adm key 1 by 10.20.0.29
2009-01-29 17:46:46: Del adm key 2 by 10.20.0.29
2009-01-29 17:47:35: idstr=ghjdhhecrhvd idtype=tokid by 10.20.0.29
2009-01-29 17:48:16: idstr=ghjdhhecrhvd idtype=tokid by 10.20.0.29
2009-01-29 17:49:05: Del adm key 2 by 10.20.0.29
2009-01-29 17:49:05: Invalid query -- UPDATE clients SET perm_id=2 WHERE id=1 -- by 10.20.0.29
2009-01-29 17:54:51: # act=find_client, client=-1 by 10.20.0.29
2009-01-29 21:51:01: Del adm key 1 by 10.20.0.30
2009-01-29 21:51:02: Del adm key 1 by 10.20.0.30
2009-01-29 21:55:19: Invalid query -- SELECT value FROM stats WHERE name='serial' -- by 10.20.0.30
2009-01-29 22:12:27: Invalid query -- SELECT value FROM yubikeys WHERE name='serial' -- by 10.20.0.30


Here are my notes from the installation of yms, my complete setup can be found at http://www.mattiasholm.com/node/25 a work in progress.



The database setup script that is recomended by the documentation needs to be altered to fit the setup we got, they basically want to create the client, yubikeys and perms tables again, we dont..

SET character_set_client = utf8;
CREATE TABLE `admin` (
`id` int(10) unsigned NOT NULL auto_increment,
`keyid` int(11) NOT NULL default '0',
`note` varchar(45) default NULL,
`pin` varchar(120) default NULL,
`last_access` datetime default NULL,
`ip` varchar(45) default NULL,
`creation` datetime default NULL,
`client` int(11) NOT NULL default '0',
`timeout` int(10) unsigned NOT NULL default '3600',
PRIMARY KEY (`id`),
KEY `FK_admin_2` (`keyid`),
KEY `FK_admin_1` (`client`),
CONSTRAINT `FK_admin_1` FOREIGN KEY (`client`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_admin_2` FOREIGN KEY (`keyid`) REFERENCES `yubikeys` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1;

CREATE TABLE `buyers` (
`id` int(10) unsigned NOT NULL auto_increment,
`email` varchar(100) default NULL,
`created` datetime default NULL,
`addr` varchar(200) default NULL,
`qty` int(10) unsigned default NULL,
`client_id` int(11) NOT NULL default '0',
`name` varchar(45) default NULL,
PRIMARY KEY (`id`),
KEY `FK_client_id_1` USING BTREE (`client_id`),
CONSTRAINT `FK_client_info_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2201 DEFAULT CHARSET=latin1;

CREATE TABLE `history` (
`id` int(10) unsigned NOT NULL auto_increment,
`usrid` int(10) unsigned NOT NULL default '0',
`note` varchar(45) NOT NULL default '',
`ip` varchar(45) NOT NULL default '',
`creation` datetime NOT NULL default '0000-00-00 00:00:00',
`keyid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `FK_hist_1` (`usrid`)
) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=latin1;

alter table clients add `notes` varchar(100) default NULL;
alter table clients add `chk_sig` tinyint(1) NOT NULL default '0';
alter table clients add `chk_owner` tinyint(1) NOT NULL default '0';
alter table clients add `chk_time` tinyint(1) NOT NULL default '1';
alter table yubikeys add `notes` varchar(100) default NULL;
alter table yubikeys add `serial` varchar(45) default NULL;

copy config.php.sample to config.php
open config.php with an editor and change
$opt, a key from you yubikey
$pin, you pin tu use when accessing YMS
$aesParams['__ADM_KEY_SECRET__'], your yubikeys AES secret
$aesParams['__ENC_KEY_SECRET__'], secret to use when encrypting data in the database, keep this one safe for future use
$baseParams['__DB_HOST__'], database host
$baseParams['__DB_USER__'], database user
$baseParams['__DB_PW__'], database password
$baseParams['__DB_NAME__', database name
$baseParams['__ROOT_EMAIL__'], your email address or whoever is responsible for this
$baseParams['__ORDER_URL__'], url to user yubikey request form perhaps?
$baseParams['__DOMAIN__'], your domain
$baseParams['__DOC_ROOT__'], filesystem path to apache root
$valParams['__VAL_URL__'], validation server URL if you have followed my instructions it should be http://localhost:8080/wsapi/verify?id= make sure that this one does not point to verify.php which is the default value.
$headParams['__SHORTCUT_ICON_URL__'], URL to favicon, should be located in yms/images
$letterParams['__KMS_URL__'], URL to yms, why the keep calling it kms is a mystery :)

When finished save and close config.php
before you can go on and run the installer you need to install yubikey-val-server-php in to yourwebroot/wsapi since there are undocumented dependencies to a file in that package..

The script will try to create the first user which already exists so we need to modify the script, open install.php and remove the entire variables starting with
$stmt = 'INSERT INTO clients VALUES (1,1,1,' .
and
$stmt = 'INSERT INTO yubikeys VALUES (1,1,1,' .
or just remove quert($stmt); beneath those variables.

run install.php, php install.php
the install script is very likely to fail a few times, that is no problem just correct the problems and run the script again..

After a successful run of install.php open config.php and remove everything between the remove this section comments.

copy yms to your web server root and rename it to kms

touch /tmp/kms.log;chown apache.apache /tmp/kms.log

In yubiphpbase/key_lib.php there is a function that sets $id to default if no $id is provided, I don't know what this is and it will not work unless there is an id 28 in the clients table, I just set to to 1 to make it work, I have no idea what the impact on security or other functionality will be..
function verifyYubikeyOtp($otp, $id=28) > function verifyYubikeyOtp($otp, $id=1)
If I can find some time I might patch this but for now, good enough..


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 02, 2009 7:39 am 
Offline
Yubico Team
Yubico Team

Joined: Wed Oct 01, 2008 8:11 am
Posts: 210
Thanks for providing the information. We are working on the problem and we will update you accordingly.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 03, 2009 4:32 pm 
Offline
Yubico Team
Yubico Team

Joined: Wed Oct 01, 2008 8:11 am
Posts: 210
We are unable to recreate the problem you are facing. There is no stats table in our Yubico database.
We would appreciate if you can provide us all the source code files that you are using to install the YMS and validation server. We would look into the source code files provided by you and we will update you accordingly.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 03, 2009 6:04 pm 
Offline

Joined: Tue Jan 27, 2009 10:36 am
Posts: 12
Sure, to large to attach so http://www.mighty.se/yubico-stuff.tar

-M


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 03, 2009 6:05 pm 
Offline

Joined: Tue Jan 27, 2009 10:36 am
Posts: 12
network-marvels wrote:
We are unable to recreate the problem you are facing. There is no stats table in our Yubico database.


That is pretty much my problem I would love to have the stats table what ever it is, it would make adding new keys so much easier.


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 04, 2009 9:56 am 
Offline
Yubico Team
Yubico Team

Joined: Wed Oct 01, 2008 8:11 am
Posts: 210
Here is the table structure of the stats table:

Code:
DROP TABLE IF EXISTS `stats`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `stats` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(55) default NULL,
  `value` varchar(120) default NULL,
  PRIMARY KEY  (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;


Feel free to write back to us in case you face any problems.


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 04, 2009 10:10 am 
Offline

Joined: Tue Jan 27, 2009 10:36 am
Posts: 12
Got a new error, Invalid query -- INSERT INTO stats VALUES ('serial','34251') -- Column count doesn't match value count at row 1


mysql> show columns from stats;
+-------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(55) | YES | | NULL | |
| value | varchar(120) | YES | | NULL | |
+-------+------------------+------+-----+---------+----------------+


-M


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 04, 2009 10:26 am 
Offline
Yubico Team
Yubico Team

Joined: Wed Oct 01, 2008 8:11 am
Posts: 210
Please replace the setStatVal function definition from the "yubiphpbase/appinclude.php" file with the function definition given below:

Code:
function setStatVal($name, $val) {
   if (getStatVal($name) == null) { // Insert new
      $stmt = 'INSERT INTO stats (name, value) VALUES ('.
         mysql_quote($name).','.
         mysql_quote($val).
         ')';
      query($stmt);
   } else { // Update existing
      $stmt = 'UPDATE stats SET value='.mysql_quote($val).
         ' WHERE name='.mysql_quote($name);
      query($stmt);
   }
}


Feel free to write back to us in case you face any problems.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group