Skip to content

Commit 3da2179

Browse files
authored
Merge pull request #7 from dgarske/test
Added GitHub action CI tests
2 parents 88e0f16 + 8e9f56b commit 3da2179

File tree

11 files changed

+184
-33
lines changed

11 files changed

+184
-33
lines changed

.github/workflows/make-test.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: wolfKeyMgr Reusable Build Workflow
2+
3+
on:
4+
5+
workflow_call:
6+
inputs:
7+
config-args:
8+
required: false
9+
type: string
10+
make-args:
11+
required: false
12+
type: string
13+
14+
jobs:
15+
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
steps:
21+
- name: Install libevent and libpcap
22+
run: |
23+
sudo apt update
24+
sudo apt install -y libevent-dev libpcap-dev
25+
26+
# pull wolfKeyMgr
27+
- uses: actions/checkout@master
28+
29+
# wolfSSL build, check and install
30+
- uses: actions/checkout@master
31+
with:
32+
repository: wolfssl/wolfssl
33+
path: wolfssl
34+
- name: wolfssl build
35+
working-directory: ./wolfssl
36+
run: |
37+
./autogen.sh
38+
./configure --enable-sniffer --enable-curve25519 --enable-curve448 --enable-enckeys CFLAGS="-DWOLFSSL_DH_EXTRA"
39+
make
40+
make check
41+
make dist
42+
sudo make install
43+
44+
# wolfKeyMgr build, check and install
45+
- name: wolfKeyMgr build
46+
run: |
47+
./autogen.sh
48+
./configure
49+
make
50+
- name: wolfKeyMgr make check
51+
run: make check
52+
- name: wolfKeyMgr make install
53+
run: sudo make install
54+
- name: wolfKeyMgr make dist
55+
run: make dist
56+
57+
# wolfKeyMgr examples
58+
- name: start key manager service
59+
run: ./src/wolfkeymgr &
60+
- name: run https server
61+
run: ./examples/https/server &
62+
- name: run the middle box decryptor
63+
run: NOSTDIN=1 ./examples/middlebox/decrypt &
64+
- name: run the https client
65+
run: ./examples/https/client
66+
67+
68+
# capture logs on failure
69+
- name: Upload failure logs
70+
if: failure()
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: wolfKeyMgr-logs
74+
path: |
75+
test-suite.log
76+
retention-days: 5

.github/workflows/test-nightly.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: wolfKeyMgr Nightly Build Workflow
2+
3+
on:
4+
schedule:
5+
# ┌───────────── minute (0 - 59)
6+
# │ ┌───────────── hour (0 - 23)
7+
# │ │ ┌───────────── day of the month (1 - 31)
8+
# │ │ │ ┌───────────── month (1 - 12)
9+
# │ │ │ │ ┌───────────── day of the week (0 - 6)
10+
# │ │ │ │ │
11+
# │ │ │ │ │
12+
# │ │ │ │ │
13+
# * * * * *
14+
- cron: '5 0 * * *' # Run once per day at 5 AM
15+
16+
jobs:
17+
18+
build_test:
19+
uses: ./.github/workflows/make-test.yml
20+
with:
21+
config-args:
22+
make-args:
23+
24+
build_debug_test:
25+
uses: ./.github/workflows/make-test.yml
26+
with:
27+
config-args: --enable-debug
28+
make-args:
29+
30+
build_no_vault_test:
31+
uses: ./.github/workflows/make-test.yml
32+
with:
33+
config-args: --disable-vault
34+
make-args:

.github/workflows/test-pull.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: wolfKeyMgr Pull Request Build Workflow
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
11+
build_test:
12+
uses: ./.github/workflows/make-test.yml
13+
with:
14+
config-args:
15+
make-args:
16+
17+
build_debug_test:
18+
uses: ./.github/workflows/make-test.yml
19+
with:
20+
config-args: --enable-debug
21+
make-args:
22+
23+
build_no_vault_test:
24+
uses: ./.github/workflows/make-test.yml
25+
with:
26+
config-args: --disable-vault
27+
make-args:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Notes:
102102
* A custom install location can be specified using: `./configure --prefix=/opt/local`
103103
* `autogen.sh` is script to generate configure, you'll need the autoconf tools
104104
installed, then proceed to the next step.
105-
* `src/wolfkeymgr` is the key manager service / dameon. A make install will typically put it into `/usr/local/bin/wolfkeymgr` or ``/usr/bin/wolfkeymgr`.
105+
* `src/wolfkeymgr` is the key manager service / daemon. A make install will typically put it into `/usr/local/bin/wolfkeymgr` or ``/usr/bin/wolfkeymgr`.
106106

