Plugin Directory

Changeset 3812633


Ignore:
Timestamp:
11/19/2026 10:36:17 PM (less than one hour ago)
Author:
xorred
Message:

1.1.44: instructions for sites behind Cloudflare. The Settings page and the notice say what the administrator's own page load shows and which setting, in the plugin or at Cloudflare, gives the plugin each visitor's own address. Address resolution unchanged.

Location:
atlant-security/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • atlant-security/trunk/admin/Admin.php

    r3812355 r3812633  
    421421        // notice is about the switch, so that one is dismissed as a whole.
    422422        $kind        = (string) $hint['kind'];
    423         $dismiss_key = 'cloudflare' === $kind ? 'cloudflare' : (string) $hint['remote'];
     423        // (A notice about the header Cloudflare did not send is another
     424        // matter from the one about the switch, and is dismissed apart.)
     425        $dismiss_key = 'cloudflare' === $kind ? 'cloudflare' : ( 'cloudflare_noheader' === $kind ? 'cloudflare-header' : (string) $hint['remote'] );
    424426        if ( (string) get_user_meta( get_current_user_id(), 'aswp_dismiss_proxy_notice', true ) === $dismiss_key ) {
    425427            return;
    … …  
    451453        $next = '';
    452454        if ( '' !== $via && ! empty( $hint['via_cloudflare'] ) ) {
    453             $next = 'On this request that is ' . $via . ', a Cloudflare address, so this site seems to be behind Cloudflare as well. In that case add Cloudflare\'s address ranges (published at www.cloudflare.com/ips) to the same list: <strong>Site is behind Cloudflare</strong> does not cover this setup, because it reads Cloudflare\'s header only on requests that reach WordPress straight from a Cloudflare address. ';
     455            $next = 'On this request that is ' . $via . ', a Cloudflare address, so this site seems to be behind Cloudflare as well. In that case add Cloudflare\'s address ranges (published at www.cloudflare.com/ips) to the same list: <strong>Site is behind Cloudflare</strong> does not cover this setup, because it reads Cloudflare\'s header only on requests that reach WordPress straight from a Cloudflare address. '
     456                  . 'The other way is to have the proxy that Cloudflare connects to put the visitor\'s address back and pass it on (' . self::CLOUDFLARE_RESTORE_LINK . ' has the lines for nginx and Apache; they belong on that proxy). ';
    454457        } elseif ( '' !== $via ) {
    455458            $next = 'On this request that is ' . $via . '. If that is not your own IP address but another proxy or load balancer in front of this site, list it as well. ';
    … …  
    460463                  . 'So the plugin took ' . $remote . ' for your address. Every visitor who comes through Cloudflare has the address of a Cloudflare server in the same way: the rate limits count those who share one together, and one login lockout or automatic block refuses them all. '
    461464                  . 'If this site is behind Cloudflare, switch it on: the plugin then reads each visitor\'s own address from that header, and only on requests that come from Cloudflare\'s addresses. '
    462                   . 'With the switch on, a request from this server\'s own address is no longer let through automatically.';
     465                  . 'With the switch on, a request from this server\'s own address is no longer let through automatically. '
     466                  . 'Nothing has to be set up at Cloudflare for this: it sends that header with every request.'
     467                  . self::cloudflare_whitelist_note();
    463468            $enable = wp_nonce_url( add_query_arg( 'aswp_enable_cloudflare', '1' ), 'aswp_enable_cloudflare' );
     469        } elseif ( 'cloudflare_noheader' === $kind ) {
     470            $text = 'the page you just opened came from ' . $remote . ', a Cloudflare address, but without an address in the ' . $header . ' header, in which Cloudflare passes on each visitor\'s own address. '
     471                  . 'Without it the plugin cannot tell the visitors who come through Cloudflare apart, whatever <strong>Site is behind Cloudflare</strong> is set to: each has the address of a Cloudflare server, the rate limits count those who share one together, and one login lockout or automatic block refuses them all. '
     472                  . 'Cloudflare sends that header unless it was told not to. In the Cloudflare dashboard, open <strong>Rules &gt; Settings &gt; Managed Transforms</strong> and see that <strong>Remove visitor IP headers</strong> is off; then look through your Transform Rules for one that removes the header. Reload this page afterwards.';
     473            $button = false;
    464474        } elseif ( 'local' === $kind ) {
    465475            $text = 'the page you just opened reached WordPress from this server itself (' . $remote . '), with another address in the ' . $header . ' header: a proxy on this server stands in front of WordPress. '
    … …  
    488498        ?>
    489499        <div class="notice notice-warning">
    490             <p><strong><?php echo esc_html( aswp_brand_name() ); ?>:</strong> <?php echo wp_kses( $text, [ 'code' => [], 'strong' => [] ] ); ?></p>
     500            <p><strong><?php echo esc_html( aswp_brand_name() ); ?>:</strong> <?php echo wp_kses( $text, [ 'code' => [], 'strong' => [], 'a' => [ 'href' => [], 'target' => [], 'rel' => [] ] ] ); ?></p>
    491501            <p>
    492502                <?php if ( '' !== $enable ) : ?>
    … …  
    502512    }
    503513
    504     /** The "Dismiss" link of proxy_notice(): remembered per administrator and per proxy address ("cloudflare" for that notice). */
     514    /** Cloudflare's guide to having the web server put the visitor's address back (mod_remoteip, ngx_http_realip_module). */
     515    public const CLOUDFLARE_RESTORE_LINK = '<a href="https://developers.cloudflare.com/support/troubleshooting/restoring-visitor-ips/restoring-original-visitor-ips/" target="_blank" rel="noopener noreferrer">Cloudflare\'s guide "Restoring original visitor IPs"</a>';
     516
     517    /**
     518     * A sentence for an administrator about to switch "Site is behind
     519     * Cloudflare" on: an IP Whitelist entry that is a Cloudflare server was
     520     * meant to be the administrator (the plugin saw that address when "my
     521     * IP" was whitelisted), and stops covering them the moment the plugin
     522     * reads their own. '' when there is no such entry.
     523     *
     524     * @param array|null $status Whitelist::cloudflare_status(), when the caller has it.
     525     */
     526    public static function cloudflare_whitelist_note( ?array $status = null ): string {
     527        if ( null === $status ) {
     528            $status = is_callable( [ '\\FortressWP\\Whitelist', 'cloudflare_status' ] ) ? \FortressWP\Whitelist::cloudflare_status() : [];
     529        }
     530        $rows = array_map( 'esc_html', (array) ( $status['edge_rows'] ?? [] ) );
     531        if ( ! $rows ) {
     532            return '';
     533        }
     534        $own = '' !== ( $status['visitor'] ?? '' ) ? ' (<code>' . esc_html( (string) $status['visitor'] ) . '</code>)' : '';
     535        return ' Your IP Whitelist holds <code>' . implode( '</code>, <code>', $rows ) . '</code>: '
     536            . ( 1 === count( $rows ) ? 'that is a Cloudflare server' : 'those are Cloudflare servers' )
     537            . ', not you. ' . ( 'working' === ( $status['state'] ?? '' ) ? 'The plugin sees your own address' : 'With the switch on the plugin sees your own address' ) . $own . ', which '
     538            . ( ! empty( $status['visitor_listed'] )
     539                ? 'is on the list as well, so nothing more is needed; the Cloudflare ' . ( 1 === count( $rows ) ? 'entry' : 'entries' ) . ' can go.'
     540                : ( 1 === count( $rows ) ? 'that entry does' : 'those entries do' ) . ' not cover, so add your own address under <strong>IP Whitelist</strong> if you rely on being whitelisted (for the login page, for example).' );
     541    }
     542
     543    /**
     544     * The box under "Site is behind Cloudflare" on the Settings page: what
     545     * this page load shows about Cloudflare and what to do about it. Built
     546     * from the administrator's own request (Whitelist::cloudflare_status());
     547     * '' when the request carries no sign of Cloudflare.
     548     *
     549     * Every sentence has to be true for the address logic as it is: the
     550     * switch is offered only where it changes something (a request that
     551     * arrives straight from a Cloudflare address with the visitor's address
     552     * in the header), and "nothing to change" is said only where the plugin
     553     * did read the visitor's address.
     554     *
     555     * @param array|null $status For tests; read from the request when null.
     556     */
     557    public static function cloudflare_box( ?array $status = null ): string {
     558        if ( null === $status ) {
     559            $status = is_callable( [ '\\FortressWP\\Whitelist', 'cloudflare_status' ] ) ? \FortressWP\Whitelist::cloudflare_status() : [];
     560        }
     561        $state = (string) ( $status['state'] ?? 'none' );
     562        if ( 'none' === $state ) {
     563            return '';
     564        }
     565        $remote  = '<code>' . esc_html( (string) ( $status['remote'] ?? '' ) ) . '</code>';
     566        $visitor = '<code>' . esc_html( (string) ( $status['visitor'] ?? '' ) ) . '</code>';
     567        $used    = '<code>' . esc_html( (string) ( $status['used'] ?? '' ) ) . '</code>';
     568        $note    = self::cloudflare_whitelist_note( $status );
     569
     570        switch ( $state ) {
     571            case 'switch_off':
     572                $text = 'This page load came from ' . $remote . ', a Cloudflare server, and Cloudflare passed your own address on as ' . $visitor . ' in its <code>CF-Connecting-IP</code> header. The switch above is off, so the plugin used ' . $used . ': to it, every visitor who comes through Cloudflare is one of Cloudflare\'s servers, and a rate limit or a login lockout hits visitors together. '
     573                      . '<strong>Switch on "Site is behind Cloudflare", save, and reload this page.</strong> Nothing has to be set up at Cloudflare: it sends that header with every request.' . $note;
     574                break;
     575            case 'header_missing':
     576                $text = 'This page load came from ' . $remote . ', a Cloudflare server, but without an address in the <code>CF-Connecting-IP</code> header, in which Cloudflare passes on the visitor\'s address. Without it the plugin cannot tell visitors apart, whatever the switch above is set to: it used ' . $used . ' for this page load. '
     577                      . 'Cloudflare sends that header unless it was told not to: in the Cloudflare dashboard open <strong>Rules &gt; Settings &gt; Managed Transforms</strong> and see that <strong>Remove visitor IP headers</strong> is off, then look through your Transform Rules for one that removes the header. Reload this page afterwards.';
     578                break;
     579            case 'working':
     580                $text = 'This page load came through Cloudflare, and the plugin used your own address, ' . $visitor . ': the one Cloudflare reports for you. Nothing to change.' . $note;
     581                break;
     582            case 'behind_proxy':
     583                $text = 'This page load carried Cloudflare\'s headers but reached WordPress from ' . $remote . ': a proxy on this server or in its network stands between Cloudflare and WordPress. The switch above does not cover that (it reads Cloudflare\'s header only on requests that arrive straight from a Cloudflare address). For this page load the plugin used ' . $used . '. '
     584                      . 'Two things then have to be right. The proxy that Cloudflare connects to has to take the visitor\'s address from Cloudflare: ' . self::CLOUDFLARE_RESTORE_LINK . ' has the lines for nginx (<code>real_ip_header CF-Connecting-IP</code> with <code>set_real_ip_from</code> for each of Cloudflare\'s ranges) and for Apache (<code>mod_remoteip</code>); they belong on that proxy, not on the server behind it. '
     585                      . 'And that proxy has to hand the address on to WordPress. How depends on the server, so ask your host, or see Reverse-Proxy / Load-Balancer below: list a proxy there only if it is your own and sets the <code>X-Forwarded-For</code> header itself, because a proxy that passes on whatever a visitor sent lets any visitor choose the address the plugin sees.';
     586                break;
     587            default: // 'elsewhere'
     588                $has_visitor = '' !== (string) ( $status['visitor'] ?? '' );
     589                $same        = $has_visitor && (string) $status['visitor'] === (string) ( $status['used'] ?? '' );
     590                $text        = 'This page load carried Cloudflare\'s headers and reached WordPress from ' . $remote . ( ! empty( $status['from_edge'] ) ? ', a Cloudflare server' : ', which is not a Cloudflare address' ) . '. The plugin used ' . $used . ' for it'
     591                      . ( $has_visitor ? ', and Cloudflare reports your address as ' . $visitor . '. ' : '. ' )
     592                      . ( $same
     593                          ? 'The two are the same. Nothing to change.'
     594                          : 'If the address the plugin used is not your own, another proxy stands between Cloudflare and WordPress, or one that is listed under Reverse-Proxy / Load-Balancer below leads the plugin to another address. See that panel, or have the proxy that Cloudflare connects to put the visitor\'s address back as ' . self::CLOUDFLARE_RESTORE_LINK . ' describes.' );
     595        }
     596
     597        return '<div class="aswp-notice ' . ( 'working' === $state ? 'aswp-notice--success' : 'aswp-notice--info' ) . '" id="aswp-cloudflare-status" style="margin:4px 0 14px">'
     598            . '<strong>Behind Cloudflare:</strong> '
     599            . wp_kses( $text, [ 'code' => [], 'strong' => [], 'a' => [ 'href' => [], 'target' => [], 'rel' => [] ] ] )
     600            . '</div>';
     601    }
     602
     603    /** The "Dismiss" link of proxy_notice(): remembered per administrator and per proxy address ("cloudflare" and "cloudflare-header" for those two notices). */
    505604    public function maybe_dismiss_proxy_notice(): void {
    506605        if ( ! isset( $_GET['aswp_dismiss_proxy'] ) || ! current_user_can( 'manage_options' ) ) {
    … …  
    510609
    511610        $remote = sanitize_text_field( wp_unslash( (string) $_GET['aswp_dismiss_proxy'] ) );
    512         if ( 'cloudflare' === $remote || false !== filter_var( $remote, FILTER_VALIDATE_IP ) ) {
     611        if ( in_array( $remote, [ 'cloudflare', 'cloudflare-header' ], true ) || false !== filter_var( $remote, FILTER_VALIDATE_IP ) ) {
    513612            update_user_meta( get_current_user_id(), 'aswp_dismiss_proxy_notice', $remote );
    514613        }
  • atlant-security/trunk/admin/views/settings.php

    r3812355 r3812633  
    143143            <p class="aswp-desc" style="margin:0 0 12px">Cloudflare in front of the site, and search-engine crawlers that are let through the WAF, rate limiter and IP block list. A crawler is trusted only when the request comes from an address the company publishes for its own crawlers and also identifies as one; a server rented in Google Cloud or Azure is not. The address lists are built into the plugin, and each one is refreshed weekly while its switch is on.</p>
    144144            <?php aswp_toggle( 'aswp_cloudflare_integration', 'Site is behind Cloudflare',   'Switch on when Cloudflare is in front of this site. The plugin then reads each visitor\'s address from Cloudflare\'s CF-Connecting-IP header, on requests that arrive from a Cloudflare address only, and refreshes Cloudflare\'s address list every week. With the switch on, a request from this server\'s own address is no longer trusted automatically. With it off, every visitor who comes through Cloudflare has the address of a Cloudflare server, so rate limits and lockouts hit those visitors together. Leave it off on a site that is not behind Cloudflare.' ); ?>
     145            <?php
     146            // What this page load shows about Cloudflare, and what to do
     147            // about it (1.1.44): nothing when the request carries no sign
     148            // of Cloudflare.
     149            if ( is_callable( [ '\FortressWP\Admin\Admin', 'cloudflare_box' ] ) ) {
     150                echo \FortressWP\Admin\Admin::cloudflare_box(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built from escaped parts and passed through wp_kses() there
     151            }
     152            ?>
    145153            <?php aswp_toggle( 'aswp_google_integration',     'Trust Google\'s crawlers',     'Googlebot, AdsBot, Google\'s other crawlers and FeedFetcher, from the address lists Google publishes for them' ); ?>
    146154            <?php aswp_toggle( 'aswp_microsoft_integration',  'Trust Bing\'s crawler',        'Bingbot and Microsoft\'s other search crawlers, from the address list Bing publishes' ); ?>
  • atlant-security/trunk/atlant-security.php

    r3812355 r3812633  
    44 * Plugin URI:  https://atlantsecurity.com/learn/we-are-releasing-the-best-security-plugin-for-wordpress-in-existence/
    55 * Description: Enterprise-grade WordPress security by Atlant Security. WAF, brute-force protection, real-time visitor log, IP blocking, bot detection, malware scanner, 2FA, and post-breach recovery.
    6  * Version:     1.1.43
     6 * Version:     1.1.44
    77 * Author:      Atlant Security
    88 * Author URI:  https://atlantsecurity.com
    … …  
    3636
    3737// ─── Constants ────────────────────────────────────────────────────────────────
    38 define( 'ASWP_VERSION',   '1.1.43' );
     38define( 'ASWP_VERSION',   '1.1.44' );
    3939define( 'ASWP_FILE',      __FILE__ );
    4040define( 'ASWP_DIR',       plugin_dir_path( __FILE__ ) );
  • atlant-security/trunk/includes/Whitelist.php

    r3812355 r3812633  
    170170     *                            with CF-Connecting-IP, and "Site is behind
    171171     *                            Cloudflare" is off,
     172     *               'cloudflare_noheader' it came from a Cloudflare address
     173     *                            without a usable CF-Connecting-IP (removed
     174     *                            at Cloudflare), whatever the switch says,
    172175     *               'local'      it came from this server itself with an
    173176     *                            X-Forwarded-For naming another address, and
    … …  
    201204            return [];
    202205        }
     206        return self::proxy_hint_for_request();
     207    }
     208
     209    /**
     210     * What the administrator's own page load shows about Cloudflare, for the
     211     * box under "Site is behind Cloudflare" on the Settings page (1.1.44).
     212     *
     213     * Like proxy_hint() it reads the request being served and the settings,
     214     * stores nothing, and has no say in which address the plugin uses: that
     215     * is RequestLogger::get_real_ip(), unchanged. It is only ever called
     216     * while a page is drawn for an administrator.
     217     *
     218     *   'state'   => 'none'           no Cloudflare address and no Cloudflare header on this request
     219     *                'switch_off'     from a Cloudflare address, with the visitor's address in
     220     *                                 CF-Connecting-IP, and the switch is off: the one case the switch is for
     221     *                'header_missing' from a Cloudflare address, without a usable CF-Connecting-IP
     222     *                'working'        the plugin used the very address Cloudflare reports for the
     223     *                                 visitor, by whatever route (the switch, a listed proxy, a web
     224     *                                 server that puts the address back)
     225     *                'behind_proxy'   Cloudflare's headers, but the request reached WordPress from this
     226     *                                 server or its network: a proxy stands between; the switch does nothing here
     227     *                'elsewhere'      Cloudflare's headers, from a public address that is not Cloudflare's
     228     *   'remote'  => REMOTE_ADDR, normalized
     229     *   'visitor' => the address in CF-Connecting-IP, or ''
     230     *   'used'    => what get_real_ip() answered for this request
     231     *   'switch'  => whether "Site is behind Cloudflare" is on
     232     *   'edge_rows' => IP Whitelist entries that are Cloudflare addresses (at most 5, among the
     233     *                  2,000 newest): "my IP" whitelisted while the plugin saw a Cloudflare
     234     *                  server. Not the visitor's own address, should that lie in Cloudflare's ranges.
     235     *   'visitor_listed' => whether the visitor's own address is on the IP Whitelist
     236     *   'from_edge' => whether REMOTE_ADDR is a Cloudflare address
     237     *
     238     * @return array{state:string,remote:string,visitor:string,used:string,switch:bool,edge_rows:string[],visitor_listed:bool}
     239     */
     240    public static function cloudflare_status(): array {
     241        $out = [ 'state' => 'none', 'remote' => '', 'visitor' => '', 'used' => '', 'switch' => (bool) get_option( 'aswp_cloudflare_integration', false ), 'edge_rows' => [], 'visitor_listed' => false, 'from_edge' => false ];
     242        if ( ! class_exists( 'FortressWP\\RequestLogger' ) ) {
     243            return $out;
     244        }
     245        // phpcs:disable WordPress.Security.ValidatedSanitizedInput -- addresses are normalized (or dropped); the other headers are only tested for being there
     246        $remote  = RequestLogger::normalize_ip( isset( $_SERVER['REMOTE_ADDR'] ) ? (string) wp_unslash( $_SERVER['REMOTE_ADDR'] ) : '' );
     247        $visitor = RequestLogger::normalize_ip( isset( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ? (string) wp_unslash( $_SERVER['HTTP_CF_CONNECTING_IP'] ) : '' );
     248        $signs   = ! empty( $_SERVER['HTTP_CF_CONNECTING_IP'] ) || self::request_was_proxied_by_cloudflare();
     249        // phpcs:enable
     250        $out['remote']  = $remote;
     251        $out['visitor'] = $visitor;
     252        $out['used']    = RequestLogger::get_real_ip();
     253        if ( '' === $remote ) {
     254            return $out;
     255        }
     256
     257        $used      = $out['used'];
     258        $from_edge = self::is_cloudflare_ip( $remote );
     259        $out['from_edge'] = $from_edge;
     260        $proxied   = self::request_was_proxied_by_cloudflare();
     261        if ( ! $from_edge && ! $signs ) {
     262            return $out;
     263        }
     264        if ( '' !== $visitor && $used === $visitor && ! ( $from_edge && $visitor === $remote ) ) {
     265            // The plugin used the address Cloudflare reports, however it got it.
     266            $out['state'] = 'working';
     267        } elseif ( $from_edge ) {
     268            if ( '' !== $visitor && $visitor !== $remote ) {
     269                // Not used although it is there: the switch is off (and the
     270                // plugin took the Cloudflare server), or a listed proxy led
     271                // it to some other address.
     272                $out['state'] = $used === $remote ? 'switch_off' : 'elsewhere';
     273            } elseif ( '' === $visitor && $proxied ) {
     274                $out['state'] = $used === $remote ? 'header_missing' : 'elsewhere';
     275            }
     276        } else {
     277            $out['state'] = ( self::is_loopback_ip( $remote ) || self::is_private_ip( $remote ) ) ? 'behind_proxy' : 'elsewhere';
     278        }
     279        if ( 'none' === $out['state'] ) {
     280            return $out;
     281        }
     282
     283        // IP Whitelist entries that are Cloudflare servers. One query for
     284        // the newest 2,000 entries, on a page drawn for an administrator.
     285        global $wpdb;
     286        $ranges = self::get_cloudflare_ranges();
     287        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- security data must not be served from cache
     288        $rows = $wpdb->get_results( $wpdb->prepare(
     289            "SELECT value FROM {$wpdb->prefix}aswp_whitelist WHERE type = %s ORDER BY created_at DESC LIMIT 2000",
     290            'ip'
     291        ) );
     292        foreach ( (array) $rows as $row ) {
     293            $ip = RequestLogger::normalize_ip( (string) ( $row->value ?? '' ) );
     294            if ( '' === $ip ) {
     295                continue;
     296            }
     297            if ( '' !== $visitor && $ip === $visitor ) {
     298                $out['visitor_listed'] = true;
     299                continue;
     300            }
     301            if ( count( $out['edge_rows'] ) >= 5 ) {
     302                continue;
     303            }
     304            foreach ( $ranges as $range ) {
     305                if ( self::ip_in_cidr( $ip, (string) $range ) ) {
     306                    $out['edge_rows'][] = $ip;
     307                    break;
     308                }
     309            }
     310        }
     311        return $out;
     312    }
     313
     314    /**
     315     * Did Cloudflare proxy this request? By the headers it adds to every
     316     * request it forwards and that no rule in a Cloudflare account takes
     317     * off: its request id, and its mark in CDN-Loop. (Only ever asked about
     318     * an administrator's own page load, to choose what to tell them.)
     319     */
     320    private static function request_was_proxied_by_cloudflare(): bool {
     321        // phpcs:disable WordPress.Security.ValidatedSanitizedInput -- only tested for being there
     322        return ! empty( $_SERVER['HTTP_CF_RAY'] )
     323            || ( isset( $_SERVER['HTTP_CDN_LOOP'] ) && false !== stripos( (string) wp_unslash( $_SERVER['HTTP_CDN_LOOP'] ), 'cloudflare' ) );
     324        // phpcs:enable
     325    }
     326
     327    /** proxy_hint() without the class check (kept apart so that the check stays first). */
     328    private static function proxy_hint_for_request(): array {
    203329        // phpcs:disable WordPress.Security.ValidatedSanitizedInput -- addresses are normalized (or dropped) below
    204330        $remote = RequestLogger::normalize_ip( isset( $_SERVER['REMOTE_ADDR'] ) ? (string) wp_unslash( $_SERVER['REMOTE_ADDR'] ) : '' );
    … …  
    274400            if ( '' !== $visitor && $visitor !== $remote && ! get_option( 'aswp_cloudflare_integration', false ) ) {
    275401                return $hint( 'cloudflare', 'CF-Connecting-IP' );
     402            }
     403            // No header to read (1.1.44): Cloudflare sends it on every
     404            // request unless a rule in the Cloudflare account removes it,
     405            // and then the switch cannot help. Until this was said the
     406            // plugin saw one Cloudflare server after another and nothing
     407            // explained why. Only when the request was proxied by
     408            // Cloudflare, which its request id shows: an administrator on
     409            // Cloudflare's own VPN reaches a site that is not behind
     410            // Cloudflare from a Cloudflare address too, with neither header.
     411            if ( '' === $visitor && self::request_was_proxied_by_cloudflare() ) {
     412                return $hint( 'cloudflare_noheader', 'CF-Connecting-IP' );
    276413            }
    277414            return [];
  • atlant-security/trunk/readme.txt

    r3812355 r3812633  
    66Tested up to: 7.1
    77Requires PHP: 8.0
    8 Stable tag: 1.1.43
     8Stable tag: 1.1.44
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    289289
    290290== Changelog ==
     291
     292= 1.1.44 - Instructions for Sites Behind Cloudflare =
     293* New: when your own page load shows that the site is behind Cloudflare, Settings now says under "Site is behind Cloudflare" what the plugin saw and what to do. If the switch is off, it tells you to switch it on: Cloudflare sends each visitor's address with every request, and nothing has to be set up there. If Cloudflare is not sending that address, it names the Cloudflare setting to check (Rules > Settings > Managed Transforms > Remove visitor IP headers). If another proxy on your server stands between Cloudflare and WordPress, it links to Cloudflare's guide for nginx and Apache. Where everything already works, it says so.
     294* New: the same notice now warns when your IP Whitelist holds a Cloudflare server instead of your own address, which stops covering you once the plugin sees your real address.
     295* Unchanged: how a visitor's address is worked out. This release only adds instructions.
    291296
    292297= 1.1.43 - Audit Fixes, Part 2 =
    … …  
    439444== Upgrade Notice ==
    440445
     446= 1.1.44 =
     447Adds instructions for sites behind Cloudflare: the Settings page says what the plugin sees on your own page load and which setting, here or at Cloudflare, gives it each visitor's own address.
     448
    441449= 1.1.43 =
    442450Security fixes to the firewall, malware scanner, two-factor login and multisite, from a full code audit. Two things work differently: forced password reset and trusted crawlers. See the changelog.
Note: See TracChangeset for help on using the changeset viewer.