1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-10-27 05:20:18 -04:00

New -np option to disable HAproxy proxy protocol

This commit is contained in:
Kim Holviala 2017-02-06 14:21:52 +02:00
parent b3667159ec
commit 78432e1a54
4 changed files with 5 additions and 1 deletions

1
README
View File

@ -42,6 +42,7 @@ Command line options:
-na Disable autogenerated caps.txt -na Disable autogenerated caps.txt
-nm Disable shared memory use (for debugging) -nm Disable shared memory use (for debugging)
-nr Disable root user checking (for debugging) -nr Disable root user checking (for debugging)
-np Disable HAproxy proxy protocol
-d Debug to syslog (not for production use) -d Debug to syslog (not for production use)
-v Display version number and build date -v Display version number and build date

View File

@ -451,6 +451,7 @@ void init_state(state *st)
st->opt_caps = TRUE; st->opt_caps = TRUE;
st->opt_shm = TRUE; st->opt_shm = TRUE;
st->opt_root = TRUE; st->opt_root = TRUE;
st->opt_proxy = TRUE;
st->debug = FALSE; st->debug = FALSE;
/* Load default suffix -> filetype mappings */ /* Load default suffix -> filetype mappings */
@ -573,7 +574,7 @@ get_selector:
/* Handle HAproxy/Stunnel proxy protocol v1 */ /* Handle HAproxy/Stunnel proxy protocol v1 */
#ifdef ENABLE_HAPROXY1 #ifdef ENABLE_HAPROXY1
if (sstrncmp(selector, "PROXY TCP") == MATCH) { if (sstrncmp(selector, "PROXY TCP") == MATCH && st.opt_proxy) {
if (st.debug) syslog(LOG_INFO, "got proxy protocol header \"%s\"", selector); if (st.debug) syslog(LOG_INFO, "got proxy protocol header \"%s\"", selector);
sscanf(selector, "PROXY TCP%d %s %s %d %d", sscanf(selector, "PROXY TCP%d %s %s %d %d",

View File

@ -349,6 +349,7 @@ typedef struct {
char opt_caps; char opt_caps;
char opt_shm; char opt_shm;
char opt_root; char opt_root;
char opt_proxy;
char debug; char debug;
} state; } state;

View File

@ -142,6 +142,7 @@ void parse_args(state *st, int argc, char *argv[])
if (*optarg == 'a') { st->opt_caps = FALSE; break; } if (*optarg == 'a') { st->opt_caps = FALSE; break; }
if (*optarg == 'm') { st->opt_shm = FALSE; break; } if (*optarg == 'm') { st->opt_shm = FALSE; break; }
if (*optarg == 'r') { st->opt_root = FALSE; break; } if (*optarg == 'r') { st->opt_root = FALSE; break; }
if (*optarg == 'p') { st->opt_proxy = FALSE; break; }
break; break;
case 'd': st->debug = TRUE; break; case 'd': st->debug = TRUE; break;