stroke: add exportconn{cert,chain} commands in addition to exportx509
The new commands either export a single end entity certificate or the full trust chain for a specific connection name.
This commit is contained in:
+7
-1
@@ -321,6 +321,8 @@ static int purge(stroke_keyword_t kw)
|
||||
|
||||
static int export_flags[] = {
|
||||
EXPORT_X509,
|
||||
EXPORT_CONN_CERT,
|
||||
EXPORT_CONN_CHAIN,
|
||||
};
|
||||
|
||||
static int export(stroke_keyword_t kw, char *selector)
|
||||
@@ -449,6 +451,8 @@ static void exit_usage(char *error)
|
||||
printf(" stroke purgeike\n");
|
||||
printf(" Export credentials to the console:\n");
|
||||
printf(" stroke exportx509 DN\n");
|
||||
printf(" stroke exportconncert connname\n");
|
||||
printf(" stroke exportconnchain connname\n");
|
||||
printf(" Show current memory usage:\n");
|
||||
printf(" stroke memusage\n");
|
||||
printf(" Show leases of a pool:\n");
|
||||
@@ -587,9 +591,11 @@ int main(int argc, char *argv[])
|
||||
res = purge(token->kw);
|
||||
break;
|
||||
case STROKE_EXPORT_X509:
|
||||
case STROKE_EXPORT_CONN_CERT:
|
||||
case STROKE_EXPORT_CONN_CHAIN:
|
||||
if (argc != 3)
|
||||
{
|
||||
exit_usage("\"exportx509\" needs a distinguished name");
|
||||
exit_usage("\"export\" needs a name");
|
||||
}
|
||||
res = export(token->kw, argv[2]);
|
||||
break;
|
||||
|
||||
@@ -55,6 +55,8 @@ typedef enum {
|
||||
STROKE_PURGE_CERTS,
|
||||
STROKE_PURGE_IKE,
|
||||
STROKE_EXPORT_X509,
|
||||
STROKE_EXPORT_CONN_CERT,
|
||||
STROKE_EXPORT_CONN_CHAIN,
|
||||
STROKE_LEASES,
|
||||
STROKE_MEMUSAGE,
|
||||
STROKE_USER_CREDS,
|
||||
|
||||
@@ -62,6 +62,8 @@ purgecrls, STROKE_PURGE_CRLS
|
||||
purgecerts, STROKE_PURGE_CERTS
|
||||
purgeike, STROKE_PURGE_IKE
|
||||
exportx509, STROKE_EXPORT_X509
|
||||
exportconncert, STROKE_EXPORT_CONN_CERT
|
||||
exportconnchain, STROKE_EXPORT_CONN_CHAIN
|
||||
leases, STROKE_LEASES
|
||||
memusage, STROKE_MEMUSAGE
|
||||
user-creds, STROKE_USER_CREDS
|
||||
|
||||
@@ -123,6 +123,10 @@ typedef enum export_flag_t export_flag_t;
|
||||
enum export_flag_t {
|
||||
/** export an X509 certificate */
|
||||
EXPORT_X509 = 0x0001,
|
||||
/** export an X509 end entity certificate for a connection */
|
||||
EXPORT_CONN_CERT = 0x0002,
|
||||
/** export the complete trust chain of a connection */
|
||||
EXPORT_CONN_CHAIN = 0x0004,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user