107107
## Examples
108108

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ LIB_SOCKET_NSL
124124

125125
# SNIFFER
126126
AC_ARG_ENABLE([sniffer],
127-
[AS_HELP_STRING([--enable-sniffer],[Enable sniffer support (default: disabled)])],
127+
[AS_HELP_STRING([--enable-sniffer],[Enable sniffer support (default: enabled)])],
128128
[ ENABLED_SNIFFER=$enableval ],
129129
[ ENABLED_SNIFFER=yes ]
130130
)

examples/middlebox/decrypt.c

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <string.h> /* strcmp */
4242
#include <signal.h> /* signal */
4343
#include <ctype.h> /* isprint */
44+
#include <stdlib.h> /* getenv */
4445

4546
#ifndef _WIN32
4647
#include <sys/socket.h> /* AF_INET */
@@ -370,7 +371,7 @@ int middlebox_decrypt_test(int argc, char** argv)
370371

371372
signal(SIGINT, sig_handler);
372373

373-
if (argc == 2 &&
374+
if (argc == 2 &&
374375
(XSTRNCMP(argv[1], "-?", 2) == 0 ||
375376
XSTRNCMP(argv[1], "-h", 2) == 0 ||
376377
XSTRNCMP(argv[1], "--help", 6) == 0))
@@ -396,6 +397,10 @@ int middlebox_decrypt_test(int argc, char** argv)
396397

397398
if (argc == 1) {
398399
char cmdLineArg[128];
400+
int nostdin = 0;
401+
const char* nostdinStr = getenv("NOSTDIN");
402+
if (nostdinStr != NULL)
403+
nostdin = atoi(nostdinStr);
399404

400405
/* normal case, user chooses device and port */
401406
if (pcap_findalldevs(&gPcapAllDevs, err) == -1) {
@@ -416,10 +421,12 @@ int middlebox_decrypt_test(int argc, char** argv)
416421
" installed correctly and you have sufficient permissions");
417422
}
418423

419-
printf("Enter the interface number (1-%d) [default: %d]: ", i, defDev);
420-
memset(cmdLineArg, 0, sizeof(cmdLineArg));
421-
if (fgets(cmdLineArg, sizeof(cmdLineArg), stdin)) {
422-
inum = atoi(cmdLineArg);
424+
if (nostdin == 0) {
425+
printf("Enter the interface number (1-%d) [default: %d]: ", i, defDev);
426+
memset(cmdLineArg, 0, sizeof(cmdLineArg));
427+
if (fgets(cmdLineArg, sizeof(cmdLineArg), stdin)) {
428+
inum = atoi(cmdLineArg);
429+
}
423430
}
424431
if (inum == 0) {
425432
if (defDev == 0) defDev = 1;
@@ -475,10 +482,12 @@ int middlebox_decrypt_test(int argc, char** argv)
475482
fprintf(stderr, "pcap_activate failed %s\n", pcap_geterr(gPcap));
476483
}
477484

478-
printf("Enter the port to scan [default: %d]: ", portDef);
479-
memset(cmdLineArg, 0, sizeof(cmdLineArg));
480-
if (fgets(cmdLineArg, sizeof(cmdLineArg), stdin)) {
481-
port = atoi(cmdLineArg);
485+
if (nostdin == 0) {
486+
printf("Enter the port to scan [default: %d]: ", portDef);
487+
memset(cmdLineArg, 0, sizeof(cmdLineArg));
488+
if (fgets(cmdLineArg, sizeof(cmdLineArg), stdin)) {
489+
port = atoi(cmdLineArg);
490+
}
482491
}
483492
if (port <= 0) {
484493
port = portDef;
@@ -502,22 +511,26 @@ int middlebox_decrypt_test(int argc, char** argv)
502511
printf("Enter the server key [default: %s]: ", keyFilesSrc);
503512
memset(keyFilesBuf, 0, sizeof(keyFilesBuf));
504513
memset(keyFilesUser, 0, sizeof(keyFilesUser));
505-
if (fgets(keyFilesUser, sizeof(keyFilesUser), stdin)) {
506-
TrimNewLine(keyFilesUser);
507-
if (strlen(keyFilesUser) > 0) {
508-
keyFilesSrc = keyFilesUser;
514+
if (nostdin == 0) {
515+
if (fgets(keyFilesUser, sizeof(keyFilesUser), stdin)) {
516+
TrimNewLine(keyFilesUser);
517+
if (strlen(keyFilesUser) > 0) {
518+
keyFilesSrc = keyFilesUser;
519+
}
509520
}
510521
}
511522
strncpy(keyFilesBuf, keyFilesSrc, sizeof(keyFilesBuf));
512523

513524
/* optionally enter a named key (SNI) */
514525
#if !defined(WOLFSSL_SNIFFER_WATCH) && defined(HAVE_SNI)
515-
printf("Enter alternate SNI [default: none]: ");
516-
memset(cmdLineArg, 0, sizeof(cmdLineArg));
517-
if (fgets(cmdLineArg, sizeof(cmdLineArg), stdin)) {
518-
TrimNewLine(cmdLineArg);
519-
if (strlen(cmdLineArg) > 0) {
520-
sniName = cmdLineArg;
526+
if (nostdin == 0) {
527+
printf("Enter alternate SNI [default: none]: ");
528+
memset(cmdLineArg, 0, sizeof(cmdLineArg));
529+
if (fgets(cmdLineArg, sizeof(cmdLineArg), stdin)) {
530+
TrimNewLine(cmdLineArg);
531+
if (strlen(cmdLineArg) > 0) {
532+
sniName = cmdLineArg;
533+
}
521534
}
522535
}
523536
#endif /* !WOLFSSL_SNIFFER_WATCH && HAVE_SNI */

m4/ltoptions.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Helper functions for option handling. -*- Autoconf -*-
22
#
3-
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
4-
# Foundation, Inc.
3+
# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free
4+
# Software Foundation, Inc.
55
# Written by Gary V. Vaughan, 2004
66
#
77
# This file is free software; the Free Software Foundation gives

m4/ltsugar.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
22
#
3-
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
3+
# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software
44
# Foundation, Inc.
55
# Written by Gary V. Vaughan, 2004
66
#

m4/ltversion.m4

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ltversion.m4 -- version numbers -*- Autoconf -*-
22
#
3-
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
3+
# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation,
4+
# Inc.
45
# Written by Scott James Remnant, 2004
56
#
67
# This file is free software; the Free Software Foundation gives
@@ -9,15 +10,15 @@
910

1011
# @configure_input@
1112

12-
# serial 4179 ltversion.m4
13+
# serial 4245 ltversion.m4
1314
# This file is part of GNU Libtool
1415

15-
m4_define([LT_PACKAGE_VERSION], [2.4.6])
16-
m4_define([LT_PACKAGE_REVISION], [2.4.6])
16+
m4_define([LT_PACKAGE_VERSION], [2.4.7])
17+
m4_define([LT_PACKAGE_REVISION], [2.4.7])
1718

1819
AC_DEFUN([LTVERSION_VERSION],
19-
[macro_version='2.4.6'
20-
macro_revision='2.4.6'
20+
[macro_version='2.4.7'
21+
macro_revision='2.4.7'
2122
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
2223
_LT_DECL(, macro_revision, 0)
2324
])

m4/lt~obsolete.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
22
#
3-
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
4-
# Foundation, Inc.
3+
# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free
4+
# Software Foundation, Inc.
55
# Written by Scott James Remnant, 2004.
66
#
77
# This file is free software; the Free Software Foundation gives

0 commit comments

Comments
 (0)