Product » Knowledge Base » reCAPTCHA Integration

Protecting the Xeams Login Page with Google reCAPTCHA

Overview

Automated login attacks — bots that repeatedly try username and password combinations — are one of the most common threats facing any internet-facing application. Xeams can protect its administrator login page by integrating with Google reCAPTCHA, requiring every login attempt to pass a challenge that is easy for humans but hard for bots.

Two variants are supported:

  • Legacy reCAPTCHA v2 Invisible — runs silently in the background when the user clicks Sign in. No checkbox or image puzzle is shown; the reCAPTCHA badge appears in the corner of the page but requires no interaction from the user.
  • reCAPTCHA Enterprise — Google’s cloud-based fraud-detection service that runs invisibly in the background and provides a risk score for each login attempt.

Prerequisites

Before enabling reCAPTCHA in Xeams you need a Google account and a registered reCAPTCHA site:

  1. Go to the Google reCAPTCHA Admin Console and sign in with your Google account.
  2. Register a new site. Choose Score based (v3)
  3. Add the domain name of your Xeams server (for example mail.example.com) to the allowed domains list.
  4. Google will provide a Site Key (used in the browser) and a Secret Key (used by the server). Keep the Secret Key private.
  5. For Enterprise, also note your Google Cloud Project ID.

Enabling reCAPTCHA in Xeams

  1. Log in to the Xeams web interface as an administrator.
  2. Navigate to Server Configuration → Google reCAPTCHA.
  3. Check Enable Google reCAPTCHA.
  4. Paste your Site Key and Secret Key into the corresponding fields.
  5. If you are using the Enterprise API, also check Use Enterprise reCAPTCHA and enter your Google Cloud Project ID.
  6. Click Save. The login page will immediately require a reCAPTCHA challenge for all subsequent login attempts.
Two-factor authentication and SSO are not affected. When a user has already passed the initial password check and is prompted for a one-time code (2FA), or when logging in through Microsoft or Google SSO, the reCAPTCHA challenge is skipped automatically.

Legacy vs. Enterprise — Which Should You Choose?

Legacy reCAPTCHA v2 Invisible reCAPTCHA Enterprise
User experience Invisible; fires automatically on Sign in click — no user interaction Fully invisible; no user interaction required
Setup complexity Low — just a Site Key and Secret Key Higher — requires a Google Cloud project
Cost Free up to usage limits Pay-per-use above the free tier
Detection quality Good Excellent — risk-score based
Best for Most installations High-security or high-volume environments

Recovering Access When reCAPTCHA Is Misconfigured

If a reCAPTCHA key expires, is deleted from Google, or is misconfigured, every login attempt will fail with a verification error — including the administrator’s. Xeams provides an emergency escape hatch to recover access without having to restart the server or edit configuration files directly.

Use this procedure only when you cannot log in due to a reCAPTCHA failure. It temporarily bypasses the challenge for one login session so you can fix the configuration.

Steps to Temporarily Disable reCAPTCHA

  1. On the machine where Xeams is installed, create an empty file named disable_captcha.txt in the Xeams home directory (the directory from which Xeams is run, typically C:\Xeams on Windows or /opt/xeams on Linux).

    Windows (run Command Prompt as Administrator):
    echo. > "C:\Xeams\disable_captcha.txt"
    Linux:
    touch /opt/xeams/disable_captcha.txt
  2. Restart Xeams. The file is checked once at startup when the internal handler is first initialized. Without a restart the change will not take effect.
  3. Open the Xeams login page and log in normally. The reCAPTCHA challenge will not appear and the login will succeed.
  4. Xeams automatically deletes disable_captcha.txt as soon as it is detected, so reCAPTCHA will be required again on all subsequent login attempts. This is a one-shot escape hatch.
  5. Once logged in, navigate to Server Configuration → Google reCAPTCHA and correct the Site Key, Secret Key, or Project ID, or disable reCAPTCHA entirely until new keys are obtained.
Why a restart is required. Xeams checks for disable_captcha.txt once at startup. The result is cached for the lifetime of the process, so the file must be in place before Xeams starts. The file is deleted automatically during startup, so the bypass applies to that one running session only and will not carry over to any subsequent restart.

Security Considerations

  • Keep your Secret Key confidential. It should only ever appear in the Xeams server configuration, never in client-side code or public repositories.
  • Restrict the allowed domains in the Google reCAPTCHA Admin Console to exactly the hostname(s) used to access Xeams. Wildcard domains unnecessarily broaden the attack surface.
  • The disable_captcha.txt escape hatch requires filesystem access to the server. If an attacker already has filesystem access, reCAPTCHA is not your primary line of defence. Protect server access with strong OS-level controls.
  • Monitor your Google reCAPTCHA dashboard for unusual traffic patterns. A sudden spike in failed challenges may indicate an ongoing automated attack.
  • Rotate your reCAPTCHA keys periodically and whenever a key may have been exposed.