pluto and charon now have the same ipsec listall output format
This commit is contained in:
+11
-13
@@ -20,6 +20,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include <freeswan.h>
|
#include <freeswan.h>
|
||||||
|
|
||||||
@@ -282,7 +283,6 @@ void list_acerts(bool utc)
|
|||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "List of X.509 Attribute Certificates:");
|
whack_log(RC_COMMENT, "List of X.509 Attribute Certificates:");
|
||||||
whack_log(RC_COMMENT, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (x509ac)
|
while (x509ac)
|
||||||
@@ -294,53 +294,51 @@ void list_acerts(bool utc)
|
|||||||
time_t notBefore, notAfter;
|
time_t notBefore, notAfter;
|
||||||
ietf_attributes_t *groups;
|
ietf_attributes_t *groups;
|
||||||
|
|
||||||
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "%T", &x509ac->installed, utc);
|
|
||||||
|
|
||||||
entityName = cert_ac->get_subject(cert_ac);
|
entityName = cert_ac->get_subject(cert_ac);
|
||||||
if (entityName)
|
if (entityName)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " holder: '%Y'", entityName);
|
whack_log(RC_COMMENT, " holder: \"%Y\"", entityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
holderIssuer = ac->get_holderIssuer(ac);
|
holderIssuer = ac->get_holderIssuer(ac);
|
||||||
if (holderIssuer)
|
if (holderIssuer)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " hissuer: '%Y'", holderIssuer);
|
whack_log(RC_COMMENT, " hissuer: \"%Y\"", holderIssuer);
|
||||||
}
|
}
|
||||||
|
|
||||||
holderSerial = ac->get_holderSerial(ac);
|
holderSerial = ac->get_holderSerial(ac);
|
||||||
if (holderSerial.ptr)
|
if (holderSerial.ptr)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " hserial: %#B", &holderSerial);
|
whack_log(RC_COMMENT, " hserial: %#B", &holderSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
groups = ac->get_groups(ac);
|
groups = ac->get_groups(ac);
|
||||||
if (groups)
|
if (groups)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " groups: %s",
|
whack_log(RC_COMMENT, " groups: %s",
|
||||||
groups->get_string(groups));
|
groups->get_string(groups));
|
||||||
groups->destroy(groups);
|
groups->destroy(groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
issuer = cert_ac->get_issuer(cert_ac);
|
issuer = cert_ac->get_issuer(cert_ac);
|
||||||
whack_log(RC_COMMENT, " issuer: '%Y'", issuer);
|
whack_log(RC_COMMENT, " issuer: \"%Y\"", issuer);
|
||||||
|
|
||||||
serial = ac->get_serial(ac);
|
serial = ac->get_serial(ac);
|
||||||
whack_log(RC_COMMENT, " serial: %#B", &serial);
|
whack_log(RC_COMMENT, " serial: %#B", &serial);
|
||||||
|
|
||||||
cert_ac->get_validity(cert_ac, &now, ¬Before, ¬After);
|
cert_ac->get_validity(cert_ac, &now, ¬Before, ¬After);
|
||||||
whack_log(RC_COMMENT, " validity: not before %T %s",
|
whack_log(RC_COMMENT, " validity: not before %T %s",
|
||||||
¬Before, utc,
|
¬Before, utc,
|
||||||
(notBefore < now)?"ok":"fatal (not valid yet)");
|
(notBefore < now)?"ok":"fatal (not valid yet)");
|
||||||
whack_log(RC_COMMENT, " not after %T %s",
|
whack_log(RC_COMMENT, " not after %T %s", ¬After, utc,
|
||||||
¬After, utc,
|
|
||||||
check_expiry(notAfter, ACERT_WARNING_INTERVAL, TRUE));
|
check_expiry(notAfter, ACERT_WARNING_INTERVAL, TRUE));
|
||||||
|
|
||||||
authKeyID = ac->get_authKeyIdentifier(ac);
|
authKeyID = ac->get_authKeyIdentifier(ac);
|
||||||
if (authKeyID.ptr)
|
if (authKeyID.ptr)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " authkey: %#B", &authKeyID);
|
whack_log(RC_COMMENT, " authkey: %#B", &authKeyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
x509ac = x509ac->next;
|
x509ac = x509ac->next;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
#ifndef _AC_H
|
#ifndef _AC_H
|
||||||
#define _AC_H
|
#define _AC_H
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <credentials/certificates/certificate.h>
|
#include <credentials/certificates/certificate.h>
|
||||||
#include <credentials/ietf_attributes/ietf_attributes.h>
|
#include <credentials/ietf_attributes/ietf_attributes.h>
|
||||||
|
|
||||||
@@ -30,7 +28,6 @@ typedef struct x509acert x509acert_t;
|
|||||||
struct x509acert {
|
struct x509acert {
|
||||||
certificate_t *ac;
|
certificate_t *ac;
|
||||||
x509acert_t *next;
|
x509acert_t *next;
|
||||||
time_t installed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool verify_x509acert(x509acert_t *ac, bool strict);
|
extern bool verify_x509acert(x509acert_t *ac, bool strict);
|
||||||
|
|||||||
+1
-4
@@ -98,7 +98,6 @@ static cert_t *builder_load_cert(certificate_type_t type, va_list args)
|
|||||||
*cert = cert_empty;
|
*cert = cert_empty;
|
||||||
cert->type = CERT_X509_SIGNATURE;
|
cert->type = CERT_X509_SIGNATURE;
|
||||||
cert->u.x509 = x509cert;
|
cert->u.x509 = x509cert;
|
||||||
time(&x509cert->installed);
|
|
||||||
return cert;
|
return cert;
|
||||||
}
|
}
|
||||||
plog(" error in X.509 certificate");
|
plog(" error in X.509 certificate");
|
||||||
@@ -134,7 +133,6 @@ static x509acert_t *builder_load_ac(certificate_type_t type, va_list args)
|
|||||||
{
|
{
|
||||||
ac = malloc_thing(x509acert_t);
|
ac = malloc_thing(x509acert_t);
|
||||||
ac->next = NULL;
|
ac->next = NULL;
|
||||||
ac->installed = UNDEFINED_TIME;
|
|
||||||
ac->ac = lib->creds->create(lib->creds,
|
ac->ac = lib->creds->create(lib->creds,
|
||||||
CRED_CERTIFICATE, CERT_X509_AC,
|
CRED_CERTIFICATE, CERT_X509_AC,
|
||||||
BUILD_BLOB_ASN1_DER, blob, BUILD_END);
|
BUILD_BLOB_ASN1_DER, blob, BUILD_END);
|
||||||
@@ -173,9 +171,8 @@ static x509crl_t *builder_load_crl(certificate_type_t type, va_list args)
|
|||||||
if (blob.ptr)
|
if (blob.ptr)
|
||||||
{
|
{
|
||||||
crl = malloc_thing(x509crl_t);
|
crl = malloc_thing(x509crl_t);
|
||||||
*crl = empty_x509crl;
|
crl->next = NULL;
|
||||||
crl->distributionPoints = linked_list_create();
|
crl->distributionPoints = linked_list_create();
|
||||||
|
|
||||||
crl->crl = lib->creds->create(lib->creds,
|
crl->crl = lib->creds->create(lib->creds,
|
||||||
CRED_CERTIFICATE, CERT_X509_CRL,
|
CRED_CERTIFICATE, CERT_X509_CRL,
|
||||||
BUILD_BLOB_ASN1_DER, blob,
|
BUILD_BLOB_ASN1_DER, blob,
|
||||||
|
|||||||
+15
-12
@@ -661,7 +661,6 @@ void add_ca_info(const whack_message_t *msg)
|
|||||||
|
|
||||||
ca->next = ca_infos;
|
ca->next = ca_infos;
|
||||||
ca_infos = ca;
|
ca_infos = ca;
|
||||||
ca->installed = time(NULL);
|
|
||||||
|
|
||||||
unlock_ca_info_list("add_ca_info");
|
unlock_ca_info_list("add_ca_info");
|
||||||
|
|
||||||
@@ -690,7 +689,6 @@ void list_ca_infos(bool utc)
|
|||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "List of X.509 CA Information Records:");
|
whack_log(RC_COMMENT, "List of X.509 CA Information Records:");
|
||||||
whack_log(RC_COMMENT, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ca != NULL)
|
while (ca != NULL)
|
||||||
@@ -703,15 +701,21 @@ void list_ca_infos(bool utc)
|
|||||||
, &ca->installed, utc, ca->name
|
, &ca->installed, utc, ca->name
|
||||||
, ca->strictcrlpolicy? "yes":"no");
|
, ca->strictcrlpolicy? "yes":"no");
|
||||||
*/
|
*/
|
||||||
whack_log(RC_COMMENT, "%T, \"%s\"", &ca->installed, utc, ca->name);
|
whack_log(RC_COMMENT, " ");
|
||||||
dntoa(buf, BUF_LEN, ca->authName);
|
dntoa(buf, BUF_LEN, ca->authName);
|
||||||
whack_log(RC_COMMENT, " authname: '%s'", buf);
|
whack_log(RC_COMMENT, " authname: \"%s\"", buf);
|
||||||
if (ca->ldaphost != NULL)
|
if (ca->ldaphost)
|
||||||
whack_log(RC_COMMENT, " ldaphost: '%s'", ca->ldaphost);
|
{
|
||||||
if (ca->ldapbase != NULL)
|
whack_log(RC_COMMENT, " ldaphost: '%s'", ca->ldaphost);
|
||||||
whack_log(RC_COMMENT, " ldapbase: '%s'", ca->ldapbase);
|
}
|
||||||
if (ca->ocspuri != NULL)
|
if (ca->ldapbase)
|
||||||
whack_log(RC_COMMENT, " ocspuri: '%s'", ca->ocspuri);
|
{
|
||||||
|
whack_log(RC_COMMENT, " ldapbase: '%s'", ca->ldapbase);
|
||||||
|
}
|
||||||
|
if (ca->ocspuri)
|
||||||
|
{
|
||||||
|
whack_log(RC_COMMENT, " ocspuri: '%s'", ca->ocspuri);
|
||||||
|
}
|
||||||
|
|
||||||
list_distribution_points(ca->crluris);
|
list_distribution_points(ca->crluris);
|
||||||
|
|
||||||
@@ -719,10 +723,9 @@ void list_ca_infos(bool utc)
|
|||||||
{
|
{
|
||||||
datatot(ca->authKeyID.ptr, ca->authKeyID.len, ':'
|
datatot(ca->authKeyID.ptr, ca->authKeyID.len, ':'
|
||||||
, buf, BUF_LEN);
|
, buf, BUF_LEN);
|
||||||
whack_log(RC_COMMENT, " authkey: %s", buf);
|
whack_log(RC_COMMENT, " authkey: %s", buf);
|
||||||
}
|
}
|
||||||
ca = ca->next;
|
ca = ca->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ typedef struct ca_info ca_info_t;
|
|||||||
struct ca_info {
|
struct ca_info {
|
||||||
ca_info_t *next;
|
ca_info_t *next;
|
||||||
char *name;
|
char *name;
|
||||||
time_t installed;
|
|
||||||
chunk_t authName;
|
chunk_t authName;
|
||||||
chunk_t authKeyID;
|
chunk_t authKeyID;
|
||||||
char *ldaphost;
|
char *ldaphost;
|
||||||
|
|||||||
+14
-23
@@ -39,14 +39,7 @@
|
|||||||
|
|
||||||
/* chained lists of X.509 crls */
|
/* chained lists of X.509 crls */
|
||||||
|
|
||||||
static x509crl_t *x509crls = NULL;
|
static x509crl_t *x509crls = NULL;
|
||||||
|
|
||||||
const x509crl_t empty_x509crl = {
|
|
||||||
NULL , /* crl */
|
|
||||||
NULL , /* *next */
|
|
||||||
UNDEFINED_TIME, /* installed */
|
|
||||||
NULL , /* distributionPoints */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the X.509 CRL with a given issuer
|
* Get the X.509 CRL with a given issuer
|
||||||
@@ -502,7 +495,6 @@ void list_crls(bool utc, bool strict)
|
|||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "List of X.509 CRLs:");
|
whack_log(RC_COMMENT, "List of X.509 CRLs:");
|
||||||
whack_log(RC_COMMENT, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (x509crl)
|
while (x509crl)
|
||||||
@@ -514,6 +506,15 @@ void list_crls(bool utc, bool strict)
|
|||||||
u_int revoked = 0;
|
u_int revoked = 0;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
|
||||||
|
whack_log(RC_COMMENT, " ");
|
||||||
|
whack_log(RC_COMMENT, " issuer: \"%Y\"",
|
||||||
|
cert_crl->get_issuer(cert_crl));
|
||||||
|
serial = crl->get_serial(crl);
|
||||||
|
if (serial.ptr)
|
||||||
|
{
|
||||||
|
whack_log(RC_COMMENT, " serial: %#B", &serial);
|
||||||
|
}
|
||||||
|
|
||||||
/* count number of revoked certificates in CRL */
|
/* count number of revoked certificates in CRL */
|
||||||
enumerator = crl->create_enumerator(crl);
|
enumerator = crl->create_enumerator(crl);
|
||||||
while (enumerator->enumerate(enumerator, NULL, NULL, NULL))
|
while (enumerator->enumerate(enumerator, NULL, NULL, NULL))
|
||||||
@@ -521,28 +522,18 @@ void list_crls(bool utc, bool strict)
|
|||||||
revoked++;
|
revoked++;
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
whack_log(RC_COMMENT, " revoked: %d certificates", revoked);
|
||||||
|
|
||||||
whack_log(RC_COMMENT, "%T, revoked certs: %d",
|
|
||||||
&x509crl->installed, utc, revoked);
|
|
||||||
whack_log(RC_COMMENT, " issuer: '%Y'",
|
|
||||||
cert_crl->get_issuer(cert_crl));
|
|
||||||
serial = crl->get_serial(crl);
|
|
||||||
if (serial.ptr)
|
|
||||||
{
|
|
||||||
whack_log(RC_COMMENT, " crlnumber: %#B", &serial);
|
|
||||||
}
|
|
||||||
list_distribution_points(x509crl->distributionPoints);
|
list_distribution_points(x509crl->distributionPoints);
|
||||||
|
|
||||||
cert_crl->get_validity(cert_crl, NULL, &thisUpdate, &nextUpdate);
|
cert_crl->get_validity(cert_crl, NULL, &thisUpdate, &nextUpdate);
|
||||||
whack_log(RC_COMMENT, " updates: this %T",
|
whack_log(RC_COMMENT, " updates: this %T", &thisUpdate, utc);
|
||||||
&thisUpdate, utc);
|
whack_log(RC_COMMENT, " next %T %s", &nextUpdate, utc,
|
||||||
whack_log(RC_COMMENT, " next %T %s",
|
|
||||||
&nextUpdate, utc,
|
|
||||||
check_expiry(nextUpdate, CRL_WARNING_INTERVAL, strict));
|
check_expiry(nextUpdate, CRL_WARNING_INTERVAL, strict));
|
||||||
authKeyID = crl->get_authKeyIdentifier(crl);
|
authKeyID = crl->get_authKeyIdentifier(crl);
|
||||||
if (authKeyID.ptr)
|
if (authKeyID.ptr)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " authkey: %#B", &authKeyID);
|
whack_log(RC_COMMENT, " authkey: %#B", &authKeyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
x509crl = x509crl->next;
|
x509crl = x509crl->next;
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ typedef struct x509crl x509crl_t;
|
|||||||
struct x509crl {
|
struct x509crl {
|
||||||
certificate_t *crl;
|
certificate_t *crl;
|
||||||
x509crl_t *next;
|
x509crl_t *next;
|
||||||
time_t installed;
|
|
||||||
linked_list_t *distributionPoints;
|
linked_list_t *distributionPoints;
|
||||||
chunk_t signature;
|
chunk_t signature;
|
||||||
};
|
};
|
||||||
@@ -44,10 +43,6 @@ extern bool cache_crls;
|
|||||||
* check periodically for expired crls
|
* check periodically for expired crls
|
||||||
*/
|
*/
|
||||||
extern long crl_check_interval;
|
extern long crl_check_interval;
|
||||||
|
|
||||||
/* used for initialization */
|
|
||||||
extern const x509crl_t empty_x509crl;
|
|
||||||
|
|
||||||
extern void load_crls(void);
|
extern void load_crls(void);
|
||||||
extern void check_crls(void);
|
extern void check_crls(void);
|
||||||
extern bool insert_crl(x509crl_t *crl, char *crl_uri, bool cache_crl);
|
extern bool insert_crl(x509crl_t *crl, char *crl_uri, bool cache_crl);
|
||||||
|
|||||||
+5
-10
@@ -44,7 +44,6 @@
|
|||||||
|
|
||||||
fetch_req_t empty_fetch_req = {
|
fetch_req_t empty_fetch_req = {
|
||||||
NULL , /* next */
|
NULL , /* next */
|
||||||
0 , /* installed */
|
|
||||||
0 , /* trials */
|
0 , /* trials */
|
||||||
{ NULL, 0}, /* issuer */
|
{ NULL, 0}, /* issuer */
|
||||||
{ NULL, 0}, /* authKeyID */
|
{ NULL, 0}, /* authKeyID */
|
||||||
@@ -609,9 +608,6 @@ fetch_req_t* build_crl_fetch_request(chunk_t issuer, chunk_t authKeyID,
|
|||||||
memset(req, 0, sizeof(fetch_req_t));
|
memset(req, 0, sizeof(fetch_req_t));
|
||||||
req->distributionPoints = linked_list_create();
|
req->distributionPoints = linked_list_create();
|
||||||
|
|
||||||
/* note current time */
|
|
||||||
req->installed = time(NULL);
|
|
||||||
|
|
||||||
/* clone fields */
|
/* clone fields */
|
||||||
req->issuer = chunk_clone(issuer);
|
req->issuer = chunk_clone(issuer);
|
||||||
req->authKeyID = chunk_clone(authKeyID);
|
req->authKeyID = chunk_clone(authKeyID);
|
||||||
@@ -695,7 +691,7 @@ void list_distribution_points(linked_list_t *distributionPoints)
|
|||||||
enumerator = distributionPoints->create_enumerator(distributionPoints);
|
enumerator = distributionPoints->create_enumerator(distributionPoints);
|
||||||
while (enumerator->enumerate(enumerator, &point))
|
while (enumerator->enumerate(enumerator, &point))
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " %s '%s'",
|
whack_log(RC_COMMENT, " %s '%s'",
|
||||||
(first_point)? "distPts: " : " ", point);
|
(first_point)? "distPts: " : " ", point);
|
||||||
first_point = FALSE;
|
first_point = FALSE;
|
||||||
}
|
}
|
||||||
@@ -715,7 +711,7 @@ void list_crl_fetch_requests(bool utc)
|
|||||||
if (req != NULL)
|
if (req != NULL)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "List of CRL fetch requests:");
|
whack_log(RC_COMMENT, "List of CRL Fetch Requests:");
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,15 +719,14 @@ void list_crl_fetch_requests(bool utc)
|
|||||||
{
|
{
|
||||||
u_char buf[BUF_LEN];
|
u_char buf[BUF_LEN];
|
||||||
|
|
||||||
whack_log(RC_COMMENT, "%T, trials: %d"
|
whack_log(RC_COMMENT, " trials: %d", req->trials);
|
||||||
, &req->installed, utc, req->trials);
|
|
||||||
dntoa(buf, BUF_LEN, req->issuer);
|
dntoa(buf, BUF_LEN, req->issuer);
|
||||||
whack_log(RC_COMMENT, " issuer: '%s'", buf);
|
whack_log(RC_COMMENT, " issuer: '%s'", buf);
|
||||||
if (req->authKeyID.ptr != NULL)
|
if (req->authKeyID.ptr != NULL)
|
||||||
{
|
{
|
||||||
datatot(req->authKeyID.ptr, req->authKeyID.len, ':'
|
datatot(req->authKeyID.ptr, req->authKeyID.len, ':'
|
||||||
, buf, BUF_LEN);
|
, buf, BUF_LEN);
|
||||||
whack_log(RC_COMMENT, " authkey: %s", buf);
|
whack_log(RC_COMMENT, " authkey: %s", buf);
|
||||||
}
|
}
|
||||||
list_distribution_points(req->distributionPoints);
|
list_distribution_points(req->distributionPoints);
|
||||||
req = req->next;
|
req = req->next;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ typedef struct fetch_req fetch_req_t;
|
|||||||
|
|
||||||
struct fetch_req {
|
struct fetch_req {
|
||||||
fetch_req_t *next;
|
fetch_req_t *next;
|
||||||
time_t installed;
|
|
||||||
int trials;
|
int trials;
|
||||||
chunk_t issuer;
|
chunk_t issuer;
|
||||||
chunk_t authKeyID;
|
chunk_t authKeyID;
|
||||||
|
|||||||
@@ -2173,7 +2173,6 @@ static void decode_cert(struct msg_digest *md)
|
|||||||
BUILD_END);
|
BUILD_END);
|
||||||
if (cert.cert)
|
if (cert.cert)
|
||||||
{
|
{
|
||||||
time(&cert.installed);
|
|
||||||
if (verify_x509cert(&cert, strict_crl_policy, &valid_until))
|
if (verify_x509cert(&cert, strict_crl_policy, &valid_until))
|
||||||
{
|
{
|
||||||
DBG(DBG_PARSING,
|
DBG(DBG_PARSING,
|
||||||
|
|||||||
+6
-6
@@ -1430,7 +1430,6 @@ void list_public_keys(bool utc)
|
|||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "List of Public Keys:");
|
whack_log(RC_COMMENT, "List of Public Keys:");
|
||||||
whack_log(RC_COMMENT, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (p != NULL)
|
while (p != NULL)
|
||||||
@@ -1440,27 +1439,28 @@ void list_public_keys(bool utc)
|
|||||||
chunk_t keyid;
|
chunk_t keyid;
|
||||||
char buf[BUF_LEN];
|
char buf[BUF_LEN];
|
||||||
|
|
||||||
|
whack_log(RC_COMMENT, " ");
|
||||||
idtoa(&key->id, buf, BUF_LEN);
|
idtoa(&key->id, buf, BUF_LEN);
|
||||||
whack_log(RC_COMMENT,"%T, '%s'", &key->installed_time, utc, buf);
|
whack_log(RC_COMMENT, " owner: '%s'", buf);
|
||||||
whack_log(RC_COMMENT, " pubkey: %N %4d bits, until %T %s",
|
whack_log(RC_COMMENT, " pubkey: %N %4d bits, until %T %s",
|
||||||
key_type_names, public->get_type(public),
|
key_type_names, public->get_type(public),
|
||||||
public->get_keysize(public) * BITS_PER_BYTE,
|
public->get_keysize(public) * BITS_PER_BYTE,
|
||||||
&key->until_time, utc,
|
&key->until_time, utc,
|
||||||
check_expiry(key->until_time, PUBKEY_WARNING_INTERVAL, TRUE));
|
check_expiry(key->until_time, PUBKEY_WARNING_INTERVAL, TRUE));
|
||||||
if (public->get_fingerprint(public, KEY_ID_PUBKEY_INFO_SHA1, &keyid))
|
if (public->get_fingerprint(public, KEY_ID_PUBKEY_INFO_SHA1, &keyid))
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT," keyid: %#B", &keyid);
|
whack_log(RC_COMMENT," keyid: %#B", &keyid);
|
||||||
}
|
}
|
||||||
if (key->issuer.len > 0)
|
if (key->issuer.len > 0)
|
||||||
{
|
{
|
||||||
dntoa(buf, BUF_LEN, key->issuer);
|
dntoa(buf, BUF_LEN, key->issuer);
|
||||||
whack_log(RC_COMMENT," issuer: '%s'", buf);
|
whack_log(RC_COMMENT," issuer: \"%s\"", buf);
|
||||||
}
|
}
|
||||||
if (key->serial.len > 0)
|
if (key->serial.len > 0)
|
||||||
{
|
{
|
||||||
datatot(key->serial.ptr, key->serial.len, ':'
|
datatot(key->serial.ptr, key->serial.len, ':'
|
||||||
, buf, BUF_LEN);
|
, buf, BUF_LEN);
|
||||||
whack_log(RC_COMMENT," serial: %s", buf);
|
whack_log(RC_COMMENT," serial: %s", buf);
|
||||||
}
|
}
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-25
@@ -424,7 +424,7 @@ cert_status_t verify_by_ocsp(const x509cert_t *cert, time_t *until,
|
|||||||
chunk_t serialNumber = x509->get_serial(x509);
|
chunk_t serialNumber = x509->get_serial(x509);
|
||||||
cert_status_t status;
|
cert_status_t status;
|
||||||
ocsp_location_t location;
|
ocsp_location_t location;
|
||||||
time_t nextUpdate;
|
time_t nextUpdate = UNDEFINED_TIME;
|
||||||
|
|
||||||
*revocationDate = UNDEFINED_TIME;
|
*revocationDate = UNDEFINED_TIME;
|
||||||
*revocationReason = CRL_REASON_UNSPECIFIED;
|
*revocationReason = CRL_REASON_UNSPECIFIED;
|
||||||
@@ -595,50 +595,46 @@ void list_ocsp_locations(ocsp_location_t *location, bool requests,
|
|||||||
first = FALSE;
|
first = FALSE;
|
||||||
}
|
}
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
if (location->issuer.ptr != NULL)
|
if (location->issuer.ptr)
|
||||||
{
|
{
|
||||||
dntoa(buf, BUF_LEN, location->issuer);
|
dntoa(buf, BUF_LEN, location->issuer);
|
||||||
whack_log(RC_COMMENT, " issuer: '%s'", buf);
|
whack_log(RC_COMMENT, " issuer: \"%s\"", buf);
|
||||||
}
|
}
|
||||||
whack_log(RC_COMMENT, " uri: '%s'", location->uri);
|
whack_log(RC_COMMENT, " uri: '%s'", location->uri);
|
||||||
if (location->authNameID.ptr != NULL)
|
if (location->authNameID.ptr)
|
||||||
{
|
{
|
||||||
datatot(location->authNameID.ptr, location->authNameID.len, ':'
|
datatot(location->authNameID.ptr, location->authNameID.len, ':'
|
||||||
, buf, BUF_LEN);
|
, buf, BUF_LEN);
|
||||||
whack_log(RC_COMMENT, " authname: %s", buf);
|
whack_log(RC_COMMENT, " authname: %s", buf);
|
||||||
}
|
}
|
||||||
if (location->authKeyID.ptr != NULL)
|
if (location->authKeyID.ptr)
|
||||||
{
|
{
|
||||||
datatot(location->authKeyID.ptr, location->authKeyID.len, ':'
|
datatot(location->authKeyID.ptr, location->authKeyID.len, ':'
|
||||||
, buf, BUF_LEN);
|
, buf, BUF_LEN);
|
||||||
whack_log(RC_COMMENT, " authkey: %s", buf);
|
whack_log(RC_COMMENT, " authkey: %s", buf);
|
||||||
}
|
}
|
||||||
while (certinfo != NULL)
|
while (certinfo)
|
||||||
{
|
{
|
||||||
char thisUpdate[BUF_LEN];
|
|
||||||
|
|
||||||
snprintf(thisUpdate, BUF_LEN, "%T", &certinfo->thisUpdate, utc);
|
|
||||||
|
|
||||||
if (requests)
|
if (requests)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, "%s, trials: %d", thisUpdate
|
whack_log(RC_COMMENT, " serial: %#B, %d trials",
|
||||||
, certinfo->trials);
|
&certinfo->serialNumber, certinfo->trials);
|
||||||
}
|
}
|
||||||
else if (certinfo->once)
|
else if (certinfo->once)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, "%s, onetime use%s", thisUpdate
|
whack_log(RC_COMMENT, " serial: %#B, %s, once%s",
|
||||||
, (certinfo->nextUpdate < time(NULL))? " (expired)": "");
|
&certinfo->serialNumber,
|
||||||
|
cert_status_names[certinfo->status],
|
||||||
|
(certinfo->nextUpdate < time(NULL))? " (expired)": "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, "%s, until %T %s", thisUpdate
|
whack_log(RC_COMMENT, " serial: %#B, %s, until %T %s",
|
||||||
, &certinfo->nextUpdate, utc
|
&certinfo->serialNumber,
|
||||||
, check_expiry(certinfo->nextUpdate, OCSP_WARNING_INTERVAL, strict));
|
cert_status_names[certinfo->status],
|
||||||
|
&certinfo->nextUpdate, utc,
|
||||||
|
check_expiry(certinfo->nextUpdate, OCSP_WARNING_INTERVAL, strict));
|
||||||
}
|
}
|
||||||
datatot(certinfo->serialNumber.ptr, certinfo->serialNumber.len, ':'
|
|
||||||
, buf, BUF_LEN);
|
|
||||||
whack_log(RC_COMMENT, " serial: %s, %s", buf
|
|
||||||
, cert_status_names[certinfo->status]);
|
|
||||||
certinfo = certinfo->next;
|
certinfo = certinfo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1155,7 +1151,6 @@ static bool parse_basic_ocsp_response(chunk_t blob, int level0, response_t *res)
|
|||||||
free_x509cert(cert);
|
free_x509cert(cert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
time(&cert->installed);
|
|
||||||
x509 = (x509_t*)cert->cert;
|
x509 = (x509_t*)cert->cert;
|
||||||
|
|
||||||
if ((x509->get_flags(x509) & X509_OCSP_SIGNER) &&
|
if ((x509->get_flags(x509) & X509_OCSP_SIGNER) &&
|
||||||
|
|||||||
+6
-9
@@ -97,7 +97,6 @@ static pgpcert_t *pgpcerts = NULL;
|
|||||||
const pgpcert_t pgpcert_empty = {
|
const pgpcert_t pgpcert_empty = {
|
||||||
NULL , /* next */
|
NULL , /* next */
|
||||||
0 , /* version */
|
0 , /* version */
|
||||||
0 , /* installed */
|
|
||||||
0 , /* count */
|
0 , /* count */
|
||||||
{ NULL, 0 }, /* certificate */
|
{ NULL, 0 }, /* certificate */
|
||||||
0 , /* created */
|
0 , /* created */
|
||||||
@@ -309,7 +308,6 @@ bool parse_pgp(chunk_t blob, pgpcert_t *cert)
|
|||||||
|
|
||||||
/* parse a PGP certificate file */
|
/* parse a PGP certificate file */
|
||||||
cert->certificate = blob;
|
cert->certificate = blob;
|
||||||
time(&cert->installed);
|
|
||||||
|
|
||||||
while (blob.len > 0)
|
while (blob.len > 0)
|
||||||
{
|
{
|
||||||
@@ -479,8 +477,7 @@ void list_pgp_end_certs(bool utc)
|
|||||||
if (cert != NULL)
|
if (cert != NULL)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "List of PGP End certificates:");
|
whack_log(RC_COMMENT, "List of PGP End Entity Certificates:");
|
||||||
whack_log(RC_COMMENT, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (cert != NULL)
|
while (cert != NULL)
|
||||||
@@ -492,10 +489,10 @@ void list_pgp_end_certs(bool utc)
|
|||||||
c.type = CERT_PGP;
|
c.type = CERT_PGP;
|
||||||
c.u.pgp = cert;
|
c.u.pgp = cert;
|
||||||
|
|
||||||
whack_log(RC_COMMENT, "%T, count: %d", &cert->installed, utc, cert->count);
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, " digest: %Y", cert->fingerprint);
|
whack_log(RC_COMMENT, " digest: %Y", cert->fingerprint);
|
||||||
whack_log(RC_COMMENT, " created: %T", &cert->created, utc);
|
whack_log(RC_COMMENT, " created: %T", &cert->created, utc);
|
||||||
whack_log(RC_COMMENT, " until: %T %s", &cert->until, utc,
|
whack_log(RC_COMMENT, " until: %T %s", &cert->until, utc,
|
||||||
check_expiry(cert->until, CA_CERT_WARNING_INTERVAL, TRUE));
|
check_expiry(cert->until, CA_CERT_WARNING_INTERVAL, TRUE));
|
||||||
whack_log(RC_COMMENT, " pubkey: %N %4d bits%s",
|
whack_log(RC_COMMENT, " pubkey: %N %4d bits%s",
|
||||||
key_type_names, key->get_type(key),
|
key_type_names, key->get_type(key),
|
||||||
@@ -503,7 +500,7 @@ void list_pgp_end_certs(bool utc)
|
|||||||
has_private_key(c)? ", has private key" : "");
|
has_private_key(c)? ", has private key" : "");
|
||||||
if (key->get_fingerprint(key, KEY_ID_PUBKEY_INFO_SHA1, &keyid))
|
if (key->get_fingerprint(key, KEY_ID_PUBKEY_INFO_SHA1, &keyid))
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " keyid: %#B", &keyid);
|
whack_log(RC_COMMENT, " keyid: %#B", &keyid);
|
||||||
}
|
}
|
||||||
cert = cert->next;
|
cert = cert->next;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ typedef struct pgpcert pgpcert_t;
|
|||||||
struct pgpcert {
|
struct pgpcert {
|
||||||
pgpcert_t *next;
|
pgpcert_t *next;
|
||||||
int version;
|
int version;
|
||||||
time_t installed;
|
|
||||||
int count;
|
int count;
|
||||||
chunk_t certificate;
|
chunk_t certificate;
|
||||||
time_t created;
|
time_t created;
|
||||||
|
|||||||
@@ -263,7 +263,6 @@ bool pkcs7_parse_signedData(chunk_t blob, contentInfo_t *data, x509cert_t **cert
|
|||||||
BUILD_END);
|
BUILD_END);
|
||||||
if (newcert->cert)
|
if (newcert->cert)
|
||||||
{
|
{
|
||||||
time(&newcert->installed);
|
|
||||||
newcert->next = *cert;
|
newcert->next = *cert;
|
||||||
*cert = newcert;
|
*cert = newcert;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-15
@@ -124,7 +124,6 @@ static const asn1Object_t otherNameObjects[] = {
|
|||||||
const x509cert_t empty_x509cert = {
|
const x509cert_t empty_x509cert = {
|
||||||
NULL , /* cert */
|
NULL , /* cert */
|
||||||
NULL , /* *next */
|
NULL , /* *next */
|
||||||
UNDEFINED_TIME, /* installed */
|
|
||||||
0 , /* count */
|
0 , /* count */
|
||||||
FALSE /* smartcard */
|
FALSE /* smartcard */
|
||||||
};
|
};
|
||||||
@@ -1491,32 +1490,29 @@ void list_x509cert_chain(const char *caption, x509cert_t* cert,
|
|||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "List of X.509 %s Certificates:", caption);
|
whack_log(RC_COMMENT, "List of X.509 %s Certificates:", caption);
|
||||||
whack_log(RC_COMMENT, " ");
|
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
}
|
}
|
||||||
|
whack_log(RC_COMMENT, " ");
|
||||||
whack_log(RC_COMMENT, "%T, count: %d", &cert->installed, utc,
|
whack_log(RC_COMMENT, " subject: \"%Y\"",
|
||||||
cert->count);
|
|
||||||
whack_log(RC_COMMENT, " subject: '%Y'",
|
|
||||||
certificate->get_subject(certificate));
|
certificate->get_subject(certificate));
|
||||||
whack_log(RC_COMMENT, " issuer: '%Y'",
|
whack_log(RC_COMMENT, " issuer: \"%Y\"",
|
||||||
certificate->get_issuer(certificate));
|
certificate->get_issuer(certificate));
|
||||||
serial = x509->get_serial(x509);
|
serial = x509->get_serial(x509);
|
||||||
whack_log(RC_COMMENT, " serial: %#B", &serial);
|
whack_log(RC_COMMENT, " serial: %#B", &serial);
|
||||||
|
|
||||||
/* list validity */
|
/* list validity */
|
||||||
certificate->get_validity(certificate, &now, ¬Before, ¬After);
|
certificate->get_validity(certificate, &now, ¬Before, ¬After);
|
||||||
whack_log(RC_COMMENT, " validity: not before %T %s",
|
whack_log(RC_COMMENT, " validity: not before %T %s",
|
||||||
¬Before, utc,
|
¬Before, utc,
|
||||||
(notBefore < now)?"ok":"fatal (not valid yet)");
|
(notBefore < now)?"ok":"fatal (not valid yet)");
|
||||||
whack_log(RC_COMMENT, " not after %T %s",
|
whack_log(RC_COMMENT, " not after %T %s",
|
||||||
¬After, utc,
|
¬After, utc,
|
||||||
check_expiry(notAfter, CA_CERT_WARNING_INTERVAL, TRUE));
|
check_expiry(notAfter, CA_CERT_WARNING_INTERVAL, TRUE));
|
||||||
|
|
||||||
key = certificate->get_public_key(certificate);
|
key = certificate->get_public_key(certificate);
|
||||||
if (key);
|
if (key);
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " pubkey: %N %4d bits%s",
|
whack_log(RC_COMMENT, " pubkey: %N %4d bits%s",
|
||||||
key_type_names, key->get_type(key),
|
key_type_names, key->get_type(key),
|
||||||
key->get_keysize(key) * BITS_PER_BYTE,
|
key->get_keysize(key) * BITS_PER_BYTE,
|
||||||
cert->smartcard ? ", on smartcard" :
|
cert->smartcard ? ", on smartcard" :
|
||||||
@@ -1524,11 +1520,11 @@ void list_x509cert_chain(const char *caption, x509cert_t* cert,
|
|||||||
|
|
||||||
if (key->get_fingerprint(key, KEY_ID_PUBKEY_INFO_SHA1, &keyid))
|
if (key->get_fingerprint(key, KEY_ID_PUBKEY_INFO_SHA1, &keyid))
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " keyid: %#B", &keyid);
|
whack_log(RC_COMMENT, " keyid: %#B", &keyid);
|
||||||
}
|
}
|
||||||
if (key->get_fingerprint(key, KEY_ID_PUBKEY_SHA1, &subjkey))
|
if (key->get_fingerprint(key, KEY_ID_PUBKEY_SHA1, &subjkey))
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " subjkey: %#B", &subjkey);
|
whack_log(RC_COMMENT, " subjkey: %#B", &subjkey);
|
||||||
}
|
}
|
||||||
key->destroy(key);
|
key->destroy(key);
|
||||||
}
|
}
|
||||||
@@ -1537,7 +1533,7 @@ void list_x509cert_chain(const char *caption, x509cert_t* cert,
|
|||||||
authkey = x509->get_authKeyIdentifier(x509);
|
authkey = x509->get_authKeyIdentifier(x509);
|
||||||
if (authkey.ptr)
|
if (authkey.ptr)
|
||||||
{
|
{
|
||||||
whack_log(RC_COMMENT, " authkey: %#B", &authkey);
|
whack_log(RC_COMMENT, " authkey: %#B", &authkey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cert = cert->next;
|
cert = cert->next;
|
||||||
@@ -1549,5 +1545,5 @@ void list_x509cert_chain(const char *caption, x509cert_t* cert,
|
|||||||
*/
|
*/
|
||||||
void list_x509_end_certs(bool utc)
|
void list_x509_end_certs(bool utc)
|
||||||
{
|
{
|
||||||
list_x509cert_chain("End", x509certs, X509_NONE, utc);
|
list_x509cert_chain("End Entity", x509certs, X509_NONE, utc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ typedef struct x509cert x509cert_t;
|
|||||||
struct x509cert {
|
struct x509cert {
|
||||||
certificate_t *cert;
|
certificate_t *cert;
|
||||||
x509cert_t *next;
|
x509cert_t *next;
|
||||||
time_t installed;
|
|
||||||
int count;
|
int count;
|
||||||
bool smartcard;
|
bool smartcard;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user