# . limit_req_zone $binary_remote_addr zone=one:10m rate=5r/m; server { # ... root /var/wl-web; recursive_error_pages on; # error_page @limit -> @wlgui; location / { #... } # . location @wlgui { # fpm, . internal; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/wlgui.php; fastcgi_intercept_errors on; include fastcgi_params; } # . "" location ~* /(i|i2)\.html$ { # "" 503 (c 1.3.15 ) #limit_req_status 516; error_page 503 = @limit; # . @limit limit_req zone=one nodelay; # , . # . URI, . proxy_pass http://127.0.0.1:8080$request_uri; proxy_set_header Host $host; # } # location @limit { internal; # , . if ($cookie_wlsid ~* [^af\d]) { return 503; } # , =( #error_page 516 @backend; #try_files /wl/$cookie_wlsid.cookie /wl/$remote_addr.ip /wl/$remote_addr-$host.iph @wlgui; #if ($uri ~* /wl/[az\d]+\.cookie ) {return 516;} # .. "". # (. ), . If is Evil, i know.... error_page 516 = @wlgui; if ( !-f $document_root/wl/$cookie_wlsid.cookie) {return 516;} # ! . proxy_pass http://127.0.0.1:8080$request_uri; proxy_set_header Host $host; # } }
<?php if (!empty($_POST['wlsec'])){ # , . $cookie=md5(uniqid()); setcookie('wlsid',$cookie,time()+3600*24*90/*90d*/); touch ('/var/wl-web/wl/'.$cookie.'.cookie'); echo "Done! Please, refresh the page! (setting {$cookie})"; } else { ?> <form method="POST"> <input name="wlsec" value="GetAccess" type="submit"> </form> <?php echo "<br> Your cookie:".(isset($_COOKIE['wlsid'])?htmlspecialchars($_COOKIE['wlsid']):'(not set)'); }
Source: https://habr.com/ru/post/190112/
All Articles