Skip to content

worker process 107 exited on signal 11 (core dumped) set_real_ip_from with nchan_authorize_request #680

@Kolobok12309

Description

@Kolobok12309

Nginx crashed if i use set_real_ip_from (and pass header X-Real-Ip) and use nchan_authorize_request

set_real_ip_from 0.0.0.0/0;

location = /auth {
    proxy_pass ${WS_AUTH_URL};
    proxy_pass_request_body off;
    proxy_set_header Content-Length "";
    proxy_set_header X-Subscriber-Type $nchan_subscriber_type;
    proxy_set_header X-Publisher-Type $nchan_publisher_type;
    proxy_set_header X-Prev-Message-Id $nchan_prev_message_id;
    proxy_set_header X-Channel-Id $nchan_channel_id;
    proxy_set_header X-Original-URI $request_uri;
    proxy_set_header X-Forwarded-For $remote_addr;
  }

location ~ ^/user/(?<user>(\d+))$ {
  nchan_authorize_request /auth;
  nchan_subscriber;
  nchan_channel_id "users" $user;
  nchan_channel_group "users";
}

If i comment nchan_authorize_request or set_real_ip_from or not pass header, all be fine

Nginx 1.25.2-alpine
Nchan 1.3.6

Core dump

Core was generated by `nginx: worker process     '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000557b2732b464 in ngx_cidr_match ()
(gdb) backtrace
#0  0x0000557b2732b464 in ngx_cidr_match ()
#1  0x0000557b2736b27b in ?? ()
#2  0x0000557b2736e42f in ngx_http_get_forwarded_addr ()
#3  0x0000557b273b1717 in ?? ()
#4  0x0000557b2736c409 in ngx_http_core_generic_phase ()
#5  0x0000557b27368a5f in ngx_http_core_run_phases ()
#6  0x0000557b27370645 in ngx_http_run_posted_requests ()
#7  0x00007f8407c89e0f in nchan_requestmachine_run (rm=rm@entry=0x7f8407be35c0)
    at //nchan-1.3.6/src/util/nchan_fake_request.c:326
#8  0x00007f8407c8a772 in nchan_requestmachine_request (rm=0x7f8407be35c0, params=params@entry=0x7ffc1e2f3070)
    at //nchan-1.3.6/src/util/nchan_fake_request.c:489
#9  0x00007f8407c9338e in nchan_subscriber_subrequest (sub=sub@entry=0x7f8407be3800, 
    params=params@entry=0x7ffc1e2f3070) at //nchan-1.3.6/src/subscribers/common.c:315
#10 0x00007f8407c938bd in nchan_subscriber_authorize_subscribe_request (sub=0x7f8407be3800, 
    ch_id=0x7f8407c5f7b0) at //nchan-1.3.6/src/subscribers/common.c:128
#11 0x00007f8407c80484 in nchan_pubsub_handler (r=0x7f8407c5e880) at //nchan-1.3.6/src/nchan_module.c:793
#12 0x0000557b2736d388 in ngx_http_core_content_phase ()
#13 0x0000557b27368a5f in ngx_http_core_run_phases ()
#14 0x0000557b27372986 in ?? ()
#15 0x0000557b27372cd2 in ?? ()
#16 0x0000557b27349361 in ?? ()
#17 0x0000557b2734014b in ngx_process_events_and_timers ()
#18 0x0000557b273478fd in ?? ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions