508 lines
No EOL
63 KiB
JavaScript
508 lines
No EOL
63 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/webmasters/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:`<p>mCaptcha can protect your website from DDoS attacks. In this guide we’ll
|
|
explore how to install mCaptcha on your website. The end result will be
|
|
something like this, on your website:</p>
|
|
<figure>
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_20x0_resize_box_3.png" data-srcset="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_3.png 600w,/docs/webmasters/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">
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result_hub39801b2a229b4882fd00c2c83dd77fb_28299_500x0_resize_box_3.png 500w" src="/docs/webmasters/installing-captcha/mcaptcha-widget-installation-result.png" width="618" height="669" alt="A registration form with mCaptcha widget installed"></noscript>
|
|
</figure>
|
|
<p>For the purpose of this demo, we will be using
|
|
<a href="https://demo.mcaptcha.org">demo.mcaptcha.org</a>, a demo instance running
|
|
in @realaravinth’s bedroom(for this same reason, it shouldn’t be used
|
|
for anything serious)</p>
|
|
<h2 id="1-create-an-account-and-sign-into-the-mcaptcha-dashboard">1. Create an account and sign into the mCaptcha dashboard</h2>
|
|
<p>Head over to <a href="https://demo.mcaptcha.org/join">demo.mcaptcha.org</a> and
|
|
create an account. When ready, sign in.</p>
|
|
<h2 id="2-create-new-site-key">2. Create new site key</h2>
|
|
<p>A <a href="/docs/terminology/sitekey/">site key</a> is how a new CAPTCHA is configured within mCaptcha. To create
|
|
a new site key, click on “New Site” button in the dashboard.</p>
|
|
<figure>
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_20x0_resize_box_3.png" data-srcset="/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_3.png 500w" width="1825" height="857" alt="mCaptcha dashboard with the 'new site key' button highlighted">
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-btn_hu4dc550a2e568d01f004e26fb8eb1b427_65746_500x0_resize_box_3.png 500w" src="/docs/webmasters/installing-captcha/new-sitekey-btn.png" width="1825" height="857" alt="mCaptcha dashboard with the 'new site key' button highlighted"></noscript>
|
|
</figure>
|
|
<p>There are two options to create a new site key, easy and advanced. <strong>We
|
|
are going to use the easy mode in this tutorial.</strong> If you are interested
|
|
in learning more about the advance mode, please see <a href="/docs/introduction/configuring-difficulty-factor/#advance-option">here</a>.</p>
|
|
<blockquote>
|
|
<h3 id="easy-modedocsintroductionconfiguring-difficulty-factoreasy-option"><a href="/docs/introduction/configuring-difficulty-factor/#easy-option">Easy Mode</a></h3>
|
|
<p>Easy 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.</p>
|
|
<p>Configuration generated by easy mode can be tweaked later using the
|
|
advance mode, as you become more familiar with how mCaptcha works.</p>
|
|
</blockquote>
|
|
<p>Fill the form and submit it.</p>
|
|
<figure>
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_20x0_resize_box_3.png" data-srcset="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_3.png 500w" width="720" height="452" alt="mCaptcha dashboard with the 'new site key' form in easy mode, with details filled in">
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_900x0_resize_box_3.png 900w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_800x0_resize_box_3.png 800w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_700x0_resize_box_3.png 700w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_600x0_resize_box_3.png 600w,/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled_hu0c237370199481610ab31adaa9c5a5e6_30108_500x0_resize_box_3.png 500w" src="/docs/webmasters/installing-captcha/new-sitekey-easy-mode-filled.png" width="720" height="452" alt="mCaptcha dashboard with the 'new site key' form in easy mode, with details filled in"></noscript>
|
|
</figure>
|
|
<h2 id="3-copy-widget-link">3. Copy widget link</h2>
|
|
<p>Submitting the form will take you to a page where site key configuration
|
|
can be viewed. “View deployment” link will display CAPTCHA widget with
|
|
the supplied configuration. Click on it and grab the widget link.</p>
|
|
<h2 id="4-install-mcaptcha-on-your-website">4. Install mCaptcha on your website</h2>
|
|
<p>Integration support is available for some frontend JavaScript
|
|
frameworks. To see full list of supported frameworks, please see
|
|
<a href="https://github.com/mCaptcha/glue#framework-support">here</a>.</p>
|
|
<p>There are two options to use the integration library to integrate
|
|
mCaptcha on your website:</p>
|
|
<ol>
|
|
<li>Serve the integration library yourself</li>
|
|
<li>Use a CDN like unpkg.com</li>
|
|
</ol>
|
|
<p>In this tutorial, we’ll be using the CDN.</p>
|
|
<p><strong>Pasting the following snippet on the page, within the form</strong> that requires to be protected
|
|
will load the mCaptcha widget with the configuration supplied. Be sure
|
|
to replace <code>Your {{paste your widget link}}</code> with the link obtained from
|
|
the previous step.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1</span><span><<span style="color:#ff79c6">div</span> <span style="color:#50fa7b">id</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">"mcaptcha__widget-container"</span>></<span style="color:#ff79c6">div</span>>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2</span><span><<span style="color:#ff79c6">script</span> <span style="color:#50fa7b">src</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">"https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-alpha-2/dist/index.js"</span>></<span style="color:#ff79c6">script</span>>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3</span><span><<span style="color:#ff79c6">script</span> <span style="color:#50fa7b">charset</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">"utf-8"</span>>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4</span><span> <span style="color:#8be9fd;font-style:italic">let</span> config <span style="color:#ff79c6">=</span> {
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5</span><span> widgetLink<span style="color:#ff79c6">:</span> <span style="color:#ff79c6">new</span> URL(
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6</span><span> {{paste yout widget link}}
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7</span><span> ),
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8</span><span> };
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9</span><span> <span style="color:#ff79c6">new</span> mcaptchaGlue.<span style="color:#ff79c6">default</span>(config);
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10</span><span></<span style="color:#ff79c6">script</span>>
|
|
</span></span></code></pre></div><p>A full example is available
|
|
<a href="https://github.com/mCaptcha/glue/blob/ea576d875457de54d82bed3edfc4ee68302fa4d8/packages/vanilla/static/embeded.html">here</a>.</p>
|
|
<h2 id="5-configure-backend-to-authenticate-captcha-tokens">5. Configure backend to authenticate CAPTCHA tokens</h2>
|
|
<ol>
|
|
<li>
|
|
<p>Get <a href="/docs/terminology/access-token">access token</a> from the user’s
|
|
form submission payload. The access token will be associated with a
|
|
parameter called <code>mcaptcha__token</code>.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span> mcaptcha_token <span style="color:#ff79c6">=</span> request<span style="color:#ff79c6">.</span>form[<span style="color:#f1fa8c">"mcaptcha__token"</span>]
|
|
</span></span></code></pre></div></li>
|
|
<li>
|
|
<p>Validate access token with mCaptcha instance</p>
|
|
</li>
|
|
</ol>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1</span><span>payload <span style="color:#ff79c6">=</span> {
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2</span><span> <span style="color:#f1fa8c">"token"</span>: mcaptcha_token,
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3</span><span> <span style="color:#f1fa8c">"key"</span>: mcaptcha_sitekey, <span style="color:#6272a4"># captcha site key</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4</span><span> <span style="color:#6272a4"># mCaptcha account secret; available in settings</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5</span><span> <span style="color:#f1fa8c">"secret"</span>: mcaptcha_account_secret,
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6</span><span>}
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7</span><span>resp <span style="color:#ff79c6">=</span> requests<span style="color:#ff79c6">.</span>post(
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8</span><span> <span style="color:#f1fa8c">"https://demo.mcaptha.org/api/v1/pow/siteverify"</span>, json<span style="color:#ff79c6">=</span>payload
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9</span><span>)
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10</span><span>resp <span style="color:#ff79c6">=</span> resp<span style="color:#ff79c6">.</span>json()
|
|
</span></span></code></pre></div><ol start="3">
|
|
<li>If access token is valid, allow access to protected resource or deny
|
|
access.</li>
|
|
</ol>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span> <span style="color:#ff79c6">if</span> resp[<span style="color:#f1fa8c">"valid"</span>] <span style="color:#ff79c6">==</span> <span style="color:#ff79c6">False</span>:
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span> <span style="color:#ff79c6">return</span> <span style="color:#f1fa8c">"invalid captcha"</span>, <span style="color:#bd93f9">400</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span> <span style="color:#ff79c6">else</span>:
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span> <span style="color:#ff79c6">return</span> allow_access_to_protected_resource(request<span style="color:#ff79c6">.</span>form)
|
|
</span></span></code></pre></div><p>Please see here for a complete <a href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/server">Flask example</a> and here for an <a href="https://github.com/mCaptcha/dos/tree/8f2b53ab46d64fa78a8300dc8ce9d78578ffce12/rust-server/demo-server">Actix
|
|
Web example</a>.</p>
|
|
<p>Congratulations, mCaptcha is now integrated with your website!</p>
|
|
`},{id:1,href:"/docs/webmasters/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:`<p>mCaptcha is highly responsive to detecting DDoS attacks. Admins are
|
|
advised to take advantage of it by setting low <a href="/docs/terminology/difficulty-factor/">difficulty
|
|
factors</a> for normal traffic levels
|
|
for their website.</p>
|
|
<p><strong>Lowest advisable difficulty factor is 5000.</strong></p>
|
|
<p>For instance, if it is normal for my website to get 2000 requests for
|
|
every 30 seconds, I will set a <a href="/docs/terminology/cooldown-period">cool
|
|
down</a> period of 30 seconds and the
|
|
first level of difficulty configuration will have a <a href="/docs/terminology/visitor-threshold">visitor threshold</a> of 2000 with a
|
|
difficulty factor of 5000.</p>
|
|
<p>There are two modes to setting difficulty factor for your website on
|
|
mCaptcha:</p>
|
|
<h3 id="easy-option">Easy option</h3>
|
|
<p>Easy 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.</p>
|
|
<p>Configuration generated by easy mode can be tweaked later using the
|
|
advance mode, as you become more familiar with how mCaptcha works.</p>
|
|
<figure>
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_20x0_resize_box_3.png" data-srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_3.png 600w,/docs/webmasters/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">
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_600x0_resize_box_3.png 600w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode_hu3f66189ea53484ac6603a2d78fa015c8_26636_500x0_resize_box_3.png 500w" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-easy-mode.png" width="720" height="452" alt="new sitekey form in easy mode"></noscript>
|
|
</figure>
|
|
<h3 id="advance-option">Advance option</h3>
|
|
<p>Advance 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’s variable difficulty factor feature.</p>
|
|
<p>For 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.</p>
|
|
<figure>
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_20x0_resize_box_3.png" data-srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_3.png 600w,/docs/webmasters/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">
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_900x0_resize_box_3.png 900w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_800x0_resize_box_3.png 800w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_700x0_resize_box_3.png 700w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_600x0_resize_box_3.png 600w,/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode_huc4867c6295dc4be195d832a52b37239b_23312_500x0_resize_box_3.png 500w" src="/docs/webmasters/configuring-difficulty-factor/new-sitekey-adv-mode.png" width="720" height="407" alt="new sitekey form in advance mode"></noscript>
|
|
</figure>
|
|
`},{id:2,href:"/docs/self-hosting/getting-started/",title:"Getting started",description:"Get started with self-hosting mCaptcha",content:`<h2 id="get-started">Get started</h2>
|
|
<p>There are two main ways to self-host mCaptcha:</p>
|
|
<ol>
|
|
<li><a href="./bare-metal">Bare metal</a></li>
|
|
<li><a href="./docker">With Docker</a></li>
|
|
</ol>
|
|
`},{id:3,href:"/docs/self-hosting/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:`<h3 id="2-configure">2. Configure</h3>
|
|
<p>mcaptcha is highly configurable.</p>
|
|
<p>Configuration is applied/merged in the following order:</p>
|
|
<ol>
|
|
<li>path to configuration file passed in via <code>MCAPTCHA_CONFIG</code></li>
|
|
<li><code>./config/default.toml</code></li>
|
|
<li><code>/etc/mcaptcha/config.toml</code></li>
|
|
<li>environment variables.</li>
|
|
</ol>
|
|
<h3 id="1-install-postgres-if-you-dont-have-it-already">1. Install postgres if you don’t have it already.</h3>
|
|
<p>For Debian based distributions:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>sudo apt install postgres
|
|
</span></span></code></pre></div><h3 id="2-create-new-user-for-running-mcaptcha">2. Create new user for running <code>mcaptcha</code></h3>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha
|
|
</span></span></code></pre></div><h3 id="3-create-new-user-in-postgres">3. Create new user in Postgres</h3>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ sudo -iu postgres <span style="color:#6272a4"># switch to \`postgres\` user</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>$ psql
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#8be9fd;font-style:italic">postgres</span><span style="color:#ff79c6">=</span><span style="color:#6272a4"># CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes you need single quote\`;</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span>$ createdb -O mcaptcha mcaptcha <span style="color:#6272a4"># create db 'mcaptcha' with 'mcaptcha' as owner</span>
|
|
</span></span></code></pre></div><h3 id="4-install-and-load-mcaptchacachehttpsgithubcommcaptchacache-module">4. Install and load <a href="https://github.com/mCaptcha/cache"><code>mCaptcha/cache</code></a> module:</h3>
|
|
<p>See <a href="https://github.com/mCaptcha/cache"><code>mCaptcha/cache</code></a> for more
|
|
details.</p>
|
|
<h3 id="4-build-mcaptcha">4. Build <code>mcaptcha</code></h3>
|
|
<p>To build <code>mcaptcha</code>, you need the following dependencies:</p>
|
|
<ol>
|
|
<li>rust</li>
|
|
<li>node(<code>v14.16.0</code>)</li>
|
|
<li>yarn(JavaScript package manager)</li>
|
|
<li>make</li>
|
|
</ol>
|
|
<h2 id="how-to-build">How to build</h2>
|
|
<ol>
|
|
<li>Install Cargo using <a href="https://rustup.rs/">rustup</a> with:</li>
|
|
</ol>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ curl --proto <span style="color:#f1fa8c">'=https'</span> --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
</span></span></code></pre></div><ol start="2">
|
|
<li>
|
|
<p>Install node(<code>v14.16.0</code>)</p>
|
|
</li>
|
|
<li>
|
|
<p>Install yarn(JavaScript package manager)</p>
|
|
</li>
|
|
<li>
|
|
<p>Build with make:</p>
|
|
</li>
|
|
</ol>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ make dev-env <span style="color:#ff79c6">&&</span> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#f1fa8c"></span> make release
|
|
</span></span></code></pre></div><h3 id="5-install-package">5. Install package:</h3>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ sudo cp ./target/release/mcaptcha /usr/bin/ <span style="color:#ff79c6">&&</span> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#f1fa8c"></span> mkdir sudo /etc/mcaptcha <span style="color:#ff79c6">&&</span> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#f1fa8c"></span> sudo cp config/default.toml /etc/mcaptcha/config.toml
|
|
</span></span></code></pre></div><h3 id="6-systemd-service-configuration">6. Systemd service configuration:</h3>
|
|
<ol>
|
|
<li>Copy the following to <code>/etc/systemd/system/mcaptcha.service</code>:</li>
|
|
</ol>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-systemd" data-lang="systemd"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1</span><span><span style="color:#ff79c6">[Unit]</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2</span><span><span style="color:#50fa7b">Description</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">mCaptcha: a CAPTCHA system that gives attackers a run for their money</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3</span><span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4</span><span><span style="color:#ff79c6">[Service]</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5</span><span><span style="color:#50fa7b">Type</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">simple</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6</span><span><span style="color:#50fa7b">User</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">mcaptcha</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7</span><span><span style="color:#50fa7b">ExecStart</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">/usr/bin/mcaptcha</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8</span><span><span style="color:#50fa7b">Restart</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">on-failure</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9</span><span><span style="color:#50fa7b">RestartSec</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">1</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10</span><span><span style="color:#50fa7b">SuccessExitStatus</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">3 4</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11</span><span><span style="color:#50fa7b">RestartForceExitStatus</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">3 4</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12</span><span><span style="color:#50fa7b">SystemCallArchitectures</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">native</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13</span><span><span style="color:#50fa7b">MemoryDenyWriteExecute</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">true</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14</span><span><span style="color:#50fa7b">NoNewPrivileges</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">true</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15</span><span><span style="color:#50fa7b">Environment</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">"RUST_LOG=info"</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16</span><span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17</span><span><span style="color:#ff79c6">[Unit]</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18</span><span><span style="color:#50fa7b">After</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">sound.target</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19</span><span><span style="color:#50fa7b">Wants</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">network-online.target</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20</span><span><span style="color:#50fa7b">Wants</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">network-online.target</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21</span><span><span style="color:#50fa7b">Requires</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">postgresql.service</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22</span><span><span style="color:#50fa7b">After</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">syslog.target</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23</span><span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24</span><span><span style="color:#ff79c6">[Install]</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25</span><span><span style="color:#50fa7b">WantedBy</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">multi-user.target</span>
|
|
</span></span></code></pre></div><ol start="2">
|
|
<li>Enable service:</li>
|
|
</ol>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ sudo systemctl daemon-reload <span style="color:#ff79c6">&&</span> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#f1fa8c"></span> sudo systemctl <span style="color:#8be9fd;font-style:italic">enable</span> mcaptcha <span style="color:#ff79c6">&&</span> <span style="color:#f1fa8c">\\ </span><span style="color:#6272a4"># Auto startup during boot</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span> sudo systemctl start mcaptcha
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span><span style="color:#f1fa8c">\`\`</span>
|
|
</span></span></code></pre></div>`},{id:4,href:"/docs/self-hosting/docker/",title:"Using Docker",description:"Deploy mCaptcha using docker",content:`<h2 id="with-docker">With Docker</h2>
|
|
<h3 id="1-configure">1. Configure</h3>
|
|
<p>mcaptcha is highly configurable.</p>
|
|
<p>Configuration is applied/merged in the following order:</p>
|
|
<ol>
|
|
<li>path to configuration file passed in via <code>MCAPTCHA_CONFIG</code></li>
|
|
<li><code>./config/default.toml</code></li>
|
|
<li><code>/etc/mcaptcha/config.toml</code></li>
|
|
<li>environment variables.</li>
|
|
</ol>
|
|
<p>See
|
|
<a href="https://github.com/mCaptcha/mCaptcha/tree/master/docs/CONFIGURATION.md">CONFIGURATION.md</a>
|
|
for configurable options.</p>
|
|
<h3 id="2-run-image">2. Run image</h3>
|
|
<p>If you have already have a Postgres instance running, then:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>docker run -p <host-machine-port>:<port-in-configuration-file> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#f1fa8c"></span> --add-host<span style="color:#ff79c6">=</span>database:<database-ip-addrss> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#f1fa8c"></span> -e <span style="color:#8be9fd;font-style:italic">RUST_LOG</span><span style="color:#ff79c6">=</span>debug <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span><span style="color:#f1fa8c"></span> -e <span style="color:#8be9fd;font-style:italic">DATABASE_URL</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">"postgres://<db-user>:<db-password>@database:<db-port>/<db-name>"</span> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5</span><span><span style="color:#f1fa8c"></span> mcaptcha/mcaptcha:latest
|
|
</span></span></code></pre></div><p>If you don’t have a Postgres instance running, you can either install
|
|
one using a package manager or launch one with docker. A <a href="'../docker-compose.yml">docker-compose
|
|
configuration</a> is available that will launch both
|
|
a database instance mcaptcha instance.</p>
|
|
<h2 id="with-docker-compose">With docker-compose</h2>
|
|
<ol>
|
|
<li>
|
|
<p>Follow steps above to build docker image.</p>
|
|
</li>
|
|
<li>
|
|
<p>Set database password <a href="'../docker-compose.yml">docker-compose configuration</a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Launch network</p>
|
|
</li>
|
|
</ol>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>docker-compose up -d
|
|
</span></span></code></pre></div>`},{id:5,href:"/docs/self-hosting/dependencies/",title:"Database and cache",description:"mCaptcha server requires dependencies like a Postgres database and a Redis cache",content:`<h2 id="notes">Notes</h2>
|
|
<h3 id="database">Database</h3>
|
|
<ul>
|
|
<li>
|
|
<p>Database migrations are baked into the server binary so don’t worry
|
|
about them.</p>
|
|
</li>
|
|
<li>
|
|
<p>When compiling from source, unset database configuration(comment out
|
|
database configuration/ <code>unset</code> relevant environment variables).
|
|
<code>mCaptcha</code> uses <a href="https://crates.io/crates/sqlx"><code>sqlx</code></a> 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.</p>
|
|
</li>
|
|
</ul>
|
|
<h3 id="redis">Redis</h3>
|
|
<ul>
|
|
<li>
|
|
<p>Redis is an optional dependency. Currently, the non-Redis configuration
|
|
doesn’t persist CAPTCHA heat. So if there’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.</p>
|
|
</li>
|
|
<li>
|
|
<p>mCaptcha uses a custom Redis module called
|
|
<a href="https://github.com/mCaptcha/cache">cache</a> to overcome some of Redis'
|
|
limitations.</p>
|
|
</li>
|
|
</ul>
|
|
<h2 id="instructions">Instructions</h2>
|
|
<p>Once again, there are two ways to go about this:</p>
|
|
<ol>
|
|
<li>Docker</li>
|
|
<li>Bare metal</li>
|
|
</ol>
|
|
<h3 id="docker">Docker</h3>
|
|
<h3 id="database-1">Database</h3>
|
|
<p>Download and run Postgres</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>docker create --name mcaptcha-postgres <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#f1fa8c"></span> -e <span style="color:#8be9fd;font-style:italic">POSTGRES_PASSWORD</span><span style="color:#ff79c6">=</span><database-password> <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#f1fa8c"></span> -p 5432:5432 <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span><span style="color:#f1fa8c"></span> postgres <span style="color:#ff79c6">&&</span> docker start mcaptcha-postgres
|
|
</span></span></code></pre></div><h3 id="redis-1">Redis</h3>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>docker create --name mcaptcha-cache <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#f1fa8c"></span> -p 6379:6379 <span style="color:#f1fa8c">\\
|
|
</span></span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#f1fa8c"></span> mcaptcha/cache <span style="color:#ff79c6">&&</span> docker start mcaptcha-cache
|
|
</span></span></code></pre></div><p>See <a href="https://github.com/mCaptcha/cache">mCaptcha/cache</a> for more
|
|
details.</p>
|
|
<h3 id="1-install-postgres-if-you-dont-have-it-already">1. Install Postgres if you don’t have it already.</h3>
|
|
<p>For Debian based distributions:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>sudo apt install postgres
|
|
</span></span></code></pre></div><h3 id="2-create-new-user-for-running-mcaptcha">2. Create new user for running <code>mCaptcha</code></h3>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ sudo useradd -b /srv -m -s /usr/bin/bash mcaptcha
|
|
</span></span></code></pre></div><h3 id="3-create-new-user-in-postgres">3. Create new user in Postgres</h3>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>$ sudo -iu postgres <span style="color:#6272a4"># switch to \`postgres\` user</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>$ psql
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#8be9fd;font-style:italic">postgres</span><span style="color:#ff79c6">=</span><span style="color:#6272a4"># CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes you need single quote';</span>
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4</span><span>$ createdb -O mcaptcha mcaptcha <span style="color:#6272a4"># create db 'mcaptcha' with 'mcaptcha' as owner</span>
|
|
</span></span></code></pre></div><h3 id="4-install-mcaptchacachehttpsgithubcommcaptchacache">4. Install <a href="https://github.com/mCaptcha/cache"><code>mCaptcha/cache</code></a></h3>
|
|
<p>See <a href="https://github.com/mCaptcha/cache"><code>mCaptcha/cache</code></a> for more
|
|
details.</p>
|
|
`},{id:6,href:"/docs/help/troubleshooting/",title:"Troubleshooting",description:"Solutions to common problems.",content:`<h2 id="q-i-just-setup-an-instance-but-i-am-unable-to-login">Q: I just setup an instance but I am unable to login</h2>
|
|
<p>mCaptcha by default is configured to server at <code>localhost</code> hostname. If
|
|
the instance is deployed at another hostname, please try setting
|
|
<code>MCAPTCHA_SERVER_DOMAIN</code> environment variable to the hostname at which
|
|
your instance is deployed or setting the equivalent in config.toml:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>[server]
|
|
</span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span>domain=mydomain
|
|
</span></span></code></pre></div>`},{id:7,href:"/docs/api/browser/",title:"Browser libraries",description:"API documenttion for mCaptcha WASM library",content:`<p>The browser part of mCaptcha is divided into three components.</p>
|
|
<ul>
|
|
<li>Glue code</li>
|
|
<li>Widget program</li>
|
|
<li>Proof-of-Work libraries(WebAssembly and JavaScript polyfill)</li>
|
|
</ul>
|
|
<h2 id="glue-code">Glue code</h2>
|
|
<p>This is the code that links mCaptcha with your website’s frontend code.
|
|
It creates an <code>iframe</code> containing the mCaptcha widget and injects the
|
|
received verification proof token into a hidden input field.</p>
|
|
<p>Support is available for various frameworks, see
|
|
<a href="https://github.com/mCaptcha/glue"><code>mCaptcha/glue</code></a> for the full list.</p>
|
|
<p>For frameworks without official support, a low-level library,
|
|
<a href="https://www.npmjs.com/package/@mcaptcha/core-glue"><code>@mcaptcha/core-glue</code></a>,
|
|
can be used to implement support.</p>
|
|
<h2 id="widget-program">Widget Program</h2>
|
|
<p>This 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’s loaded as
|
|
an <code>iframe</code>.</p>
|
|
<ul>
|
|
<li>Source code:
|
|
<a href="https://github.com/mCaptcha/mCaptcha/tree/master/templates/widget"><code>mCaptcha/mCaptcha/templates/widget</code></a></li>
|
|
</ul>
|
|
<p>WebAssembly library which generates Proofs of Work for mCaptcha systems.</p>
|
|
<h2 id="proof-of-workpow-library">Proof-of-Work(PoW) library</h2>
|
|
<p>WebAssembly bindings(<a href="https://github.com/mCaptcha/pow_wasm"><code>mCaptcha/pow_wasm</code></a>) are available for the main rust library(<a href="https://github.com/mCaptcha/pow_sha256"><code>mCaptcha/pow_sha256</code></a>).</p>
|
|
<p>For browsers without support WebAssembly, a
|
|
polyfill(<a href="https://github.com/mCaptcha/pow_sha256-polyfill"><code>pow_sha256-polyfill</code></a>)
|
|
is available.</p>
|
|
`},{id:8,href:"/docs/api/mcaptcha-system/",title:"mCaptcha System Library",description:"API documenttion for the core Library used in mCaptcha",content:`<p>Documentation for the library used in mCaptcha core.</p>
|
|
<h2 id="versions">Versions</h2>
|
|
<ul>
|
|
<li><a href="https://mcaptcha.github.io/mCaptcha/m_captcha/index.html">master-branch</a></li>
|
|
<li><a href="/api-docs/m_captcha/0.1.3/m_captcha/index.html">0.1.3</a></li>
|
|
<li><a href="/api-docs/m_captcha/0.1.2/m_captcha/index.html">0.1.2</a></li>
|
|
<li><a href="/api-docs/m_captcha/0.1.1/m_captcha/index.html">0.1.1</a></li>
|
|
<li><a href="/api-docs/m_captcha/0.1.0/m_captcha/index.html">0.1.0</a></li>
|
|
</ul>
|
|
`},{id:9,href:"/docs/api/pow-sha256/",title:"pow_sha256",description:"API documenttion for PoW Library used in mCaptcha",content:`<p>Rust crate which generates SHA256 Proofs of Work on serializable datatypes.</p>
|
|
<p>This is a fork of the <a href="https://github.com/bddap/pow"><code>pow</code> library</a> by
|
|
<a href="https://github.com/robkorn/pow_sha256">@robkorn</a>) with some new
|
|
additions. Primary of these being:</p>
|
|
<ul>
|
|
<li>PoW datatype now offers a constructor</li>
|
|
<li>Salt is no longer hard coded into the library, users can provide
|
|
unique salts.</li>
|
|
</ul>
|
|
<p>Other small changes have also been included of various importance but
|
|
mostly just stylistic/ease of use improvements.</p>
|
|
<h2 id="versions">Versions</h2>
|
|
<ul>
|
|
<li><a href="https://mcaptcha.github.io/pow_sha256/pow_sha256/index.html">master-branch</a></li>
|
|
<li><a href="/api-docs/pow_sha256/0.2.1/pow_sha256/index.html">0.2.1</a></li>
|
|
<li><a href="/api-docs/pow_sha256/0.2.0/pow_sha256/index.html">0.2.0</a></li>
|
|
<li><a href="/api-docs/pow_sha256/0.1.0/pow_sha256/index.html">0.1.0</a></li>
|
|
</ul>
|
|
<h2 id="changelog">Changelog</h2>
|
|
<p>Changelog is available at the project’s
|
|
<a href="https://github.com/mCaptcha/pow_sha256/blob/master/CHANGELOG.md">repository</a></p>
|
|
`},{id:10,href:"/docs/help/faq/",title:"FAQ",description:"Answers to frequently asked questions.",content:`<p>Coming soon</p>
|
|
`},{id:11,href:"/docs/webmasters/terminology/",title:"Terminology",description:"Information about terminology used in mCaptcha, some of which unique to the project",content:`<h2 id="authorization-token">Authorization token</h2>
|
|
<p>When 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 authorization token.</p>
|
|
<p>This authorization token should be attached to the visitor’s requited to the
|
|
protected service and the protected service should validity of the
|
|
authorization token with the mCaptcha instance and only allow authorization to
|
|
protected resource if the authorization token is valid.</p>
|
|
<h2 id="cooldown-period">Cooldown Period</h2>
|
|
<p>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.</p>
|
|
<p>For 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.</p>
|
|
<h2 id="difficulty-factor">Difficulty Factor</h2>
|
|
<p>Difficulty 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.</p>
|
|
<p>mCaptcha’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.</p>
|
|
<h2 id="sitekey">Sitekey</h2>
|
|
<p>Site key is a unique identifier associated with CAPTCHA configurations
|
|
created on mCaptcha. It is required to integrate a CAPTCHA with your
|
|
website.</p>
|
|
<h2 id="visitor-threshold">Visitor Threshold</h2>
|
|
<p>mCaptcha’s variable difficulty factor mechanism requires a website’s traffic
|
|
statistics be split into levels, so that it can deploy the right
|
|
difficulty factor for each level.</p>
|
|
<p>Visitor 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.</p>
|
|
<p>For instance, consider the configuration given below:</p>
|
|
<ul>
|
|
<li>Cool down period: 30 seconds</li>
|
|
</ul>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Level</th>
|
|
<th>Difficulty Factor</th>
|
|
<th>Visitor Threshold</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>5,000</td>
|
|
<td>2,000</td>
|
|
</tr>
|
|
<tr>
|
|
<td>2</td>
|
|
<td>50,000</td>
|
|
<td>5,000</td>
|
|
</tr>
|
|
<tr>
|
|
<td>3</td>
|
|
<td>500,000</td>
|
|
<td>10,000</td>
|
|
</tr>
|
|
<tr>
|
|
<td>4</td>
|
|
<td>5,000,000</td>
|
|
<td>15,000</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>If 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.</p>
|
|
<p>Visitor 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.</p>
|
|
`},{id:12,href:"/docs/webmasters/faq/",title:"Webmasters FAQ",description:"Frequently asked questions related to using mCaptcha as a webmaster",content:`<h3 id="easy-mode-default-cooldown-period">Easy Mode: Default cooldown period</h3>
|
|
<p>When configuring mCaptcha in <a href="/docs/webmasters/configuring-difficulty-factor/#easy-option">easy mode</a>, the default cooldown period is set to 30 seconds.</p>
|
|
<h2 id="how-to-get-site-key-from-dashboard">How to get site key from dashboard?</h2>
|
|
<ol>
|
|
<li>Go to “Site keys” on the side panel in the dashboard</li>
|
|
</ol>
|
|
<div align=center>
|
|
<figure>
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_20x0_resize_box_3.png" data-srcset="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_3.png 800w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_3.png 700w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_3.png 600w,/docs/webmasters/faq/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.">
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_800x0_resize_box_3.png 800w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_700x0_resize_box_3.png 700w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_600x0_resize_box_3.png 600w,/docs/webmasters/faq/sitekey-in-dashboard-sidepanel_hu437e619e92d9fef838a97af482e11285_26958_500x0_resize_box_3.png 500w" src="/docs/webmasters/faq/sitekey-in-dashboard-sidepanel.png" width="222" height="496" alt="Site key menu option on the dashboard, encircled in red."></noscript>
|
|
</figure>
|
|
</div>
|
|
<ol start="2">
|
|
<li>click on the clipboard button to copy the site key to your
|
|
clipboard.</li>
|
|
</ol>
|
|
<figure>
|
|
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_20x0_resize_box_3.png" data-srcset="/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_3.png 900w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_3.png 800w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_3.png 700w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_3.png 600w,/docs/webmasters/faq/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">
|
|
<noscript><img class="img-fluid" sizes="100vw" srcset="/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_900x0_resize_box_3.png 900w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_800x0_resize_box_3.png 800w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_700x0_resize_box_3.png 700w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_600x0_resize_box_3.png 600w,/docs/webmasters/faq/copy-sitekey_huf38748cca91d238810283a1abb694c9a_63890_500x0_resize_box_3.png 500w" src="/docs/webmasters/faq/copy-sitekey.png" width="1825" height="831" alt="Copy site key to clipboard. Clipboard button is highlighted in the photo"></noscript>
|
|
</figure>
|
|
`},{id:13,href:"/docs/help/",title:"Help",description:"Help mCaptcha.",content:""},{id:14,href:"/docs/webmasters/",title:"Webmasters",description:"Introduction to mCaptcha for webmasters",content:""},{id:15,href:"/docs/api/",title:"API",description:"Documentation for libraries used in mCaptcha",content:""},{id:16,href:"/docs/",title:"mCaptcha",description:"Docs mCaptcha",content:""},{id:17,href:"/docs/self-hosting/",title:"Self-Hosting",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}})() |