ModSecurity icon indicating copy to clipboard operation
ModSecurity copied to clipboard

Not building with nginx >= 1.11.9

Open ashumal opened this issue 9 years ago • 6 comments

gcc -o objs/nginx
objs/src/core/nginx.o
objs/src/core/ngx_log.o
objs/src/core/ngx_palloc.o
objs/src/core/ngx_array.o
objs/src/core/ngx_list.o
objs/src/core/ngx_hash.o
objs/src/core/ngx_buf.o
objs/src/core/ngx_queue.o
objs/src/core/ngx_output_chain.o
objs/src/core/ngx_string.o
objs/src/core/ngx_parse.o
objs/src/core/ngx_parse_time.o
objs/src/core/ngx_inet.o
objs/src/core/ngx_file.o
objs/src/core/ngx_crc32.o
objs/src/core/ngx_murmurhash.o
objs/src/core/ngx_md5.o
objs/src/core/ngx_sha1.o
objs/src/core/ngx_rbtree.o
objs/src/core/ngx_radix_tree.o
objs/src/core/ngx_slab.o
objs/src/core/ngx_times.o
objs/src/core/ngx_shmtx.o
objs/src/core/ngx_connection.o
objs/src/core/ngx_cycle.o
objs/src/core/ngx_spinlock.o
objs/src/core/ngx_rwlock.o
objs/src/core/ngx_cpuinfo.o
objs/src/core/ngx_conf_file.o
objs/src/core/ngx_module.o
objs/src/core/ngx_resolver.o
objs/src/core/ngx_open_file_cache.o
objs/src/core/ngx_crypt.o
objs/src/core/ngx_proxy_protocol.o
objs/src/core/ngx_syslog.o
objs/src/event/ngx_event.o
objs/src/event/ngx_event_timer.o
objs/src/event/ngx_event_posted.o
objs/src/event/ngx_event_accept.o
objs/src/event/ngx_event_connect.o
objs/src/event/ngx_event_pipe.o
objs/src/os/unix/ngx_time.o
objs/src/os/unix/ngx_errno.o
objs/src/os/unix/ngx_alloc.o
objs/src/os/unix/ngx_files.o
objs/src/os/unix/ngx_socket.o
objs/src/os/unix/ngx_recv.o
objs/src/os/unix/ngx_readv_chain.o
objs/src/os/unix/ngx_udp_recv.o
objs/src/os/unix/ngx_send.o
objs/src/os/unix/ngx_writev_chain.o
objs/src/os/unix/ngx_udp_send.o
objs/src/os/unix/ngx_udp_sendmsg_chain.o
objs/src/os/unix/ngx_channel.o
objs/src/os/unix/ngx_shmem.o
objs/src/os/unix/ngx_process.o
objs/src/os/unix/ngx_daemon.o
objs/src/os/unix/ngx_setaffinity.o
objs/src/os/unix/ngx_setproctitle.o
objs/src/os/unix/ngx_posix_init.o
objs/src/os/unix/ngx_user.o
objs/src/os/unix/ngx_dlopen.o
objs/src/os/unix/ngx_process_cycle.o
objs/src/os/unix/ngx_linux_init.o
objs/src/event/modules/ngx_epoll_module.o
objs/src/os/unix/ngx_linux_sendfile_chain.o
objs/src/os/unix/ngx_linux_aio_read.o
objs/src/core/ngx_thread_pool.o
objs/src/os/unix/ngx_thread_cond.o
objs/src/os/unix/ngx_thread_mutex.o
objs/src/os/unix/ngx_thread_id.o
objs/src/event/ngx_event_openssl.o
objs/src/event/ngx_event_openssl_stapling.o
objs/src/core/ngx_regex.o
objs/src/http/ngx_http.o
objs/src/http/ngx_http_core_module.o
objs/src/http/ngx_http_special_response.o
objs/src/http/ngx_http_request.o
objs/src/http/ngx_http_parse.o
objs/src/http/modules/ngx_http_log_module.o
objs/src/http/ngx_http_request_body.o
objs/src/http/ngx_http_variables.o
objs/src/http/ngx_http_script.o
objs/src/http/ngx_http_upstream.o
objs/src/http/ngx_http_upstream_round_robin.o
objs/src/http/ngx_http_file_cache.o
objs/src/http/ngx_http_write_filter_module.o
objs/src/http/ngx_http_header_filter_module.o
objs/src/http/modules/ngx_http_chunked_filter_module.o
objs/src/http/v2/ngx_http_v2_filter_module.o
objs/src/http/modules/ngx_http_range_filter_module.o
objs/src/http/modules/ngx_http_gzip_filter_module.o
objs/src/http/ngx_http_postpone_filter_module.o
objs/src/http/modules/ngx_http_ssi_filter_module.o
objs/src/http/modules/ngx_http_charset_filter_module.o
objs/src/http/modules/ngx_http_sub_filter_module.o
objs/src/http/modules/ngx_http_addition_filter_module.o
objs/src/http/modules/ngx_http_gunzip_filter_module.o
objs/src/http/modules/ngx_http_userid_filter_module.o
objs/src/http/modules/ngx_http_headers_filter_module.o
objs/src/http/ngx_http_copy_filter_module.o
objs/src/http/modules/ngx_http_not_modified_filter_module.o
objs/src/http/modules/ngx_http_slice_filter_module.o
objs/src/http/v2/ngx_http_v2.o
objs/src/http/v2/ngx_http_v2_table.o
objs/src/http/v2/ngx_http_v2_huff_decode.o
objs/src/http/v2/ngx_http_v2_huff_encode.o
objs/src/http/v2/ngx_http_v2_module.o
objs/src/http/modules/ngx_http_static_module.o
objs/src/http/modules/ngx_http_gzip_static_module.o
objs/src/http/modules/ngx_http_dav_module.o
objs/src/http/modules/ngx_http_autoindex_module.o
objs/src/http/modules/ngx_http_index_module.o
objs/src/http/modules/ngx_http_random_index_module.o
objs/src/http/modules/ngx_http_auth_request_module.o
objs/src/http/modules/ngx_http_auth_basic_module.o
objs/src/http/modules/ngx_http_access_module.o
objs/src/http/modules/ngx_http_limit_conn_module.o
objs/src/http/modules/ngx_http_limit_req_module.o
objs/src/http/modules/ngx_http_realip_module.o
objs/src/http/modules/ngx_http_geo_module.o
objs/src/http/modules/ngx_http_map_module.o
objs/src/http/modules/ngx_http_split_clients_module.o
objs/src/http/modules/ngx_http_referer_module.o
objs/src/http/modules/ngx_http_rewrite_module.o
objs/src/http/modules/ngx_http_ssl_module.o
objs/src/http/modules/ngx_http_proxy_module.o
objs/src/http/modules/ngx_http_fastcgi_module.o
objs/src/http/modules/ngx_http_uwsgi_module.o
objs/src/http/modules/ngx_http_scgi_module.o
objs/src/http/modules/ngx_http_memcached_module.o
objs/src/http/modules/ngx_http_empty_gif_module.o
objs/src/http/modules/ngx_http_browser_module.o
objs/src/http/modules/ngx_http_secure_link_module.o
objs/src/http/modules/ngx_http_flv_module.o
objs/src/http/modules/ngx_http_mp4_module.o
objs/src/http/modules/ngx_http_upstream_hash_module.o
objs/src/http/modules/ngx_http_upstream_ip_hash_module.o
objs/src/http/modules/ngx_http_upstream_least_conn_module.o
objs/src/http/modules/ngx_http_upstream_keepalive_module.o
objs/src/http/modules/ngx_http_upstream_zone_module.o
objs/src/http/modules/ngx_http_stub_status_module.o
objs/src/mail/ngx_mail.o
objs/src/mail/ngx_mail_core_module.o
objs/src/mail/ngx_mail_handler.o
objs/src/mail/ngx_mail_parse.o
objs/src/mail/ngx_mail_ssl_module.o
objs/src/mail/ngx_mail_pop3_module.o
objs/src/mail/ngx_mail_pop3_handler.o
objs/src/mail/ngx_mail_imap_module.o
objs/src/mail/ngx_mail_imap_handler.o
objs/src/mail/ngx_mail_smtp_module.o
objs/src/mail/ngx_mail_smtp_handler.o
objs/src/mail/ngx_mail_auth_http_module.o
objs/src/mail/ngx_mail_proxy_module.o
objs/src/stream/ngx_stream.o
objs/src/stream/ngx_stream_variables.o
objs/src/stream/ngx_stream_script.o
objs/src/stream/ngx_stream_handler.o
objs/src/stream/ngx_stream_core_module.o
objs/src/stream/ngx_stream_log_module.o
objs/src/stream/ngx_stream_proxy_module.o
objs/src/stream/ngx_stream_upstream.o
objs/src/stream/ngx_stream_upstream_round_robin.o
objs/src/stream/ngx_stream_write_filter_module.o
objs/src/stream/ngx_stream_ssl_module.o
objs/src/stream/ngx_stream_realip_module.o
objs/src/stream/ngx_stream_limit_conn_module.o
objs/src/stream/ngx_stream_access_module.o
objs/src/stream/ngx_stream_geo_module.o
objs/src/stream/ngx_stream_map_module.o
objs/src/stream/ngx_stream_split_clients_module.o
objs/src/stream/ngx_stream_return_module.o
objs/src/stream/ngx_stream_upstream_hash_module.o
objs/src/stream/ngx_stream_upstream_least_conn_module.o
objs/src/stream/ngx_stream_upstream_zone_module.o
objs/src/stream/ngx_stream_ssl_preread_module.o
objs/addon/modsecurity/ngx_http_modsecurity.o
objs/addon/modsecurity/apr_bucket_nginx.o
objs/addon/modsecurity/ngx_pool_context.o
objs/ngx_modules.o
-Wl,-z,relro -Wl,-z,now -pie /root/rpmbuild/SOURCES/modsecurity-master/nginx/modsecurity/../../standalone/.libs/standalone.a -ldl -lpthread -lpthread -lcrypt -lapr-1 -L/usr/lib64 -laprutil-1 -I/usr/include/httpd -lcurl -lxml2 -lz -lm -ldl -llua -lm -ldl -lpcre -L/usr/lib64 -lyajl -L/usr//lib -lfuzzy -lpcre -lssl -lcrypto -ldl -lz
-Wl,-E /bin/ld: /root/rpmbuild/SOURCES/modsecurity-master/nginx/modsecurity/../../standalone/.libs/standalone.a(standalone_la-api.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /root/rpmbuild/SOURCES/modsecurity-master/nginx/modsecurity/../../standalone/.libs/standalone.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[1]: *** [objs/nginx] Error 1 make[1]: Leaving directory /root/rpmbuild/BUILD/nginx-1.11.12' make: *** [build] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.oNh3Se (%build)

ashumal avatar Apr 04 '17 01:04 ashumal

Last successful build was compleated with nginx 1.11.8 on CentOS 7 (all updates installed), I tried to use master branch https://github.com/SpiderLabs/ModSecurity/commits/master and nginx_refactoring branch https://github.com/SpiderLabs/ModSecurity/tree/nginx_refactoring, both successfull: nginx version: nginx/1.11.8 built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --add-module=/root/rpmbuild/SOURCES/modsecurity-master/nginx/modsecurity --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

I have tried to build nginx 1.11.9-1.11.12 with master and nginx refactoring branches and got the same error listed above. Please, advise , how to fix it? Thank you.

ashumal avatar Apr 04 '17 01:04 ashumal

I have added "-fPIC" option to ModSecurity 2.9 compile options: cd /root/rpmbuild/SOURCES git clone -b master https://github.com/SpiderLabs/ModSecurity.git cd ModSecurity ./autogen.sh ./configure CFLAGS="-fPIC" --enable-standalone-module --disable-mlogc make

After that I have provided ModSecurity folder as a module source for nginx as before: cd /root/rpmbuild/BUILD/nginx-1.11.12 ./configure --add-module=/root/rpmbuild/SOURCES/ModSecurity ...

And build starts working, nginx 1.11.9 and above are compiling fine. I do not understand the reason why I need "-fPIC" option because I'm not using ModSecurity shared libraries, I just tried to compile standalone module. It is strange also nginx 1.11.8 builded, even in case of ModSecurity was compiled without "-fPIC". But anyway this workaround works.

ashumal avatar Apr 05 '17 03:04 ashumal

Hi @ashumal,

Please use the ModSecurity-nginx connector instead of ModSecurity v2.x.

You can find further information here: www.github.com/SpiderLabs/ModSecurity-nginx

zimmerle avatar Apr 06 '17 13:04 zimmerle

Hello i don't understand how i should use ModSecurity-nginx, i think i need integrate to repository from https://github.com/SpiderLabs/ModSecurity, how to do this ?

JarRoDk avatar May 12 '17 11:05 JarRoDk

@zimmerle Like @JarRoDk , I am too confused how to use ModSecurity-nginx connector. Can you pls help us out?

vikas027 avatar May 12 '17 14:05 vikas027

Hi @vikas027 and @JarRoDk,

ModSecurity for nginx depends on libModSecurity. libModSecurity resides here: https://github.com/SpiderLabs/ModSecurity/tree/v3/master

The ModSecurity for nginx is available here: https://github.com/SpiderLabs/ModSecurity-nginx

There are a few compilation recipes here: https://github.com/SpiderLabs/ModSecurity/wiki/Compilation-recipes

zimmerle avatar May 15 '17 13:05 zimmerle