mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-13 07:37:15 +03:00
relax address matching rule so it matches more than just 'localhost'
This commit is contained in:
parent
b529069029
commit
e528f519bc
38
sslh-conf.c
38
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 <string.h>
|
||||
@ -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);
|
||||
|
@ -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
|
||||
|
18
sslhconf.cfg
18
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: "<host:port>";
|
||||
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: "<host:port>";
|
||||
@ -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: "<host:port>";
|
||||
@ -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: "<host:port>";
|
||||
@ -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: "<host:port>";
|
||||
@ -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: "<host:port>";
|
||||
@ -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: "<host:port>";
|
||||
@ -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: "<host:port>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user