added support of ca information records and ocsp keywords
This commit is contained in:
+27
-1
@@ -211,7 +211,10 @@ static int show_status(stroke_keyword_t kw, char *connection)
|
|||||||
static int list_flags[] = {
|
static int list_flags[] = {
|
||||||
LIST_CERTS,
|
LIST_CERTS,
|
||||||
LIST_CACERTS,
|
LIST_CACERTS,
|
||||||
|
LIST_OCSPCERTS,
|
||||||
|
LIST_CAINFOS,
|
||||||
LIST_CRLS,
|
LIST_CRLS,
|
||||||
|
LIST_OCSP,
|
||||||
LIST_ALL
|
LIST_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -228,6 +231,7 @@ static int list(stroke_keyword_t kw, int utc)
|
|||||||
|
|
||||||
static int reread_flags[] = {
|
static int reread_flags[] = {
|
||||||
REREAD_CACERTS,
|
REREAD_CACERTS,
|
||||||
|
REREAD_OCSPCERTS,
|
||||||
REREAD_CRLS,
|
REREAD_CRLS,
|
||||||
REREAD_ALL
|
REREAD_ALL
|
||||||
};
|
};
|
||||||
@@ -242,6 +246,20 @@ static int reread(stroke_keyword_t kw)
|
|||||||
return send_stroke_msg(&msg);
|
return send_stroke_msg(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int purge_flags[] = {
|
||||||
|
PURGE_OCSP
|
||||||
|
};
|
||||||
|
|
||||||
|
static int purge(stroke_keyword_t kw)
|
||||||
|
{
|
||||||
|
stroke_msg_t msg;
|
||||||
|
|
||||||
|
msg.type = STR_PURGE;
|
||||||
|
msg.length = offsetof(stroke_msg_t, buffer);
|
||||||
|
msg.purge.flags = purge_flags[kw - STROKE_PURGE_FIRST];
|
||||||
|
return send_stroke_msg(&msg);
|
||||||
|
}
|
||||||
|
|
||||||
static int set_loglevel(char *type, u_int level)
|
static int set_loglevel(char *type, u_int level)
|
||||||
{
|
{
|
||||||
stroke_msg_t msg;
|
stroke_msg_t msg;
|
||||||
@@ -288,9 +306,11 @@ static void exit_usage(char *error)
|
|||||||
printf(" Show connection status:\n");
|
printf(" Show connection status:\n");
|
||||||
printf(" stroke status\n");
|
printf(" stroke status\n");
|
||||||
printf(" Show list of locally loaded certificates and crls:\n");
|
printf(" Show list of locally loaded certificates and crls:\n");
|
||||||
printf(" stroke listcerts|listcacerts|listcrls|listall\n");
|
printf(" stroke listcerts|listcacerts|listocspcerts|listcainfos|listcrls|listocsp|listall\n");
|
||||||
printf(" Reload ca certificates and crls:\n");
|
printf(" Reload ca certificates and crls:\n");
|
||||||
printf(" stroke rereadcacerts|rereadcrls|rereadall\n");
|
printf(" stroke rereadcacerts|rereadcrls|rereadall\n");
|
||||||
|
printf(" Purge ocsp cache entries:\n");
|
||||||
|
printf(" stroke purgeocsp\n");
|
||||||
exit_error(error);
|
exit_error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +393,10 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case STROKE_LIST_CERTS:
|
case STROKE_LIST_CERTS:
|
||||||
case STROKE_LIST_CACERTS:
|
case STROKE_LIST_CACERTS:
|
||||||
|
case STROKE_LIST_OCSPCERTS:
|
||||||
|
case STROKE_LIST_CAINFOS:
|
||||||
case STROKE_LIST_CRLS:
|
case STROKE_LIST_CRLS:
|
||||||
|
case STROKE_LIST_OCSP:
|
||||||
case STROKE_LIST_ALL:
|
case STROKE_LIST_ALL:
|
||||||
res = list(token->kw, argc > 2 && strcmp(argv[2], "--utc") == 0);
|
res = list(token->kw, argc > 2 && strcmp(argv[2], "--utc") == 0);
|
||||||
break;
|
break;
|
||||||
@@ -382,6 +405,9 @@ int main(int argc, char *argv[])
|
|||||||
case STROKE_REREAD_ALL:
|
case STROKE_REREAD_ALL:
|
||||||
res = reread(token->kw);
|
res = reread(token->kw);
|
||||||
break;
|
break;
|
||||||
|
case STROKE_PURGE_OCSP:
|
||||||
|
res = purge(token->kw);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
exit_usage(NULL);
|
exit_usage(NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-11
@@ -40,15 +40,21 @@ typedef enum list_flag_t list_flag_t;
|
|||||||
*/
|
*/
|
||||||
enum list_flag_t {
|
enum list_flag_t {
|
||||||
/** don't list anything */
|
/** don't list anything */
|
||||||
LIST_NONE = 0x0000,
|
LIST_NONE = 0x0000,
|
||||||
/** list all host/user certs */
|
/** list all host/user certs */
|
||||||
LIST_CERTS = 0x0001,
|
LIST_CERTS = 0x0001,
|
||||||
/** list all ca certs */
|
/** list all ca certs */
|
||||||
LIST_CACERTS = 0x0002,
|
LIST_CACERTS = 0x0002,
|
||||||
|
/** list all ocsp signer certs */
|
||||||
|
LIST_OCSPCERTS = 0x0004,
|
||||||
|
/** list all ca information records */
|
||||||
|
LIST_CAINFOS = 0x0008,
|
||||||
/** list all crls */
|
/** list all crls */
|
||||||
LIST_CRLS = 0x0004,
|
LIST_CRLS = 0x0010,
|
||||||
|
/** list all ocsp cache entries */
|
||||||
|
LIST_OCSP = 0x0020,
|
||||||
/** all list options */
|
/** all list options */
|
||||||
LIST_ALL = 0x0007,
|
LIST_ALL = 0x003F,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum reread_flag_t reread_flag_t;
|
typedef enum reread_flag_t reread_flag_t;
|
||||||
@@ -59,13 +65,28 @@ typedef enum reread_flag_t reread_flag_t;
|
|||||||
*/
|
*/
|
||||||
enum reread_flag_t {
|
enum reread_flag_t {
|
||||||
/** don't reread anything */
|
/** don't reread anything */
|
||||||
REREAD_NONE = 0x0000,
|
REREAD_NONE = 0x0000,
|
||||||
/** reread all ca certs */
|
/** reread all ca certs */
|
||||||
REREAD_CACERTS = 0x0001,
|
REREAD_CACERTS = 0x0001,
|
||||||
|
/** reread all ocsp signer certs */
|
||||||
|
REREAD_OCSPCERTS = 0x0002,
|
||||||
/** reread all crls */
|
/** reread all crls */
|
||||||
REREAD_CRLS = 0x0002,
|
REREAD_CRLS = 0x0004,
|
||||||
/** all reread options */
|
/** all reread options */
|
||||||
REREAD_ALL = 0x0003,
|
REREAD_ALL = 0x0007,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum purge_flag_t purge_flag_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Definition of the PURGE flags, currently used for
|
||||||
|
* the stroke purgeocsp command.
|
||||||
|
*/
|
||||||
|
enum purge_flag_t {
|
||||||
|
/** don't purge anything */
|
||||||
|
PURGE_NONE = 0x0000,
|
||||||
|
/** purge ocsp cache entries */
|
||||||
|
PURGE_OCSP = 0x0001,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct stroke_end_t stroke_end_t;
|
typedef struct stroke_end_t stroke_end_t;
|
||||||
@@ -114,12 +135,18 @@ struct stroke_msg_t {
|
|||||||
STR_STATUS,
|
STR_STATUS,
|
||||||
/* show verbose connection status */
|
/* show verbose connection status */
|
||||||
STR_STATUS_ALL,
|
STR_STATUS_ALL,
|
||||||
|
/* add a ca information record */
|
||||||
|
STR_ADD_CA,
|
||||||
|
/* delete ca information record */
|
||||||
|
STR_DEL_CA,
|
||||||
/* set a log type to log/not log */
|
/* set a log type to log/not log */
|
||||||
STR_LOGLEVEL,
|
STR_LOGLEVEL,
|
||||||
/* list various objects */
|
/* list various objects */
|
||||||
STR_LIST,
|
STR_LIST,
|
||||||
/* reread various objects */
|
/* reread various objects */
|
||||||
STR_REREAD
|
STR_REREAD,
|
||||||
|
/* purge various objects */
|
||||||
|
STR_PURGE
|
||||||
/* more to come */
|
/* more to come */
|
||||||
} type;
|
} type;
|
||||||
|
|
||||||
@@ -130,7 +157,7 @@ struct stroke_msg_t {
|
|||||||
/* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
|
/* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
|
||||||
struct {
|
struct {
|
||||||
char *name;
|
char *name;
|
||||||
} initiate, route, unroute, terminate, status, del_conn;
|
} initiate, route, unroute, terminate, status, del_conn, del_ca;
|
||||||
|
|
||||||
/* data for STR_ADD_CONN */
|
/* data for STR_ADD_CONN */
|
||||||
struct {
|
struct {
|
||||||
@@ -158,6 +185,15 @@ struct stroke_msg_t {
|
|||||||
stroke_end_t me, other;
|
stroke_end_t me, other;
|
||||||
} add_conn;
|
} add_conn;
|
||||||
|
|
||||||
|
/* data for STR_ADD_CA */
|
||||||
|
struct {
|
||||||
|
char *name;
|
||||||
|
char *cacert;
|
||||||
|
char *crluri;
|
||||||
|
char *crluri2;
|
||||||
|
char *ocspuri;
|
||||||
|
} add_ca;
|
||||||
|
|
||||||
/* data for STR_LOGLEVEL */
|
/* data for STR_LOGLEVEL */
|
||||||
struct {
|
struct {
|
||||||
char *type;
|
char *type;
|
||||||
@@ -175,6 +211,10 @@ struct stroke_msg_t {
|
|||||||
reread_flag_t flags;
|
reread_flag_t flags;
|
||||||
} reread;
|
} reread;
|
||||||
|
|
||||||
|
/* data for STR_PURGE */
|
||||||
|
struct {
|
||||||
|
purge_flag_t flags;
|
||||||
|
} purge;
|
||||||
};
|
};
|
||||||
char buffer[STROKE_BUF_LEN];
|
char buffer[STROKE_BUF_LEN];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,15 +31,21 @@ typedef enum {
|
|||||||
STROKE_STATUSALL,
|
STROKE_STATUSALL,
|
||||||
STROKE_LIST_CERTS,
|
STROKE_LIST_CERTS,
|
||||||
STROKE_LIST_CACERTS,
|
STROKE_LIST_CACERTS,
|
||||||
|
STROKE_LIST_OCSPCERTS,
|
||||||
|
STROKE_LIST_CAINFOS,
|
||||||
STROKE_LIST_CRLS,
|
STROKE_LIST_CRLS,
|
||||||
|
STROKE_LIST_OCSP,
|
||||||
STROKE_LIST_ALL,
|
STROKE_LIST_ALL,
|
||||||
STROKE_REREAD_CACERTS,
|
STROKE_REREAD_CACERTS,
|
||||||
|
STROKE_REREAD_OCSPCERTS,
|
||||||
STROKE_REREAD_CRLS,
|
STROKE_REREAD_CRLS,
|
||||||
STROKE_REREAD_ALL
|
STROKE_REREAD_ALL,
|
||||||
|
STROKE_PURGE_OCSP
|
||||||
} stroke_keyword_t;
|
} stroke_keyword_t;
|
||||||
|
|
||||||
#define STROKE_LIST_FIRST STROKE_LIST_CERTS
|
#define STROKE_LIST_FIRST STROKE_LIST_CERTS
|
||||||
#define STROKE_REREAD_FIRST STROKE_REREAD_CACERTS
|
#define STROKE_REREAD_FIRST STROKE_REREAD_CACERTS
|
||||||
|
#define STROKE_PURGE_FIRST STROKE_PURGE_OCSP
|
||||||
|
|
||||||
typedef struct stroke_token stroke_token_t;
|
typedef struct stroke_token stroke_token_t;
|
||||||
|
|
||||||
|
|||||||
@@ -26,20 +26,25 @@ struct stroke_token {
|
|||||||
stroke_keyword_t kw;
|
stroke_keyword_t kw;
|
||||||
};
|
};
|
||||||
%%
|
%%
|
||||||
add, STROKE_ADD
|
add, STROKE_ADD
|
||||||
del, STROKE_DEL
|
del, STROKE_DEL
|
||||||
delete, STROKE_DELETE
|
delete, STROKE_DELETE
|
||||||
route, STROKE_ROUTE
|
route, STROKE_ROUTE
|
||||||
unroute, STROKE_UNROUTE
|
unroute, STROKE_UNROUTE
|
||||||
up, STROKE_UP
|
up, STROKE_UP
|
||||||
down, STROKE_DOWN
|
down, STROKE_DOWN
|
||||||
loglevel, STROKE_LOGLEVEL
|
loglevel, STROKE_LOGLEVEL
|
||||||
status, STROKE_STATUS
|
status, STROKE_STATUS
|
||||||
statusall, STROKE_STATUSALL
|
statusall, STROKE_STATUSALL
|
||||||
listcerts, STROKE_LIST_CERTS
|
listcerts, STROKE_LIST_CERTS
|
||||||
listcacerts, STROKE_LIST_CACERTS
|
listcacerts, STROKE_LIST_CACERTS
|
||||||
listcrls, STROKE_LIST_CRLS
|
listocspcerts, STROKE_LIST_OCSPCERTS
|
||||||
listall, STROKE_LIST_ALL,
|
listcainfos, STROKE_LIST_CAINFOS
|
||||||
rereadcacerts, STROKE_REREAD_CACERTS,
|
listcrls, STROKE_LIST_CRLS
|
||||||
rereadcrls, STROKE_REREAD_CRLS,
|
listocsp, STROKE_LIST_OCSP
|
||||||
rereadall, STROKE_REREAD_ALL
|
listall, STROKE_LIST_ALL
|
||||||
|
rereadcacerts, STROKE_REREAD_CACERTS
|
||||||
|
rereadocspcerts, STROKE_REREAD_OCSPCERTS
|
||||||
|
rereadcrls, STROKE_REREAD_CRLS
|
||||||
|
rereadall, STROKE_REREAD_ALL
|
||||||
|
purgeocsp, STROKE_PURGE_OCSP
|
||||||
|
|||||||
Reference in New Issue
Block a user