diff options
Diffstat (limited to 'src/stroke/stroke.c')
-rw-r--r-- | src/stroke/stroke.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/stroke/stroke.c b/src/stroke/stroke.c index 32e628df1..103617f08 100644 --- a/src/stroke/stroke.c +++ b/src/stroke/stroke.c @@ -288,9 +288,23 @@ static int purge(stroke_keyword_t kw) return send_stroke_msg(&msg); } -static int leases(stroke_keyword_t kw, char *pool, char *address) +static int export_flags[] = { + EXPORT_X509, +}; + +static int export(stroke_keyword_t kw, char *selector) { + stroke_msg_t msg; + msg.type = STR_EXPORT; + msg.length = offsetof(stroke_msg_t, buffer); + msg.export.selector = push_string(&msg, selector); + msg.export.flags = export_flags[kw - STROKE_EXPORT_FIRST]; + return send_stroke_msg(&msg); +} + +static int leases(stroke_keyword_t kw, char *pool, char *address) +{ stroke_msg_t msg; msg.type = STR_LEASES; @@ -361,6 +375,8 @@ static void exit_usage(char *error) printf(" stroke purgeocsp\n"); printf(" Purge IKE_SAs without a CHILD_SA:\n"); printf(" stroke purgeike\n"); + printf(" Export credentials to the console:\n"); + printf(" stroke exportx509 DN\n"); printf(" Show leases of a pool:\n"); printf(" stroke leases [POOL [ADDRESS]]\n"); exit_error(error); @@ -478,6 +494,13 @@ int main(int argc, char *argv[]) case STROKE_PURGE_IKE: res = purge(token->kw); break; + case STROKE_EXPORT_X509: + if (argc != 3) + { + exit_usage("\"exportx509\" needs a distinguished name"); + } + res = export(token->kw, argv[2]); + break; case STROKE_LEASES: res = leases(token->kw, argc > 2 ? argv[2] : NULL, argc > 3 ? argv[3] : NULL); |