This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathREADME
104 lines (77 loc) · 4.24 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
DESCRIPTION
testcookie-recaptcha-processor is a simple web server proxying recaptcha responses to Google.
Server should be used with testcookie-nginx-module for setting cookies after solving recaptchas.
NOTE
This project is Proof-of-Contept for those people, who ask me to add "Captcha functionality" to testcookie-nginx-module.
Check the "doc" directory for the list of things you can do yourself.
INSTALLATION
Grab and install libraries:
*) pip install -r requirements.txt
Build nginx with testcookie-nginx-module, use example configuration.
Set REcaptcha public key in nginx config and REcaptcha private key in settings.py config.
Run testcookie-recaptcha-processor, run nginx.
EXAMPLE CONFIGURATION
server {
listen 80;
server_name domain.com;
testcookie off;
testcookie_name BPC;
testcookie_secret keepmescret;
testcookie_session $remote_addr;
testcookie_arg attempt;
testcookie_max_attempts 3;
testcookie_fallback /cookies.html?backurl=http://$host$request_uri;
testcookie_get_only on;
testcookie_redirect_via_refresh on;
testcookie_refresh_template "<html><body><script type=\"text/javascript\">var olC=function(){grecaptcha.render('captcha',{'sitekey':'recaptcha_public_key','callback':setcookie});};var setcookie=function(resp){document.getElementById('cpt').submit();};</script><script src=\"https://www.google.com/recaptcha/api.js?onload=olC&render=explicit\" async defer></script><form method=post action=\"/captcha\" id=\"cpt\"><div id=\"captcha\"></div></form></body></html>";
location = /cookies.html {
root /var/www/public_html;
}
location = /captcha {
testcookie var;
proxy_set_header Testcookie-Domain "domain.com";
proxy_set_header Testcookie-Value $testcookie_set;
proxy_set_header Testcookie-Nexturl $testcookie_nexturl;
proxy_set_header Testcookie-Name "BPC";
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:10101/;
}
location / {
testcookie on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8080;
}
}
SOURCES
Available on github at kyprizel/testcookie-recaptcha-processor
(<http://github.com/kyprizel/testcookie-recaptcha-processor>).
BUGS
Feel free to report bugs and send patches to kyprizel@gmail.com
or use github's issue tracker(<http://github.com/kyprizel/testcookie-recaptcha-processor/issues>).
COPYRIGHT & LICENSE
Copyright (C) 2012 Eldar Zaitov (kyprizel@gmail.com).
All rights reserved.
This module is licenced under the terms of BSD license.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the authors nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.