diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-08-29 20:07:41 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2019-08-31 12:17:29 +0200 |
commit | c1852e9a7140d69f8d308b3463fc1ec1159761ef (patch) | |
tree | f3a02c68ad1b6a60c63684b349777dff6ff6de08 /src/tools | |
parent | 63656e5c26c108263006695c5a77ae00e5bf26b1 (diff) | |
download | ouroboros-c1852e9a7140d69f8d308b3463fc1ec1159761ef.tar.gz ouroboros-c1852e9a7140d69f8d308b3463fc1ec1159761ef.zip |
tools: Add encryption option to ovpn
This adds a -C, --crypt option to the ovpn tool to easily create AES
encrypted IP tunnels.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/ovpn/ovpn.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/tools/ovpn/ovpn.c b/src/tools/ovpn/ovpn.c index 54708730..0f1ec3e3 100644 --- a/src/tools/ovpn/ovpn.c +++ b/src/tools/ovpn/ovpn.c @@ -68,6 +68,7 @@ static void usage(void) "server to connect to\n" " -i, --ip IP address to give to TUN device\n" " -m, --mask Subnet mask to give to TUN device\n" + " -C, --crypt AES encryption (default: off)\n" "\n" " --help Display this help text and exit\n"); } @@ -187,13 +188,15 @@ int main(int argc, sigset_t sigset; int sig; int c; + qosspec_t qs; static struct option long_options[] = - {{"ip", required_argument, NULL, 'i'}, - {"mask", required_argument, NULL, 'm'}, - {"name", optional_argument, NULL, 'n'}, - {"help", no_argument, NULL, 'h'}, - {NULL, 0, NULL, 0} + {{"ip", required_argument, NULL, 'i'}, + {"mask", required_argument, NULL, 'm'}, + {"name", optional_argument, NULL, 'n'}, + {"crypt", no_argument, NULL, 'C'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} }; sigemptyset(&sigset); @@ -207,7 +210,9 @@ int main(int argc, exit(EXIT_FAILURE); } - while ((c = getopt_long(argc, argv, "i:m:n:h", + qs = qos_raw; + + while ((c = getopt_long(argc, argv, "i:m:n:Ch", long_options, NULL)) != -1) { switch (c) { case 'i': @@ -226,6 +231,9 @@ int main(int argc, case 'n': name = optarg; break; + case 'C': + qs = qos_raw_crypt; + break; case 'h': usage(); exit(EXIT_SUCCESS); @@ -255,7 +263,7 @@ int main(int argc, if (name != NULL) { printf("Allocating a flow to %s.\n", name); - o_fd = flow_alloc(name, NULL, NULL); + o_fd = flow_alloc(name, &qs, NULL); if (o_fd < 0) { printf("Failed to allocate flow.\n"); goto fail_alloc; |