{ server { listen 80 default_server; server_name _; # This is just an invalid value which will never trigger on a real hostname. access_log logs/default.access.log main; server_name_in_redirect off; root /var/www/default/htdocs; test_module_cmd on; // 一个新模块test_module,需要使用共享内存 } }
/* the default server configuration for this address:port */ ngx_http_core_srv_conf_t *default_server; ngx_array_t servers; /* array of ngx_http_core_srv_conf_t */ } ngx_http_conf_addr_t;
随机选取两个质数p1、p2,n=p1xp2,再随机选取一个整数e,e与φ(n)互质, e通常为65537, 再次计算一个d, 它是e对于φ(n)的模反元素,也就是e x d ≡ 1 (mod φ(n)) 加密过程:(m^e) mod n=c,其中m为原信息(注意m < n),c为加密信息,n、e为公开密钥。 解密过程:(c^d) mod n=m,其中d为解密密钥。
(gdb) bt
#0 ngx_inet_resolve_host (pool=0x6c0130, u=u@entry=0x7fffffffd9d0) at src/core/ngx_inet.c:1097
#1 0x000000000044aacf in ngx_http_upstream_init_round_robin (cf=0x7fffffffe0a0, us=0x6dcbc0)
at src/http/ngx_http_upstream_round_robin.c:189
#2 0x0000000000444494 in ngx_http_upstream_init_main_conf (cf=0x7fffffffe0a0, conf=0x6c2bf0) at src/http/ngx_http_upstream.c:6103
#3 0x000000000042e99f in ngx_http_block (cf=0x7fffffffe0a0, cmd=, conf=) at src/http/ngx_http.c:262
#4 0x000000000041c914 in ngx_conf_handler (last=1, cf=0x7fffffffe0a0) at src/core/ngx_conf_file.c:427
#5 ngx_conf_parse (cf=cf@entry=0x7fffffffe0a0, filename=filename@entry=0x6c0348) at src/core/ngx_conf_file.c:283
#6 0x000000000041a38a in ngx_init_cycle (old_cycle=old_cycle@entry=0x7fffffffe150) at src/core/ngx_cycle.c:274
#7 0x000000000040bcce in main (argc=, argv=) at src/core/nginx.c:276
ngx_inet_resolve_host就是我们要找的地方了。如果ngx_http_upstream_srv_conf_t里挂了server列表(例如upstream server_group),则走一个分支,如果是没有挂server列表的 则有可能是域名回源,然后对其进行域名解析,如果这种情况还是解析不了的,说明是瞎编的一个名字,既不是域名也不是upstream名字,则在启动的时候会报错,说host not found之类的。 总结一下:先看这个名字是不是upstream的名字,如果不是则尝试当成一个域名解析,成功则以,不成功则报错。
gdb) bt
#0 ngx_inet_resolve_host (pool=pool@entry=0x6c0130, u=u@entry=0x7fffffffd550) at src/core/ngx_inet.c:1120
#1 0x0000000000413572 in ngx_parse_inet_url (u=0x7fffffffd550, pool=0x6c0130) at src/core/ngx_inet.c:787
#2 ngx_parse_url (pool=0x6c0130, u=u@entry=0x7fffffffd550) at src/core/ngx_inet.c:545
#3 0x0000000000444302 in ngx_http_upstream_server (cf=0x7fffffffe0a0, cmd=, conf=0x6d26b0)
at src/http/ngx_http_upstream.c:5631
#4 0x000000000041c914 in ngx_conf_handler (last=0, cf=0x7fffffffe0a0) at src/core/ngx_conf_file.c:427
其中上面任何几个可以混杂,比如我们知道了一个可疑的URL(攻击者频繁访问的URL),我们可以根据2和3混合起来,比如访问”/“的速度大于10qps的才封禁。也可能是user-agent为Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 ,访问/的条件。
hs_reset_stream(): resets a stream to its initial state; this is equivalent to calling hs_close_stream() but will not free the memory used for stream state.
hs_copy_stream(): constructs a (newly allocated) duplicate of a stream.
hs_reset_and_copy_stream(): constructs a duplicate of a stream into another, resetting the destination stream first. This call avoids the allocation done by hs_copy_stream().
hs_set_database_allocator(), which sets the allocate and free functions used for compiled pattern databases.
hs_set_scratch_allocator(), which sets the allocate and free functions used for scratch space.
hs_set_stream_allocator(), which sets the allocate and free functions used for stream state in streaming mode.
hs_set_misc_allocator(), which sets the allocate and free functions used for miscellaneous data, such as compile error structures and informational strings.
hs_serialize_database(): serializes a pattern database into a flat relocatable buffer of bytes.
hs_deserialize_database(): reconstructs a newly allocated pattern database from the output of hs_serialize_database().
hs_deserialize_database_at(): reconstructs a pattern database at a given memory location from the output of hs_serialize_database().
hs_serialized_database_size(): given a serialized pattern database, returns the size of the memory block required by the database when deserialized.
hs_serialized_database_info(): given a serialized pattern database, returns a string containing information about the database. This call is analogous to hs_database_info().
if (FAT_RUNTIME) if (NOT HAVE_SSSE3) message(FATAL_ERROR "SSSE3 support required to build fat runtime") endif () if (NOT HAVE_AVX2) message(FATAL_ERROR "AVX2 support required to build fat runtime") endif () if (BUILD_AVX512 AND NOT HAVE_AVX512) message(FATAL_ERROR "AVX512 support requested but not supported") endif () else (NOT FAT_RUNTIME) if (NOT HAVE_AVX2) message(STATUS "Building without AVX2 support") endif () if (NOT HAVE_AVX512) message(STATUS "Building without AVX512 support") endif () #else (NOT FAT_RUNTIME) # if (NOT HAVE_SSSE3) # message(FATAL_ERROR "A minimum of SSSE3 compiler support is required") # endif () endif ()