511 lines
No EOL
81 KiB
JavaScript
511 lines
No EOL
81 KiB
JavaScript
var suggestions=document.getElementById("suggestions"),userinput=document.getElementById("userinput");document.addEventListener("keydown",inputFocus);function inputFocus(e){e.keyCode===191&&(e.preventDefault(),userinput.focus()),e.keyCode===27&&(userinput.blur(),suggestions.classList.add("d-none"))}document.addEventListener("click",function(e){var t=suggestions.contains(e.target);t||suggestions.classList.add("d-none")}),document.addEventListener("keydown",suggestionFocus);function suggestionFocus(e){const s=suggestions.querySelectorAll("a"),o=[...s],t=o.indexOf(document.activeElement);let n=0;e.keyCode===38?(e.preventDefault(),n=t>0?t-1:0,s[n].focus()):e.keyCode===40&&(e.preventDefault(),n=t+1<o.length?t+1:t,s[n].focus())}(function(){var e=new FlexSearch({preset:"score",cache:!0,doc:{id:"id",field:["title","description","content"],store:["href","title","description"]}}),n=[{id:0,href:"/docs/introduction/installing-captcha/",title:"Installing mCaptcha on your website",description:"Interested in deploying mCpatcha? From deploying a self-hosted instance to installing the CAPTCHA on your website, this guide will have you covered!",content:`\u003cp\u003emCaptcha can protect your website from DDoS attacks. In this guide we\u0026rsquo;ll
|
|
explore how to install mCaptcha on your website. The end result will be
|
|
something like this, on your website:\u003c/p\u003e
|
|
\u003cfigure\u003e
|
|
\u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_20x0_resize_box_3.png" data-srcset="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_3.png 800w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_3.png 700w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_3.png 600w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_500x0_resize_box_3.png 500w" width="618" height="669" alt="A registration form with mCaptcha widget installed"\u003e
|
|
\u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_3.png 800w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_3.png 700w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_3.png 600w,/docs/introduction/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_500x0_resize_box_3.png 500w" src="/docs/introduction/installing-captcha/mcaptcha-widget-installation-result.png" width="618" height="669" alt="A registration form with mCaptcha widget installed"\u003e\u003c/noscript\u003e
|
|
\u003c/figure\u003e
|
|
\u003cp\u003eFor the purpose of this demo, we will be using
|
|
\u003ca href="https://demo.mcaptcha.org"\u003edemo.mcaptcha.org\u003c/a\u003e, a demo instance running
|
|
in @realaravinth\u0026rsquo;s bedroom(for this same reason, it shouldn\u0026rsquo;t be used
|
|
for anything serious)\u003c/p\u003e
|
|
\u003ch2 id="1-create-an-account-and-sign-into-the-mcaptcha-dashboard"\u003e1. Create an account and sign into the mCaptcha dashboard\u003c/h2\u003e
|
|
\u003cp\u003eHead over to \u003ca href="https://demo.mcaptcha.org/join"\u003edemo.mcaptcha.org\u003c/a\u003e and
|
|
create an account. When ready, sign in.\u003c/p\u003e
|
|
\u003ch2 id="2-create-new-site-key"\u003e2. Create new site key\u003c/h2\u003e
|
|
\u003cp\u003eA \u003ca href="/docs/terminology/sitekey/"\u003esite key\u003c/a\u003e is how a new CAPTCHA is configured within mCaptcha. To create
|
|
a new site key, click on \u0026ldquo;New Site\u0026rdquo; button in the dashboard.\u003c/p\u003e
|
|
\u003cfigure\u003e
|
|
\u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_20x0_resize_box_3.png" data-srcset="/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_3.png 900w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_3.png 800w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_3.png 700w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_3.png 600w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_3.png 500w" width="1825" height="857" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; button highlighted"\u003e
|
|
\u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_3.png 900w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_3.png 800w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_3.png 700w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_3.png 600w,/docs/introduction/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_3.png 500w" src="/docs/introduction/installing-captcha/new-sitekey-btn.png" width="1825" height="857" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; button highlighted"\u003e\u003c/noscript\u003e
|
|
\u003c/figure\u003e
|
|
\u003cp\u003eThere are two options to create a new site key, easy and advanced. \u003cstrong\u003eWe
|
|
are going to use the easy mode in this tutorial.\u003c/strong\u003e If you are interested
|
|
in learning more about the advance mode, please see \u003ca href="/docs/introduction/configuring-difficulty-factor/#advance-option"\u003ehere\u003c/a\u003e.\u003c/p\u003e
|
|
\u003cblockquote\u003e
|
|
\u003ch3 id="easy-modedocsintroductionconfiguring-difficulty-factoreasy-option"\u003e\u003ca href="/docs/introduction/configuring-difficulty-factor/#easy-option"\u003eEasy Mode\u003c/a\u003e\u003c/h3\u003e
|
|
\u003cp\u003eEasy mode asks a few basic statistics about your website and generates a
|
|
configuration that should work for your website. Currently, easy mode is
|
|
guided by assumptions on suitable difficulty factors to protect a
|
|
website but it will be fine-tuned as mCaptcha sees more deployment.\u003c/p\u003e
|
|
\u003cp\u003eConfiguration generated by easy mode can be tweaked later using the
|
|
advance mode, as you become more familiar with how mCaptcha works.\u003c/p\u003e
|
|
\u003c/blockquote\u003e
|
|
\u003cp\u003eFill the form and submit it.\u003c/p\u003e
|
|
\u003cfigure\u003e
|
|
\u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_20x0_resize_box_3.png" data-srcset="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_3.png 900w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_3.png 800w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_3.png 700w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_3.png 600w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_3.png 500w" width="720" height="452" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; form in easy mode, with details filled in"\u003e
|
|
\u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_3.png 900w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_3.png 800w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_3.png 700w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_3.png 600w,/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_3.png 500w" src="/docs/introduction/installing-captcha/new-sitekey-easy-mode-filled.png" width="720" height="452" alt="mCaptcha dashboard with the \u0026#39;new site key\u0026#39; form in easy mode, with details filled in"\u003e\u003c/noscript\u003e
|
|
\u003c/figure\u003e
|
|
\u003ch2 id="3-copy-widget-link"\u003e3. Copy widget link\u003c/h2\u003e
|
|
\u003cp\u003eSubmitting the form will take you to a page where site key configuration
|
|
can be viewed. \u0026ldquo;View deployment\u0026rdquo; link will display CAPTCHA widget with
|
|
the supplied configuration. Click on it and grab the widget link.\u003c/p\u003e
|
|
\u003ch2 id="4-install-mcaptcha-on-your-website"\u003e4. Install mCaptcha on your website\u003c/h2\u003e
|
|
\u003cp\u003eIntegration support is available for some frontend JavaScript
|
|
frameworks. To see full list of supported frameworks, please see
|
|
\u003ca href="https://github.com/mCaptcha/glue#framework-support"\u003ehere\u003c/a\u003e.\u003c/p\u003e
|
|
\u003cp\u003eThere are two options to use the integration library to integrate
|
|
mCaptcha on your website:\u003c/p\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003eServe the integration library yourself\u003c/li\u003e
|
|
\u003cli\u003eUse a CDN like unpkg.com\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cp\u003eIn this tutorial, we\u0026rsquo;ll be using the CDN.\u003c/p\u003e
|
|
\u003cp\u003e\u003cstrong\u003ePasting the following snippet on the page, within the form\u003c/strong\u003e that requires to be protected
|
|
will load the mCaptcha widget with the configuration supplied. Be sure
|
|
to replace \u003ccode\u003eYour {{paste your widget link}}\u003c/code\u003e with the link obtained from
|
|
the previous step.\u003c/p\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-html" data-lang="html"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 1\u003c/span\u003e\u003cspan\u003e\u0026lt;\u003cspan style="color:#ff79c6"\u003ediv\u003c/span\u003e \u003cspan style="color:#50fa7b"\u003eid\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;mcaptcha__widget-container\u0026#34;\u003c/span\u003e\u0026gt;\u0026lt;/\u003cspan style="color:#ff79c6"\u003ediv\u003c/span\u003e\u0026gt;
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 2\u003c/span\u003e\u003cspan\u003e\u0026lt;\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e \u003cspan style="color:#50fa7b"\u003esrc\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-alpha-2/dist/index.js\u0026#34;\u003c/span\u003e\u0026gt;\u0026lt;/\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e\u0026gt;
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 3\u003c/span\u003e\u003cspan\u003e\u0026lt;\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e \u003cspan style="color:#50fa7b"\u003echarset\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;utf-8\u0026#34;\u003c/span\u003e\u0026gt;
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 4\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#8be9fd;font-style:italic"\u003elet\u003c/span\u003e config \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e {
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 5\u003c/span\u003e\u003cspan\u003e widgetLink\u003cspan style="color:#ff79c6"\u003e:\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003enew\u003c/span\u003e URL(
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 6\u003c/span\u003e\u003cspan\u003e {{paste yout widget link}}
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 7\u003c/span\u003e\u003cspan\u003e ),
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 8\u003c/span\u003e\u003cspan\u003e };
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 9\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#ff79c6"\u003enew\u003c/span\u003e mcaptchaGlue.\u003cspan style="color:#ff79c6"\u003edefault\u003c/span\u003e(config);
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e10\u003c/span\u003e\u003cspan\u003e\u0026lt;/\u003cspan style="color:#ff79c6"\u003escript\u003c/span\u003e\u0026gt;
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eA full example is available
|
|
\u003ca href="https://github.com/mCaptcha/glue/blob/ea576d875457de54d82bed3edfc4ee68302fa4d8/packages/vanilla/static/embeded.html"\u003ehere\u003c/a\u003e.\u003c/p\u003e
|
|
\u003ch2 id="5-configure-backend-to-authenticate-captcha-tokens"\u003e5. Configure backend to authenticate CAPTCHA tokens\u003c/h2\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eGet \u003ca href="/docs/terminology/access-token"\u003eaccess token\u003c/a\u003e from the user\u0026rsquo;s
|
|
form submission payload. The access token will be associated with a
|
|
parameter called \u003ccode\u003emcaptcha__token\u003c/code\u003e.\u003c/p\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-python" data-lang="python"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e mcaptcha_token \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e request\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003eform[\u003cspan style="color:#f1fa8c"\u003e\u0026#34;mcaptcha__token\u0026#34;\u003c/span\u003e]
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eValidate access token with mCaptcha instance\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-python" data-lang="python"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 1\u003c/span\u003e\u003cspan\u003epayload \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e {
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 2\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;token\u0026#34;\u003c/span\u003e: mcaptcha_token,
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 3\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;key\u0026#34;\u003c/span\u003e: mcaptcha_sitekey, \u003cspan style="color:#6272a4"\u003e# captcha site key\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 4\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#6272a4"\u003e# mCaptcha account secret; available in settings\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 5\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;secret\u0026#34;\u003c/span\u003e: mcaptcha_account_secret,
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 6\u003c/span\u003e\u003cspan\u003e}
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 7\u003c/span\u003e\u003cspan\u003eresp \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e requests\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003epost(
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 8\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;https://demo.mcaptha.org/api/v1/pow/siteverify\u0026#34;\u003c/span\u003e, json\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003epayload
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 9\u003c/span\u003e\u003cspan\u003e)
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e10\u003c/span\u003e\u003cspan\u003eresp \u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e resp\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003ejson()
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="3"\u003e
|
|
\u003cli\u003eIf access token is valid, allow access to protected resource or deny
|
|
access.\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-python" data-lang="python"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#ff79c6"\u003eif\u003c/span\u003e resp[\u003cspan style="color:#f1fa8c"\u003e\u0026#34;valid\u0026#34;\u003c/span\u003e] \u003cspan style="color:#ff79c6"\u003e==\u003c/span\u003e \u003cspan style="color:#ff79c6"\u003eFalse\u003c/span\u003e:
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#ff79c6"\u003ereturn\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\u0026#34;invalid captcha\u0026#34;\u003c/span\u003e, \u003cspan style="color:#bd93f9"\u003e400\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#ff79c6"\u003eelse\u003c/span\u003e:
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan\u003e \u003cspan style="color:#ff79c6"\u003ereturn\u003c/span\u003e allow_access_to_protected_resource(request\u003cspan style="color:#ff79c6"\u003e.\u003c/span\u003eform)
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003ePlease see here for a complete \u003ca href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/server"\u003eFlask example\u003c/a\u003e and here for an \u003ca href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/rust-server/demo-server"\u003eActix
|
|
Web example\u003c/a\u003e.\u003c/p\u003e
|
|
\u003cp\u003eCongratulations, mCaptcha is now integrated with your website!\u003c/p\u003e
|
|
`},{id:1,href:"/docs/introduction/configuring-difficulty-factor/",title:"Configuring Difficulty Factor",description:"mCaptcha has options to configure its proof of work engine behavior, this page explains how to determine difficulty facotrs that work best for your website!",content:`\u003cp\u003emCaptcha is highly responsive to detecting DDoS attacks. Admins are
|
|
advised to take advantage of it by setting low \u003ca href="/docs/terminology/difficulty-factor/"\u003edifficulty
|
|
factors\u003c/a\u003e for normal traffic levels
|
|
for their website.\u003c/p\u003e
|
|
\u003cp\u003e\u003cstrong\u003eLowest advisable difficulty factor is 5000.\u003c/strong\u003e\u003c/p\u003e
|
|
\u003cp\u003eFor instance, if it is normal for my website to get 2000 requests for
|
|
every 30 seconds, I will set a \u003ca href="/docs/terminology/cooldown-period"\u003ecool
|
|
down\u003c/a\u003e period of 30 seconds and the
|
|
first level of difficulty configuration will have a \u003ca href="/docs/terminology/visitor-threshold"\u003evisitor threshold\u003c/a\u003e of 2000 with a
|
|
difficulty factor of 5000.\u003c/p\u003e
|
|
\u003cp\u003eThere are two modes to setting difficulty factor for your website on
|
|
mCaptcha:\u003c/p\u003e
|
|
\u003ch3 id="easy-option"\u003eEasy option\u003c/h3\u003e
|
|
\u003cp\u003eEasy mode asks a few basic statistics about your website and generates a
|
|
configuration that should work for your website. Currently, easy mode is
|
|
guided by assumptions on suitable difficulty factors to protect a
|
|
website but it will be fine-tuned as mCaptcha sees more deployment.\u003c/p\u003e
|
|
\u003cp\u003eConfiguration generated by easy mode can be tweaked later using the
|
|
advance mode, as you become more familiar with how mCaptcha works.\u003c/p\u003e
|
|
\u003cfigure\u003e
|
|
\u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_20x0_resize_box_3.png" data-srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_3.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_3.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_3.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_3.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_500x0_resize_box_3.png 500w" width="720" height="452" alt="new sitekey form in easy mode"\u003e
|
|
\u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_3.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_3.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_3.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_3.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_500x0_resize_box_3.png 500w" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-easy-mode.png" width="720" height="452" alt="new sitekey form in easy mode"\u003e\u003c/noscript\u003e
|
|
\u003c/figure\u003e
|
|
\u003ch3 id="advance-option"\u003eAdvance option\u003c/h3\u003e
|
|
\u003cp\u003eAdvance mode gives the admin granular control over how mCaptcha behaves
|
|
on their website. It has options to set the difficulty factor for each
|
|
level of traffic(or visitor threshold, in mCaptcha speak), fully taking
|
|
advantage of mCaptcha\u0026rsquo;s variable difficulty factor feature.\u003c/p\u003e
|
|
\u003cp\u003eFor instance, if it is normal for a website to get 200 requests over 30
|
|
seconds, then setting a very low difficulty factor for a visitor
|
|
threshold of 200 and a cool down period of 30 seconds will allow the
|
|
users to pass through without waiting on the CAPTCHA. But if 1000
|
|
requests over 30 seconds will bring down the service, then the admin can
|
|
configure increasing levels of difficulty factor of increasing traffic
|
|
levels, effectively rate limiting its users and protecting the
|
|
underlying website.\u003c/p\u003e
|
|
\u003cfigure\u003e
|
|
\u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_20x0_resize_box_3.png" data-srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_3.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_3.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_3.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_3.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_500x0_resize_box_3.png 500w" width="720" height="407" alt="new sitekey form in advance mode"\u003e
|
|
\u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_3.png 900w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_3.png 800w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_3.png 700w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_3.png 600w,/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_500x0_resize_box_3.png 500w" src="/docs/introduction/configuring-difficulty-factor/new-sitekey-adv-mode.png" width="720" height="407" alt="new sitekey form in advance mode"\u003e\u003c/noscript\u003e
|
|
\u003c/figure\u003e
|
|
`},{id:2,href:"/docs/terminology/access-token/",title:"Access token",description:"mCaptcha implements leaky bucket algorithm to measure current traffic levels. Cooldown period specifies the leak or the time after which a visitor addition is decremented.",content:`\u003cp\u003eWhen a visitor solves the CAPTCHA and sends their solution to an
|
|
mCaptcha instance, the solution will be verified for correctness. If the
|
|
solution is correct, mCaptcha will return a single use access token.\u003c/p\u003e
|
|
\u003cp\u003eThis access token should be attached to the visitor\u0026rsquo;s requited to the
|
|
protected service and the protected service should validity of the
|
|
access token with the mCaptcha instance and only allow access to
|
|
protected resource if the access token is valid.\u003c/p\u003e
|
|
\u003ch2 id="validate-access-token"\u003eValidate access token:\u003c/h2\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003ecurl --location --request POST \u003cspan style="color:#f1fa8c"\u003e\u0026#39;https://mcaptcha.example.net/api/v1/pow/siteverify\u0026#39;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e --header \u003cspan style="color:#f1fa8c"\u003e\u0026#39;Content-Type: application/json\u0026#39;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e --data-raw \u003cspan style="color:#f1fa8c"\u003e\u0026#39;{
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e \u0026#34;token\u0026#34;: \u0026#34;replace this with the access token presented by visitor\u0026#34;,
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e5\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e \u0026#34;key\u0026#34;: \u0026#34;replace this with the sitekey associated with the CAPTCHA\u0026#34;
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e6\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e \u0026#34;secret\u0026#34;: \u0026#34;replace this with mCaptcha account secret, available in settings\u0026#34;
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e7\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e }\u0026#39;\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e`},{id:3,href:"/docs/terminology/cooldown-period/",title:"Cooldown Period",description:"mCaptcha implements leaky bucket algorithm to measure current traffic levels. Cooldown period specifies the leak or the time after which a visitor addition is decremented.",content:`\u003cp\u003emCaptcha implements leaky bucket algorithm to measure
|
|
current traffic levels. Cooldown period specifies the leak or the time
|
|
after which a visitor addition is decremented.\u003c/p\u003e
|
|
\u003cp\u003eFor instance, if initial traffic level is 0 and a user visits one
|
|
second later, the traffic level will be incremented to 1. Now, if the
|
|
cooldown period is set to 30 seconds, the traffic level will be
|
|
decremented after 30 seconds. So after 30 seconds, the traffic level will
|
|
go from 1 to 0.\u003c/p\u003e
|
|
\u003ch2 id="easy-mode-default-cooldown"\u003eEasy Mode: Default cooldown\u003c/h2\u003e
|
|
\u003cp\u003eWhen configuring mCaptcha in \u003ca href="/docs/introduction/configuring-difficulty-factor/#easy-option"\u003eeasy Mode\u003c/a\u003e, the default cooldown period is set to 30 seconds.\u003c/p\u003e
|
|
`},{id:4,href:"/docs/terminology/difficulty-factor/",title:"Difficulty Factor",description:"Difficulty factor determines the time it takes to solve a CAPTCHA, there are two modes to setting difficulty factor: advance and easy, this page documents both modes.",content:`\u003cp\u003eDifficulty factor determines the time it takes to solve a CAPTCHA. The
|
|
higher the difficulty factor, the longer it will take to generate a
|
|
proof of work for it to solve the CAPTCHA.\u003c/p\u003e
|
|
\u003cp\u003emCaptcha\u0026rsquo;s proof of work based mechanism makes it highly accessible to
|
|
people with special needs but it is important to choose the difficulty factor
|
|
with care as very high difficulty factors will make the CAPTCHA
|
|
inaccessible to users on slow devices.\u003c/p\u003e
|
|
`},{id:5,href:"/docs/terminology/sitekey/",title:"Site key",description:"Site key is the unique identifier associated with a CAPTCHA created on mCaptcha",content:`\u003cp\u003eSite key is a unique identifier associated with CAPTCHA configurations
|
|
created on mCaptcha. It is required to integrate a CAPTCHA with your
|
|
website.\u003c/p\u003e
|
|
\u003ch2 id="how-to-get-site-key"\u003eHow to get site key?\u003c/h2\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003eGo to \u0026ldquo;Site keys\u0026rdquo; on the side panel in the dashboard\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv align=center\u003e
|
|
\u003cfigure\u003e
|
|
\u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_20x0_resize_box_3.png" data-srcset="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_3.png 800w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_3.png 700w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_3.png 600w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_500x0_resize_box_3.png 500w" width="222" height="496" alt="Site key menu option on the dashboard, encircled in red."\u003e
|
|
\u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_3.png 800w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_3.png 700w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_3.png 600w,/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_500x0_resize_box_3.png 500w" src="/docs/terminology/sitekey/sitekey-in-dashboard-sidepanel.png" width="222" height="496" alt="Site key menu option on the dashboard, encircled in red."\u003e\u003c/noscript\u003e
|
|
\u003c/figure\u003e
|
|
\u003c/div\u003e
|
|
\u003col start="2"\u003e
|
|
\u003cli\u003eclick on the clipboard button to copy the site key to your
|
|
clipboard.\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cfigure\u003e
|
|
\u003cimg class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_20x0_resize_box_3.png" data-srcset="/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_3.png 900w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_3.png 800w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_3.png 700w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_3.png 600w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_500x0_resize_box_3.png 500w" width="1825" height="831" alt="Copy site key to clipboard. Clipboard button is highlighted in the photo"\u003e
|
|
\u003cnoscript\u003e\u003cimg class="img-fluid" sizes="100vw" srcset="/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_3.png 900w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_3.png 800w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_3.png 700w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_3.png 600w,/docs/terminology/sitekey/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_500x0_resize_box_3.png 500w" src="/docs/terminology/sitekey/copy-sitekey.png" width="1825" height="831" alt="Copy site key to clipboard. Clipboard button is highlighted in the photo"\u003e\u003c/noscript\u003e
|
|
\u003c/figure\u003e
|
|
`},{id:6,href:"/docs/terminology/visitor-threshold/",title:"Visitor Threshold",description:"Visitor threshold is used to split traffic into levels. If the traffic level supersceedes the configured threshold, then mCaptcha will increase difficulty factor based on the configuration provided.",content:`\u003cp\u003emCaptcha\u0026rsquo;s variable difficulty factor mechanism requires a website\u0026rsquo;s traffic
|
|
statistics be split into levels, so that it can deploy the right
|
|
difficulty factor for each level.\u003c/p\u003e
|
|
\u003cp\u003eVisitor threshold is used to traffic into levels and mCaptcha accepts a
|
|
difficulty configuration for each of these levels. When current traffic
|
|
exceeds a difficulty factor, mCaptcha will increase the difficulty
|
|
factor to the next configured level.\u003c/p\u003e
|
|
\u003cp\u003eFor instance, consider the configuration given below:\u003c/p\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003eCool down period: 30 seconds\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
\u003ctable\u003e
|
|
\u003cthead\u003e
|
|
\u003ctr\u003e
|
|
\u003cth\u003eLevel\u003c/th\u003e
|
|
\u003cth\u003eDifficulty Factor\u003c/th\u003e
|
|
\u003cth\u003eVisitor Threshold\u003c/th\u003e
|
|
\u003c/tr\u003e
|
|
\u003c/thead\u003e
|
|
\u003ctbody\u003e
|
|
\u003ctr\u003e
|
|
\u003ctd\u003e1\u003c/td\u003e
|
|
\u003ctd\u003e5,000\u003c/td\u003e
|
|
\u003ctd\u003e2,000\u003c/td\u003e
|
|
\u003c/tr\u003e
|
|
\u003ctr\u003e
|
|
\u003ctd\u003e2\u003c/td\u003e
|
|
\u003ctd\u003e50,000\u003c/td\u003e
|
|
\u003ctd\u003e5,000\u003c/td\u003e
|
|
\u003c/tr\u003e
|
|
\u003ctr\u003e
|
|
\u003ctd\u003e3\u003c/td\u003e
|
|
\u003ctd\u003e500,000\u003c/td\u003e
|
|
\u003ctd\u003e10,000\u003c/td\u003e
|
|
\u003c/tr\u003e
|
|
\u003ctr\u003e
|
|
\u003ctd\u003e4\u003c/td\u003e
|
|
\u003ctd\u003e5,000,000\u003c/td\u003e
|
|
\u003ctd\u003e15,000\u003c/td\u003e
|
|
\u003c/tr\u003e
|
|
\u003c/tbody\u003e
|
|
\u003c/table\u003e
|
|
\u003cp\u003eIf the website sees 2,000 requests in a 30 second window, level 1
|
|
difficulty factor(5,000) will be deployed. If the traffic increases to
|
|
5,000 requests in a 30 second window, then difficulty factor will be
|
|
upgraded to level 2(50,000). Likewise 10,000 and 15,000 requests over 30
|
|
seconds will result in difficulty factor being upgraded to 500,000 and
|
|
5,000,000 respectively.\u003c/p\u003e
|
|
\u003cp\u003eVisitor threshold is how mCaptcha determines which difficulty factor
|
|
level to deploy. mCaptcha uses leaky bucket algorithm to keep the
|
|
visitor threshold constantly updated within the configured cool down
|
|
period. So, at any given moment the, the current visitor level will be
|
|
the amount of traffic that was served in the cool down period specified.\u003c/p\u003e
|
|
`},{id:7,href:"/docs/self-hosted/getting-started/",title:"Getting started",description:"Get started with self-hosting mCaptcha",content:`\u003ch2 id="get-started"\u003eGet started\u003c/h2\u003e
|
|
\u003cp\u003eThere are two main ways to self-host mCaptcha:\u003c/p\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003e\u003ca href="./bare-metal"\u003eBare metal\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="./docker"\u003eWith Docker\u003c/a\u003e\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
`},{id:8,href:"/docs/self-hosted/bare-metal/",title:"Deploy bare metal",description:"Bare metal deployment is tedious, most of this will be automated with a script in the future.",content:`\u003ch3 id="2-configure"\u003e2. Configure\u003c/h3\u003e
|
|
\u003cp\u003emcaptcha is highly configurable.\u003c/p\u003e
|
|
\u003cp\u003eConfiguration is applied/merged in the following order:\u003c/p\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003epath to configuration file passed in via \u003ccode\u003eMCAPTCHA_CONFIG\u003c/code\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ccode\u003e./config/default.toml\u003c/code\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ccode\u003e/etc/mcaptcha/config.toml\u003c/code\u003e\u003c/li\u003e
|
|
\u003cli\u003eenvironment variables.\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003ch3 id="1-install-postgres-if-you-dont-have-it-already"\u003e1. Install postgres if you don\u0026rsquo;t have it already.\u003c/h3\u003e
|
|
\u003cp\u003eFor Debian based distributions:\u003c/p\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003esudo apt install postgres
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="2-create-new-user-for-running-mcaptcha"\u003e2. Create new user for running \u003ccode\u003emcaptcha\u003c/code\u003e\u003c/h3\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="3-create-new-user-in-postgres"\u003e3. Create new user in Postgres\u003c/h3\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ sudo -iu postgres \u003cspan style="color:#6272a4"\u003e# switch to \`postgres\` user\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e$ psql
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#8be9fd;font-style:italic"\u003epostgres\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#6272a4"\u003e# CREATE USER mcaptcha WITH PASSWORD \u0026#39;my super long password and yes you need single quote\`;\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan\u003e$ createdb -O mcaptcha mcaptcha \u003cspan style="color:#6272a4"\u003e# create db \u0026#39;mcaptcha\u0026#39; with \u0026#39;mcaptcha\u0026#39; as owner\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="4-install-and-load-mcaptchacachehttpsgithubcommcaptchacache-module"\u003e4. Install and load \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e module:\u003c/h3\u003e
|
|
\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e for more
|
|
details.\u003c/p\u003e
|
|
\u003ch3 id="4-build-mcaptcha"\u003e4. Build \u003ccode\u003emcaptcha\u003c/code\u003e\u003c/h3\u003e
|
|
\u003cp\u003eTo build \u003ccode\u003emcaptcha\u003c/code\u003e, you need the following dependencies:\u003c/p\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003erust\u003c/li\u003e
|
|
\u003cli\u003enode(\u003ccode\u003ev14.16.0\u003c/code\u003e)\u003c/li\u003e
|
|
\u003cli\u003eyarn(JavaScript package manager)\u003c/li\u003e
|
|
\u003cli\u003emake\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003ch2 id="how-to-build"\u003eHow to build\u003c/h2\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003eInstall Cargo using \u003ca href="https://rustup.rs/"\u003erustup\u003c/a\u003e with:\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ curl --proto \u003cspan style="color:#f1fa8c"\u003e\u0026#39;=https\u0026#39;\u003c/span\u003e --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="2"\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eInstall node(\u003ccode\u003ev14.16.0\u003c/code\u003e)\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eInstall yarn(JavaScript package manager)\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eBuild with make:\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ make dev-env \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e make release
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="5-install-package"\u003e5. Install package:\u003c/h3\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ sudo cp ./target/release/mcaptcha /usr/bin/ \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e mkdir sudo /etc/mcaptcha \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e sudo cp config/default.toml /etc/mcaptcha/config.toml
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="6-systemd-service-configuration"\u003e6. Systemd service configuration:\u003c/h3\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003eCopy the following to \u003ccode\u003e/etc/systemd/system/mcaptcha.service\u003c/code\u003e:\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-systemd" data-lang="systemd"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 1\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#ff79c6"\u003e[Unit]\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eDescription\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003emCaptcha: a CAPTCHA system that gives attackers a run for their money\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 3\u003c/span\u003e\u003cspan\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 4\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#ff79c6"\u003e[Service]\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 5\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eType\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003esimple\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 6\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eUser\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003emcaptcha\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 7\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eExecStart\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e/usr/bin/mcaptcha\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 8\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eRestart\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003eon-failure\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e 9\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eRestartSec\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e1\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e10\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eSuccessExitStatus\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e3 4\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e11\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eRestartForceExitStatus\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e3 4\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e12\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eSystemCallArchitectures\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003enative\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e13\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eMemoryDenyWriteExecute\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003etrue\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e14\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eNoNewPrivileges\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003etrue\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e15\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eEnvironment\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;RUST_LOG=info\u0026#34;\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e16\u003c/span\u003e\u003cspan\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e17\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#ff79c6"\u003e[Unit]\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e18\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eAfter\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003esound.target\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e19\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eWants\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003enetwork-online.target\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e20\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eWants\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003enetwork-online.target\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e21\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eRequires\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003epostgresql.service\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e22\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eAfter\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003esyslog.target\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e23\u003c/span\u003e\u003cspan\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e24\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#ff79c6"\u003e[Install]\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e25\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#50fa7b"\u003eWantedBy\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003emulti-user.target\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="2"\u003e
|
|
\u003cli\u003eEnable service:\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ sudo systemctl daemon-reload \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e sudo systemctl \u003cspan style="color:#8be9fd;font-style:italic"\u003eenable\u003c/span\u003e mcaptcha \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\ \u003c/span\u003e\u003cspan style="color:#6272a4"\u003e# Auto startup during boot\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e sudo systemctl start mcaptcha
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\`\`\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e`},{id:9,href:"/docs/self-hosted/docker/",title:"Using Docker",description:"Deploy mCaptcha using docker",content:`\u003ch2 id="with-docker"\u003eWith Docker\u003c/h2\u003e
|
|
\u003ch3 id="1-configure"\u003e1. Configure\u003c/h3\u003e
|
|
\u003cp\u003emcaptcha is highly configurable.\u003c/p\u003e
|
|
\u003cp\u003eConfiguration is applied/merged in the following order:\u003c/p\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003epath to configuration file passed in via \u003ccode\u003eMCAPTCHA_CONFIG\u003c/code\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ccode\u003e./config/default.toml\u003c/code\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ccode\u003e/etc/mcaptcha/config.toml\u003c/code\u003e\u003c/li\u003e
|
|
\u003cli\u003eenvironment variables.\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cp\u003eSee
|
|
\u003ca href="https://github.com/mCaptcha/mCaptcha/tree/master/docs/CONFIGURATION.md"\u003eCONFIGURATION.md\u003c/a\u003e
|
|
for configurable options.\u003c/p\u003e
|
|
\u003ch3 id="2-run-image"\u003e2. Run image\u003c/h3\u003e
|
|
\u003cp\u003eIf you have already have a Postgres instance running, then:\u003c/p\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003edocker run -p \u0026lt;host-machine-port\u0026gt;:\u0026lt;port-in-configuration-file\u0026gt; \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e --add-host\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003edatabase:\u0026lt;database-ip-addrss\u0026gt; \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -e \u003cspan style="color:#8be9fd;font-style:italic"\u003eRUST_LOG\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003edebug \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -e \u003cspan style="color:#8be9fd;font-style:italic"\u003eDATABASE_URL\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#f1fa8c"\u003e\u0026#34;postgres://\u0026lt;db-user\u0026gt;:\u0026lt;db-password\u0026gt;@database:\u0026lt;db-port\u0026gt;/\u0026lt;db-name\u0026gt;\u0026#34;\u003c/span\u003e \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e5\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e mcaptcha/mcaptcha:latest
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eIf you don\u0026rsquo;t have a Postgres instance running, you can either install
|
|
one using a package manager or launch one with docker. A \u003ca href="'../docker-compose.yml"\u003edocker-compose
|
|
configuration\u003c/a\u003e is available that will launch both
|
|
a database instance mcaptcha instance.\u003c/p\u003e
|
|
\u003ch2 id="with-docker-compose"\u003eWith docker-compose\u003c/h2\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eFollow steps above to build docker image.\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eSet database password \u003ca href="'../docker-compose.yml"\u003edocker-compose configuration\u003c/a\u003e.\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eLaunch network\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003edocker-compose up -d
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e`},{id:10,href:"/docs/self-hosted/dependencies/",title:"Database and cache",description:"mCaptcha server requires dependencies like a Postgres database and a Redis cache",content:`\u003ch2 id="notes"\u003eNotes\u003c/h2\u003e
|
|
\u003ch3 id="database"\u003eDatabase\u003c/h3\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eDatabase migrations are baked into the server binary so don\u0026rsquo;t worry
|
|
about them.\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eWhen compiling from source, unset database configuration(comment out
|
|
database configuration/ \u003ccode\u003eunset\u003c/code\u003e relevant environment variables).
|
|
\u003ccode\u003emCaptcha\u003c/code\u003e uses \u003ca href="https://crates.io/crates/sqlx"\u003e\u003ccode\u003esqlx\u003c/code\u003e\u003c/a\u003e database client
|
|
library which checks SQL queries at compile time. So if you are starting
|
|
with a fresh database without migrations applied, compilation will fail.\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
\u003ch3 id="redis"\u003eRedis\u003c/h3\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003eRedis is an optional dependency. Currently, the non-Redis configuration
|
|
doesn\u0026rsquo;t persist CAPTCHA heat. So if there\u0026rsquo;s a systems failure, CAPTCHA
|
|
heat will be reset and visitor count will start from 0. For small
|
|
installations, this should post a problem as heat is short lived and is
|
|
reset anyways at cool down period.\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003cli\u003e
|
|
\u003cp\u003emCaptcha uses a custom Redis module called
|
|
\u003ca href="https://github.com/mCaptcha/cache"\u003ecache\u003c/a\u003e to overcome some of Redis'
|
|
limitations.\u003c/p\u003e
|
|
\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
\u003ch2 id="instructions"\u003eInstructions\u003c/h2\u003e
|
|
\u003cp\u003eOnce again, there are two ways to go about this:\u003c/p\u003e
|
|
\u003col\u003e
|
|
\u003cli\u003eDocker\u003c/li\u003e
|
|
\u003cli\u003eBare metal\u003c/li\u003e
|
|
\u003c/ol\u003e
|
|
\u003ch3 id="docker"\u003eDocker\u003c/h3\u003e
|
|
\u003ch3 id="database-1"\u003eDatabase\u003c/h3\u003e
|
|
\u003cp\u003eDownload and run Postgres\u003c/p\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003edocker create --name mcaptcha-postgres \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -e \u003cspan style="color:#8be9fd;font-style:italic"\u003ePOSTGRES_PASSWORD\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u0026lt;database-password\u0026gt; \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -p 5432:5432 \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e postgres \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker start mcaptcha-postgres
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="redis-1"\u003eRedis\u003c/h3\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003edocker create --name mcaptcha-cache \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e -p 6379:6379 \u003cspan style="color:#f1fa8c"\u003e\\
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#f1fa8c"\u003e\u003c/span\u003e mcaptcha/cache \u003cspan style="color:#ff79c6"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker start mcaptcha-cache
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003emCaptcha/cache\u003c/a\u003e for more
|
|
details.\u003c/p\u003e
|
|
\u003ch3 id="1-install-postgres-if-you-dont-have-it-already"\u003e1. Install Postgres if you don\u0026rsquo;t have it already.\u003c/h3\u003e
|
|
\u003cp\u003eFor Debian based distributions:\u003c/p\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003esudo apt install postgres
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="2-create-new-user-for-running-mcaptcha"\u003e2. Create new user for running \u003ccode\u003emCaptcha\u003c/code\u003e\u003c/h3\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ sudo useradd -b /srv -m -s /usr/bin/bash mcaptcha
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="3-create-new-user-in-postgres"\u003e3. Create new user in Postgres\u003c/h3\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e$ sudo -iu postgres \u003cspan style="color:#6272a4"\u003e# switch to \`postgres\` user\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003e$ psql
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e3\u003c/span\u003e\u003cspan\u003e\u003cspan style="color:#8be9fd;font-style:italic"\u003epostgres\u003c/span\u003e\u003cspan style="color:#ff79c6"\u003e=\u003c/span\u003e\u003cspan style="color:#6272a4"\u003e# CREATE USER mcaptcha WITH PASSWORD \u0026#39;my super long password and yes you need single quote\u0026#39;;\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e4\u003c/span\u003e\u003cspan\u003e$ createdb -O mcaptcha mcaptcha \u003cspan style="color:#6272a4"\u003e# create db \u0026#39;mcaptcha\u0026#39; with \u0026#39;mcaptcha\u0026#39; as owner\u003c/span\u003e
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="4-install-mcaptchacachehttpsgithubcommcaptchacache"\u003e4. Install \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e\u003c/h3\u003e
|
|
\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e for more
|
|
details.\u003c/p\u003e
|
|
`},{id:11,href:"/docs/help/troubleshooting/",title:"Troubleshooting",description:"Solutions to common problems.",content:`\u003ch2 id="q-i-just-setup-an-instance-but-i-am-unable-to-login"\u003eQ: I just setup an instance but I am unable to login\u003c/h2\u003e
|
|
\u003cp\u003emCaptcha by default is configured to server at \u003ccode\u003elocalhost\u003c/code\u003e hostname. If
|
|
the instance is deployed at another hostname, please try setting
|
|
\u003ccode\u003eMCAPTCHA_SERVER_DOMAIN\u003c/code\u003e environment variable to the hostname at which
|
|
your instance is deployed or setting the equivalent in config.toml:\u003c/p\u003e
|
|
\u003cdiv class="highlight"\u003e\u003cpre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"\u003e\u003ccode class="language-toml" data-lang="toml"\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e1\u003c/span\u003e\u003cspan\u003e[server]
|
|
\u003c/span\u003e\u003c/span\u003e\u003cspan style="display:flex;"\u003e\u003cspan style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"\u003e2\u003c/span\u003e\u003cspan\u003edomain=mydomain
|
|
\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e`},{id:12,href:"/docs/api/browser/",title:"Browser libraries",description:"API documenttion for mCaptcha WASM library",content:`\u003cp\u003eThe browser part of mCaptcha is divided into three components.\u003c/p\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003eGlue code\u003c/li\u003e
|
|
\u003cli\u003eWidget program\u003c/li\u003e
|
|
\u003cli\u003eProof-of-Work libraries(WebAssembly and JavaScript polyfill)\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
\u003ch2 id="glue-code"\u003eGlue code\u003c/h2\u003e
|
|
\u003cp\u003eThis is the code that links mCaptcha with your website\u0026rsquo;s frontend code.
|
|
It creates an \u003ccode\u003eiframe\u003c/code\u003e containing the mCaptcha widget and injects the
|
|
received verification proof token into a hidden input field.\u003c/p\u003e
|
|
\u003cp\u003eSupport is available for various frameworks, see
|
|
\u003ca href="https://github.com/mCaptcha/glue"\u003e\u003ccode\u003emCaptcha/glue\u003c/code\u003e\u003c/a\u003e for the full list.\u003c/p\u003e
|
|
\u003cp\u003eFor frameworks without official support, a low-level library,
|
|
\u003ca href="https://www.npmjs.com/package/@mcaptcha/core-glue"\u003e\u003ccode\u003e@mcaptcha/core-glue\u003c/code\u003e\u003c/a\u003e,
|
|
can be used to implement support.\u003c/p\u003e
|
|
\u003ch2 id="widget-program"\u003eWidget Program\u003c/h2\u003e
|
|
\u003cp\u003eThis part is served by the mCaptcha backend. It fetches PoW config from
|
|
the backend, generates proof and submits it for verification. If
|
|
verification is successful, it sends a message containing the
|
|
verification proof token to the parent window, assuming it\u0026rsquo;s loaded as
|
|
an \u003ccode\u003eiframe\u003c/code\u003e.\u003c/p\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003eSource code:
|
|
\u003ca href="https://github.com/mCaptcha/mCaptcha/tree/master/templates/widget"\u003e\u003ccode\u003emCaptcha/mCaptcha/templates/widget\u003c/code\u003e\u003c/a\u003e\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
\u003cp\u003eWebAssembly library which generates Proofs of Work for mCaptcha systems.\u003c/p\u003e
|
|
\u003ch2 id="proof-of-workpow-library"\u003eProof-of-Work(PoW) library\u003c/h2\u003e
|
|
\u003cp\u003eWebAssembly bindings(\u003ca href="https://github.com/mCaptcha/pow_wasm"\u003e\u003ccode\u003emCaptcha/pow_wasm\u003c/code\u003e\u003c/a\u003e) are available for the main rust library(\u003ca href="https://github.com/mCaptcha/pow_sha256"\u003e\u003ccode\u003emCaptcha/pow_sha256\u003c/code\u003e\u003c/a\u003e).\u003c/p\u003e
|
|
\u003cp\u003eFor browsers without support WebAssembly, a
|
|
polyfill(\u003ca href="https://github.com/mCaptcha/pow_sha256-polyfill"\u003e\u003ccode\u003epow_sha256-polyfill\u003c/code\u003e\u003c/a\u003e)
|
|
is available.\u003c/p\u003e
|
|
`},{id:13,href:"/docs/api/mcaptcha-system/",title:"mCaptcha System Library",description:"API documenttion for the core Library used in mCaptcha",content:`\u003cp\u003eDocumentation for the library used in mCaptcha core.\u003c/p\u003e
|
|
\u003ch2 id="versions"\u003eVersions\u003c/h2\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003e\u003ca href="https://mcaptcha.github.io/mCaptcha/m_captcha/index.html"\u003emaster-branch\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.3/m_captcha/index.html"\u003e0.1.3\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.2/m_captcha/index.html"\u003e0.1.2\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.1/m_captcha/index.html"\u003e0.1.1\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.0/m_captcha/index.html"\u003e0.1.0\u003c/a\u003e\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
`},{id:14,href:"/docs/api/pow-sha256/",title:"pow_sha256",description:"API documenttion for PoW Library used in mCaptcha",content:`\u003cp\u003eRust crate which generates SHA256 Proofs of Work on serializable datatypes.\u003c/p\u003e
|
|
\u003cp\u003eThis is a fork of the \u003ca href="https://github.com/bddap/pow"\u003e\u003ccode\u003epow\u003c/code\u003e library\u003c/a\u003e by
|
|
\u003ca href="https://github.com/robkorn/pow_sha256"\u003e@robkorn\u003c/a\u003e) with some new
|
|
additions. Primary of these being:\u003c/p\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003ePoW datatype now offers a constructor\u003c/li\u003e
|
|
\u003cli\u003eSalt is no longer hard coded into the library, users can provide
|
|
unique salts.\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
\u003cp\u003eOther small changes have also been included of various importance but
|
|
mostly just stylistic/ease of use improvements.\u003c/p\u003e
|
|
\u003ch2 id="versions"\u003eVersions\u003c/h2\u003e
|
|
\u003cul\u003e
|
|
\u003cli\u003e\u003ca href="https://mcaptcha.github.io/pow_sha256/pow_sha256/index.html"\u003emaster-branch\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.2.1/pow_sha256/index.html"\u003e0.2.1\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.2.0/pow_sha256/index.html"\u003e0.2.0\u003c/a\u003e\u003c/li\u003e
|
|
\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.1.0/pow_sha256/index.html"\u003e0.1.0\u003c/a\u003e\u003c/li\u003e
|
|
\u003c/ul\u003e
|
|
\u003ch2 id="changelog"\u003eChangelog\u003c/h2\u003e
|
|
\u003cp\u003eChangelog is available at the project\u0026rsquo;s
|
|
\u003ca href="https://github.com/mCaptcha/pow_sha256/blob/master/CHANGELOG.md"\u003erepository\u003c/a\u003e\u003c/p\u003e
|
|
`},{id:15,href:"/docs/help/faq/",title:"FAQ",description:"Answers to frequently asked questions.",content:`\u003cp\u003eComing soon\u003c/p\u003e
|
|
`},{id:16,href:"/docs/terminology/",title:"Terminology",description:"Information about terminology used in mCaptcha, some of which unique to the project",content:""},{id:17,href:"/docs/help/",title:"Help",description:"Help mCaptcha.",content:""},{id:18,href:"/docs/introduction/",title:"Introduction",description:"Introduction to mCaptcha.",content:""},{id:19,href:"/docs/api/",title:"API",description:"Documentation for libraries used in mCaptcha",content:""},{id:20,href:"/docs/",title:"mCaptcha",description:"Docs mCaptcha",content:""},{id:21,href:"/docs/self-hosted/",title:"Self-Hosted",description:"Instructions to self-host mCaptcha",content:""}];e.add(n),userinput.addEventListener("input",s,!0),suggestions.addEventListener("click",o,!0);function s(){var n,i=this.value,s=e.search(i,5),o=suggestions.childNodes,r=0,c=s.length;for(suggestions.classList.remove("d-none"),s.forEach(function(e){n=document.createElement("div"),n.innerHTML="<a href><span></span><span></span></a>",a=n.querySelector("a"),t=n.querySelector("span:first-child"),d=n.querySelector("span:nth-child(2)"),a.href=e.href,t.textContent=e.title,d.textContent=e.description,suggestions.appendChild(n)});o.length>c;)suggestions.removeChild(o[r])}function o(){for(;suggestions.lastChild;)suggestions.removeChild(suggestions.lastChild);return!1}})() |