Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGINX empty response with pam-mysql #52

Closed
YakobovLior opened this issue Jan 13, 2019 · 4 comments
Closed

NGINX empty response with pam-mysql #52

YakobovLior opened this issue Jan 13, 2019 · 4 comments

Comments

@YakobovLior
Copy link

Hey,
I've recently compiled the module with the instructions.
It seems to work because the authentication prompt is working and indeed if I insert an undefined user it won't work, but when I do insert a valid user it fails instead of giving me the regular NGINX welcome page.
image

Any ideas what can cause this behavior?
Thanks,
Lior

@YakobovLior
Copy link
Author

I have done some more debugging and found that this is the issue (runnnig NGINX with debug, reading the generated core dump):

`root@b941b4d7f11d:/var/log/nginx# gdb /usr/sbin/nginx core.8446
GNU gdb (Ubuntu 8.2-0ubuntu2) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/nginx...(no debugging symbols found)...done.
[New LWP 8446]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by nginx: worker pr'. Program terminated with signal SIGSEGV, Segmentation fault. **#0 __GI___pthread_mutex_lock (mutex=0x20) at ../nptl/pthread_mutex_lock.c:65 65 ../nptl/pthread_mutex_lock.c: No such file or directory.** (gdb) backtrace full #0 __GI___pthread_mutex_lock (mutex=0x20) at ../nptl/pthread_mutex_lock.c:65 type = <optimized out> __PRETTY_FUNCTION__ = "__pthread_mutex_lock" id = <optimized out> #1 0x00007fd1f49403da in ?? () from /lib/x86_64-linux-gnu/libmysqlclient.so.20 No symbol table info available. #2 0x00007fd1f491a943 in ?? () from /lib/x86_64-linux-gnu/libmysqlclient.so.20 No symbol table info available. #3 0x00007fd1f48f2812 in mysql_real_connect () from /lib/x86_64-linux-gnu/libmysqlclient.so.20 No symbol table info available. #4 0x00007fd1f4cd1839 in pam_mysql_open_db (ctx=0x7fd1fd46e880) at pam_mysql.c:3353 err = PAM_MYSQL_ERR_SUCCESS host = 0x7fd1fd396250 "172.17.0.3" socket = 0x0 port = 0 err = <optimized out> host = <optimized out> socket = <optimized out> port = <optimized out> p = <optimized out> len = <optimized out> #5 pam_mysql_open_db (ctx=0x7fd1fd46e880) at pam_mysql.c:3294 err = <optimized out> p = <optimized out> len = <optimized out> #6 0x00007fd1f4cd6282 in pam_sm_acct_mgmt (pamh=0x7fd1fd434fe0, flags=<optimized out>, argc=<optimized out>, argv=0x7fd1fd53e250) at pam_mysql.c:5020 retval = 0 err = <optimized out> stat = 0 user = 0x7fd1fd4edb10 "liorya" rhost = 0x0 ctx = 0x7fd1fd46e880 #7 0x00007fd1fb2ccd79 in ?? () from /lib/x86_64-linux-gnu/libpam.so.0 No symbol table info available. #8 0x00007fd1fb2cc560 in pam_acct_mgmt () from /lib/x86_64-linux-gnu/libpam.so.0 No symbol table info available. #9 0x00007fd1fbd3680f in ?? () from /usr/share/nginx/modules/ngx_http_auth_pam_module.so No symbol table info available. #10 0x00007fd1fbdcab14 in ngx_http_core_access_phase () No symbol table info available. #11 0x00007fd1fbdc644d in ngx_http_core_run_phases () No symbol table info available. #12 0x00007fd1fbdd25c0 in ?? () No symbol table info available. #13 0x00007fd1fbdd2a36 in ?? () No symbol table info available. #14 0x00007fd1fbdb8568 in ?? () No symbol table info available. #15 0x00007fd1fbdace8a in ngx_process_events_and_timers () No symbol table info available. #16 0x00007fd1fbdb6395 in ?? () No symbol table info available. --Type <RET> for more, q to quit, c to continue without paging-- #17 0x00007fd1fbdb484d in ngx_spawn_process () No symbol table info available. #18 0x00007fd1fbdb7952 in ngx_master_process_cycle () No symbol table info available. #19 0x00007fd1fbd8a329 in main () No symbol table info available.
Note - NGINX running on ubuntu:19.04 container
Any ideas please?
Thanks,
Lior

@NigelCunningham
Copy link
Owner

Sorry for the delay in responding. It looks like it is failing to connect to the database, and I see "port = 0" in the log. Any chance that's the issue (port is usually 3306).

@YakobovLior
Copy link
Author

Hey Nigel,
I've managed to solve the issue on my own but I'll note in case it will help anyone else.
My issue was that the NGINX and MySQL were on diffrenet containers, therefore I had to make sure I create appropriate connections in the MySQL server (rather than having the default 'root@localhost').
Once I've created a new user with permissions for the relevant database and allowed connection from any host ('%') the issue was resolved.
Thanks,
Lior

@NigelCunningham
Copy link
Owner

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants