From e528f519bc51916615c47f6f9fcbedae36922b08 Mon Sep 17 00:00:00 2001 From: yrutschle Date: Mon, 11 Mar 2019 22:21:56 +0100 Subject: [PATCH] relax address matching rule so it matches more than just 'localhost' --- sslh-conf.c | 38 +++++++++++++++++++------------------- sslh-conf.h | 2 +- sslhconf.cfg | 18 +++++++++--------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sslh-conf.c b/sslh-conf.c index 78880104..9ee5978d 100644 --- a/sslh-conf.c +++ b/sslh-conf.c @@ -1,5 +1,5 @@ /* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README) - * on Sun Mar 10 09:52:17 2019. */ + * on Mon Mar 11 22:19:38 2019. */ #define _GNU_SOURCE #include @@ -571,13 +571,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_listen->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_listen->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -610,13 +610,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_ssh->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_ssh->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -661,13 +661,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_tls->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_tls->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -711,13 +711,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_openvpn->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_openvpn->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -761,13 +761,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_tinc->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_tinc->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -811,13 +811,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_xmpp->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_xmpp->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -860,13 +860,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_http->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_http->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -909,13 +909,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_adb->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_adb->sval [cl_i], MAX_MATCH, &pmatch[0], 0); @@ -958,13 +958,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) { for (cl_i = 0; cl_i < sslhcfg_socks5->count; cl_i++) { regex_t preg; regmatch_t pmatch[MAX_MATCH]; - int res = regcomp(&preg, "(\\w+):(\\w+)", REG_EXTENDED); + int res = regcomp(&preg, "(.+):(\\w+)", REG_EXTENDED); if (res) { int errlen = regerror(res, &preg, NULL, 0); char* errmsg = malloc(errlen); regerror(res, &preg, errmsg, errlen); - fprintf(stderr, "(\\w+):(\\w+): %s\n", errmsg); + fprintf(stderr, "(.+):(\\w+): %s\n", errmsg); exit(1); } res = regexec(&preg, sslhcfg_socks5->sval [cl_i], MAX_MATCH, &pmatch[0], 0); diff --git a/sslh-conf.h b/sslh-conf.h index 5aafa739..3ae16a9e 100644 --- a/sslh-conf.h +++ b/sslh-conf.h @@ -1,5 +1,5 @@ /* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README) - * on Sun Mar 10 09:52:17 2019. */ + * on Mon Mar 11 22:19:38 2019. */ #ifndef C2S_SSLHCFG_H #define C2S_SSLHCFG_H diff --git a/sslhconf.cfg b/sslhconf.cfg index dd29bc81..904f6009 100644 --- a/sslhconf.cfg +++ b/sslhconf.cfg @@ -101,7 +101,7 @@ config: { # This may not be the right abstraction at all and way too # sslh-centric cl_groups: ( - { name: "listen"; pattern: "(\w+):(\w+)"; description: "Listen on host:port"; + { name: "listen"; pattern: "(.+):(\w+)"; description: "Listen on host:port"; short: "p"; argdesc: ""; list: "listen"; # no override, this just adds to the list (and thus can be specified several times) @@ -110,7 +110,7 @@ cl_groups: ( { path: "port"; value: "$2" } ); }, - { name: "ssh"; pattern: "(\w+):(\w+)"; description: "Set up ssh target"; + { name: "ssh"; pattern: "(.+):(\w+)"; description: "Set up ssh target"; list: "protocols"; # List name that we're defining with this command line option override: "name"; # Field in the group to override. If not found in list, add an item # (it's mandatory to have that field as one of the targets @@ -124,7 +124,7 @@ cl_groups: ( { path: "tfo_ok"; value: 1 } ); }, - { name: "tls"; pattern: "(\w+):(\w+)"; description: "Set up TLS/SSL target"; + { name: "tls"; pattern: "(.+):(\w+)"; description: "Set up TLS/SSL target"; list: "protocols"; override: "name"; argdesc: ""; @@ -135,7 +135,7 @@ cl_groups: ( { path: "tfo_ok"; value: 1 } ); }, - { name: "openvpn"; pattern: "(\w+):(\w+)"; description: "Set up OpenVPN target"; + { name: "openvpn"; pattern: "(.+):(\w+)"; description: "Set up OpenVPN target"; list: "protocols"; override: "name"; argdesc: ""; @@ -146,7 +146,7 @@ cl_groups: ( { path: "tfo_ok"; value: 1 } ); }, - { name: "tinc"; pattern: "(\w+):(\w+)"; description: "Set up tinc target"; + { name: "tinc"; pattern: "(.+):(\w+)"; description: "Set up tinc target"; list: "protocols"; override: "name"; argdesc: ""; @@ -157,7 +157,7 @@ cl_groups: ( { path: "tfo_ok"; value: 1 } ); }, - { name: "xmpp"; pattern: "(\w+):(\w+)"; description: "Set up XMPP target"; + { name: "xmpp"; pattern: "(.+):(\w+)"; description: "Set up XMPP target"; list: "protocols"; override: "name"; argdesc: ""; @@ -167,7 +167,7 @@ cl_groups: ( { path: "port"; value: "$2" } ); }, - { name: "http"; pattern: "(\w+):(\w+)"; description: "Set up HTTP (plain) target"; + { name: "http"; pattern: "(.+):(\w+)"; description: "Set up HTTP (plain) target"; list: "protocols"; override: "name"; argdesc: ""; @@ -177,7 +177,7 @@ cl_groups: ( { path: "port"; value: "$2" } ); }, - { name: "adb"; pattern: "(\w+):(\w+)"; description: "Set up ADB (Android Debug) target"; + { name: "adb"; pattern: "(.+):(\w+)"; description: "Set up ADB (Android Debug) target"; list: "protocols"; override: "name"; argdesc: ""; @@ -187,7 +187,7 @@ cl_groups: ( { path: "port"; value: "$2" } ); }, - { name: "socks5"; pattern: "(\w+):(\w+)"; description: "Set up socks5 target"; + { name: "socks5"; pattern: "(.+):(\w+)"; description: "Set up socks5 target"; list: "protocols"; override: "name"; argdesc: "";