mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 18:20:23 +00:00
Add a API call to the server:
rpc/settings: "action" = "list_ssl_checksums"
This will list the MD5 checksums of all the known SSL keys (in no particular order)
REST Request:
-------------------------------
PUT /rpc/settings
{
"action" : "list_ssl_checksums"
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "list_ssl_checksums"
},
"namespace" : "rpc",
"name" : "settings",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"md5_keys": [
"0`H\u0013\r*\u00023\u000bc"
]
},
"id": "fooid",
"name": "response",
"namespace": "rpc"
}
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
|
||||
// Stuff for PAM to work
|
||||
#include <sys/types.h>
|
||||
#include <security/pam_appl.h>
|
||||
@@ -125,6 +127,22 @@ void AuthorizationManager::ListCertificates(QString token, QJsonObject *out){
|
||||
if(!user.isEmpty() && !username.isEmpty()){ out->insert(username, user); }
|
||||
}
|
||||
|
||||
void AuthorizationManager::ListCertificateChecksums(QJsonObject *out){
|
||||
QStringList keys; //Format: "RegisteredCerts/<user>/<key>"
|
||||
//Read all user's certs (since we only need checksums)
|
||||
keys = CONFIG->allKeys().filter("RegisteredCerts/");
|
||||
keys.sort();
|
||||
QJsonArray arr;
|
||||
QCryptographicHash chash(QCryptographicHash::Md5);
|
||||
for(int i=0; i<keys.length(); i++){
|
||||
chash.addData( CONFIG->value(keys[i]).toString().toLocal8Bit() );
|
||||
QByteArray res = chash.result();
|
||||
chash.reset();
|
||||
arr << QString(res);
|
||||
}
|
||||
out->insert("md5_keys", arr);
|
||||
}
|
||||
|
||||
//Generic functions
|
||||
int AuthorizationManager::checkAuthTimeoutSecs(QString token){
|
||||
//Return the number of seconds that a token is valid for
|
||||
|
||||
Reference in New Issue
Block a user