mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-22 00:54:26 +01:00
Lay foundation for get-api-key service.
This commit is contained in:
parent
479d5b1e7f
commit
9b5602656a
@ -16,6 +16,12 @@ define('TS_ABS_TOLERANCE', 20);
|
|||||||
|
|
||||||
define('TOKEN_LEN', 32);
|
define('TOKEN_LEN', 32);
|
||||||
|
|
||||||
|
function logdie ($str)
|
||||||
|
{
|
||||||
|
error_log($str);
|
||||||
|
die($str . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
function unescape($s) {
|
function unescape($s) {
|
||||||
return str_replace('\\', "", $s);
|
return str_replace('\\', "", $s);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
<?php # -*- php -*-
|
<?php # -*- php -*-
|
||||||
|
|
||||||
//// DB
|
# For the validation interface.
|
||||||
//
|
|
||||||
$baseParams = array ();
|
$baseParams = array ();
|
||||||
$baseParams['__DB_HOST__'] = 'localhost';
|
$baseParams['__YKVAL_DB_HOST__'] = 'localhost';
|
||||||
$baseParams['__DB_USER__'] = 'ykval_verifier';
|
$baseParams['__YKVAL_DB_NAME__'] = 'ykval';
|
||||||
$baseParams['__DB_PW__'] = 'password';
|
$baseParams['__YKVAL_DB_USER__'] = 'ykval_verifier';
|
||||||
$baseParams['__DB_NAME__'] = 'ykval';
|
$baseParams['__YKVAL_DB_PW__'] = 'password';
|
||||||
|
|
||||||
|
# For the get-api-key service.
|
||||||
|
$baseParams['__YKGAK_DB_HOST__'] = $baseParams['__YKVAL_DB_HOST__'];
|
||||||
|
$baseParams['__YKGAK_DB_NAME__'] = $baseParams['__YKVAL_DB_NAME__'];
|
||||||
|
$baseParams['__YKGAK_DB_USER__'] = 'ykval_getapikey';
|
||||||
|
$baseParams['__YKGAK_DB_PW__'] = 'password';
|
||||||
|
$baseParams['__YKGAK_ID__'] = '';
|
||||||
|
$baseParams['__YKGAK_KEY__'] = '';
|
||||||
|
|
||||||
// otp2ksmurls: Return array of YK-KSM URLs for decrypting OTP for
|
// otp2ksmurls: Return array of YK-KSM URLs for decrypting OTP for
|
||||||
// CLIENT. The URLs must be fully qualified, i.e., contain the OTP
|
// CLIENT. The URLs must be fully qualified, i.e., contain the OTP
|
||||||
|
@ -32,4 +32,9 @@ GRANT SELECT,INSERT,UPDATE(accessed, counter, low, high, sessionUse)
|
|||||||
ON ykval.yubikeys to 'ykval_verifier'@'localhost';
|
ON ykval.yubikeys to 'ykval_verifier'@'localhost';
|
||||||
GRANT SELECT(id, secret, active)
|
GRANT SELECT(id, secret, active)
|
||||||
ON ykval.clients to 'ykval_verifier'@'localhost';
|
ON ykval.clients to 'ykval_verifier'@'localhost';
|
||||||
|
|
||||||
|
CREATE USER 'ykval_getapikey'@'localhost';
|
||||||
|
GRANT SELECT(id),INSERT
|
||||||
|
ON ykval.clients to 'ykval_getapikey'@'localhost';
|
||||||
|
|
||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
|
@ -8,14 +8,14 @@ header("content-type: text/plain");
|
|||||||
|
|
||||||
debug("Request: " . $_SERVER['QUERY_STRING']);
|
debug("Request: " . $_SERVER['QUERY_STRING']);
|
||||||
|
|
||||||
$conn = mysql_connect($baseParams['__DB_HOST__'],
|
$conn = mysql_connect($baseParams['__YKVAL_DB_HOST__'],
|
||||||
$baseParams['__DB_USER__'],
|
$baseParams['__YKVAL_DB_USER__'],
|
||||||
$baseParams['__DB_PW__']);
|
$baseParams['__YKVAL_DB_PW__']);
|
||||||
if (!$conn) {
|
if (!$conn) {
|
||||||
sendResp(S_BACKEND_ERROR, $apiKey);
|
sendResp(S_BACKEND_ERROR, $apiKey);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (!mysql_select_db($baseParams['__DB_NAME__'], $conn)) {
|
if (!mysql_select_db($baseParams['__YKVAL_DB_NAME__'], $conn)) {
|
||||||
sendResp(S_BACKEND_ERROR, $apiKey);
|
sendResp(S_BACKEND_ERROR, $apiKey);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user