MESSAGE
DATE | 2020-12-22 |
FROM | Mithun Bhattacharya
|
SUBJECT | Re: [Hangout - NYLXS] Confused about two development utils
|
From hangout-bounces-at-nylxs.com Fri Jan 1 11:10:11 2021 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www2.mrbrklyn.com (www2.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 69E2F164042; Fri, 1 Jan 2021 11:10:11 -0500 (EST) X-Original-To: hangout-at-www2.mrbrklyn.com Delivered-To: hangout-at-www2.mrbrklyn.com Received: by mrbrklyn.com (Postfix, from userid 1000) id D6100164043; Fri, 1 Jan 2021 11:08:55 -0500 (EST) Resent-From: Ruben Safir Resent-Date: Fri, 1 Jan 2021 11:08:55 -0500 Resent-Message-ID: <20210101160855.GY15013-at-www2.mrbrklyn.com> Resent-To: hangout-at-mrbrklyn.com X-Original-To: ruben-at-mrbrklyn.com Delivered-To: ruben-at-mrbrklyn.com Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) by mrbrklyn.com (Postfix) with ESMTP id CFFDC16400C for ; Tue, 22 Dec 2020 20:30:43 -0500 (EST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 53351669AF for ; Wed, 23 Dec 2020 01:30:42 +0000 (UTC) Received: (qmail 8104 invoked by uid 500); 23 Dec 2020 01:30:41 -0000 Mailing-List: contact modperl-help-at-perl.apache.org; run by ezmlm Precedence: bulk Delivered-To: mailing list modperl-at-perl.apache.org Received: (qmail 8093 invoked by uid 99); 23 Dec 2020 01:30:40 -0000 Received: from spamproc1-he-de.apache.org (HELO spamproc1-he-de.apache.org) (116.203.196.100) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Dec 2020 01:30:40 +0000 Received: from localhost (localhost [127.0.0.1]) by spamproc1-he-de.apache.org (ASF Mail Server at spamproc1-he-de.apache.org) with ESMTP id CA6C01FF3A1 for ; Wed, 23 Dec 2020 01:30:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamproc1-he-de.apache.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.2, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamproc1-he-de.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-he-de.apache.org ([116.203.227.195]) by localhost (spamproc1-he-de.apache.org [116.203.196.100]) (amavisd-new, port 10024) with ESMTP id 6-Xi5bO-3rvo for ; Wed, 23 Dec 2020 01:30:39 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::929; helo=mail-ua1-x929.google.com; envelope-from=mithnb-at-gmail.com; receiver= Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) by mx1-he-de.apache.org (ASF Mail Server at mx1-he-de.apache.org) with ESMTPS id B018F7F9E1 for ; Wed, 23 Dec 2020 01:30:38 +0000 (UTC) Received: by mail-ua1-x929.google.com with SMTP id w7so4958945uap.13 for ; Tue, 22 Dec 2020 17:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=8xulMJ8TGZfedcgM1gkkUUNFxA6c/NK2MFOEcx8/R/4=; b=tg9dPyGgpc+LydedH6ghV/iFvMPSFGS3JoOT8InO9I5h9lPJSQsH4NoG6Kk5D3RZnx +WCIaRg2puvDDxCqvg2fc/pVweZxw9Y09rfr6XWOIGP3e6coyzRIv/pb1aMgFobYqlVf 7S9RUCZkpkm4VrmIFiOAMLqc/Z4nNtx20+NLnZg/hMt/2aCeMuPp7cYIPXbgCHtIT5nG nXDyEcwWweeETAImsA4pz2lRwBy8ACAjurlJ/QhH+RFwseebJw0oKVAIjXhJ4A+LRLg5 LyB8JF2Og9ZLFz8I11mBNlcAu7/dQnPjiGduRG3SZolnIQ2O6a1gWVO3Vq9G2MbYmEj2 zDEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=8xulMJ8TGZfedcgM1gkkUUNFxA6c/NK2MFOEcx8/R/4=; b=N+UVJCJUSKhJoxUpSjrPyxWBfBvs+suKLLOoUMBkbIRFsV1f8kxxT6A2Lyw2AH6BTD kjrKodmBEj4EzjVYRUcgC2SMQ4MUjozh1QFD/w2h930N67EoX5qt81IPHqX2jk+3039P w+m8DR+TedIFB70UrDeHMsbFMZgZgBpPAJpQzK10MXiyy5sCycylcCKcB6I9eb9AnAAo 77RctW5MOWZuGCR2GIvfAiDgKmOpoZnUUhZxBG4DF9VKBFW3/tnrQ7faEM0GvuxbtA/1 gwbMdyyDZ8sRZ6rmyaUyKMRl/oKVTB88yHCyYgQJSzbkJEGx7aGB+4YyrL6iZbYEYtyb KU/g== X-Gm-Message-State: AOAM530WKlsGXi96m+IYB5nkPe7l4iLr0nBUk5b+B3f7haKp54ln7kDU 06bL+67IXCRLW/7h/tqa/jtmFGLIXEwltjs766A5Z+Yz8sI= X-Google-Smtp-Source: ABdhPJzun4HdeiuPduWBio+4AmAARKm9Yn6PTYmBzoxNgHad/UWZIpxjKgVtjLxm00igf54dII3Aws4o3tLkEWvF0iI= X-Received: by 2002:ab0:6703:: with SMTP id q3mr17037040uam.93.1608687031255; Tue, 22 Dec 2020 17:30:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Mithun Bhattacharya Date: Tue, 22 Dec 2020 19:30:20 -0600 Message-ID: To: mod_perl list Subject: Re: [Hangout - NYLXS] Confused about two development utils X-BeenThere: hangout-at-nylxs.com X-Mailman-Version: 2.1.30rc1 List-Id: NYLXS Tech Talk and Politics List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1050259342==" Errors-To: hangout-bounces-at-nylxs.com Sender: "Hangout"
--===============1050259342== Content-Type: multipart/alternative; boundary="0000000000000d879905b717a37d"
--0000000000000d879905b717a37d Content-Type: text/plain; charset="UTF-8"
8.8.8.8 is google's public DNS server - yah they can handle whatever you throw at them but you shouldnt misuse it. The whole point of TTL in DNS is for suggested caching - you are welcome to ignore it but you are also being rude to others.
$r->connection->client_ip is the IP your apache server is seeing you come through which I assume is CloudFlare - I have no idea how to see the real ip behind cloudflare.
On Tue, Dec 22, 2020 at 7:19 PM Matthias Peng wrote:
> Thanks Mithun. > 1. Since the query is passed through cloudflare, so a CF- header is wanted > for fetching client's real IP. > 2. Since I am querying PTR via a stub resolver (such as 8.8.8.8), I guess > this public dns server has already cached the result. right? > > Regards. > > > On Wed, Dec 23, 2020 at 9:08 AM Mithun Bhattacharya > wrote: > >> Replying to the DL. >> >> On Tue, Dec 22, 2020 at 7:07 PM Mithun Bhattacharya >> wrote: >> >>> $r->connection->client_ip would report your proxy server if you have a >>> reverse proxy setup - this is not a common use case though. >>> >>> DNS lookup would usually be an expensive process and you are supposed to >>> be nice to other services so cache it for the TTL of the PTR record. >>> >>> On Tue, Dec 22, 2020 at 6:44 PM Matthias Peng >>> wrote: >>> >>>> I am a newbie to mp development stack. >>>> After one day of work, I have made a simple handler, which returns the >>>> client's address and its PTR record. >>>> The demo: >>>> https://myhostnames.com/ >>>> >>>> The code shown below: >>>> >>>> package MyHostname; >>>> >>>> >>>> use strict; >>>> >>>> use Net::DNS; >>>> >>>> use Apache2::RequestRec (); >>>> >>>> use Apache2::RequestIO (); >>>> >>>> use Apache2::Connection (); >>>> >>>> use APR::Table (); >>>> >>>> use Apache2::Const -compile => qw(OK FORBIDDEN); >>>> >>>> >>>> >>>> sub handler { >>>> >>>> >>>> my $r = shift; >>>> >>>> my $ip = $r->headers_in->{'CF-Connecting-IP'} || >>>> $r->connection->client_ip; >>>> >>>> >>>> my $host = dns_query($ip) || ""; >>>> >>>> >>>> $r->content_type('text/plain; charset=utf-8'); >>>> >>>> $r->print("Your IP: $ip, Hostname: $host"); >>>> >>>> >>>> return Apache2::Const::OK; >>>> >>>> } >>>> >>>> >>>> >>>> sub dns_query { >>>> >>>> my $ip = shift; >>>> >>>> my $resolver = Net::DNS::Resolver->new(); >>>> >>>> my $reply = $resolver->query($ip, 'PTR'); >>>> >>>> >>>> if ($reply) { >>>> >>>> for my $rr ($reply->answer) { >>>> >>>> return $rr->rdstring; # we need only one >>>> >>>> } >>>> >>>> } >>>> >>>> >>>> return; >>>> >>>> } >>>> >>>> >>>> >>>> 1; >>>> >>>> >>>> >>>> Can anyone give your review? Thanks in advance. >>>> >>>> >>>> Matthias >>>> >>>> >>>> >>>> >>>> On Tue, Dec 22, 2020 at 1:49 PM Matthias Peng >>>> wrote: >>>> >>>>> Hello >>>>> >>>>> I am developing a simple mp2 application. >>>>> I looked for the installation for mp2 utils, and found this two: >>>>> >>>>> libapache2-mod-perl2 >>>>> >>>>> libapache2-mod-apreq2 >>>>> >>>>> >>>>> what're their relations? Should I install both, or only the first one? >>>>> >>>>> >>>>> Thanks. >>>>> >>>>
--0000000000000d879905b717a37d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
8.8.8.8 is google's public DNS server - yah they can h= andle whatever you throw at them but you shouldnt=C2=A0misuse it. The whole= point of TTL in DNS is for suggested caching - you are welcome to ignore i= t but you are also being rude to others.
$r->connecti= on->client_ip is the IP your apache server is seeing you come through wh= ich I assume is CloudFlare - I have no idea how to see the real ip behind c= loudflare.
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">>Thanks=C2=A0Mithun. 1. Since the query is passed through cloudflare, s= o a CF- header is wanted for fetching client's real IP. 2. Si= nce I am querying PTR via a stub resolver (such as 8.8.8.8), I guess this p= ublic dns server has already cached the result. right?
= Regards.
dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 23, 2020 at 9:08 AM Mithun Bh= attacharya < mithnb= -at-gmail.com> wrote: =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex">Replying to the DL.
l_quote"> quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,= 204);padding-left:1ex">$r->connection->client_ip wou= ld report your proxy server if you have a reverse proxy setup - this is not= a common use case though.
DNS lookup would usually = be an expensive process and you are supposed to be nice=C2=A0to=C2=A0other = services so cache it for the TTL of the PTR record.
ss=3D"gmail_quote"> class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so= lid rgb(204,204,204);padding-left:1ex">I am a newbie to mp= development stack. After=C2=A0one day of work, I have made a simple ha= ndler, which returns the client's address and its PTR record. >The demo:
The code shown b= elow: olor:rgb(0,0,0);font-family:Menlo;font-size:11px">
an style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);fon= t-family:Menlo;font-size:11px">package MyHostname; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use strict; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Net::DNS; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestRec (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestIO (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Connection (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use APR::Table (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Const -compile =3D> qw(OK FORBIDDEN); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub handler { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $r =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D $r->headers_in->{'CF-= Connecting-IP'} ||=C2=A0 $r->connection->client_ip;<= /span> normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $host =3D dns_query($ip) || ""= ;; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->content_type('text/plain; chars= et=3Dutf-8'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->print("Your IP: $ip, Hostname:= $host"); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return Apache2::Const::OK; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub dns_query { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $resolver =3D Net::DNS::Resolver->ne= w(); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $reply =3D $resolver->query($ip, = 9;PTR'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 if ($reply) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 for my $rr ($reply->answe= r) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return $rr->= ;rdstring;=C2=A0 # we need only one normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">1; variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no= rmal;font-family:Menlo;color:rgb(0,0,0)">res:no-common-ligatures">
-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-siz= e:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">
margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-= stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rg= b(0,0,0)">Can an= yone give your review? Thanks in advance. font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:nor= mal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><= span style=3D"font-variant-ligatures:no-common-ligatures">
style=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:no= rmal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menl= o;color:rgb(0,0,0)">es">Matthias ont-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-heigh= t:normal;font-family:Menlo;color:rgb(0,0,0)">gatures:no-common-ligatures">
lass=3D"gmail_quote"> te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px = solid rgb(204,204,204);padding-left:1ex">Hello iv> I am developing a simple mp2 application. I looked for th= e installation for mp2 utils, and found this two:
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">libapache2-mod-perl2 meric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:1= 1px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">ont-variant-ligatures:no-common-ligatures">
east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;fon= t-family:Menlo;color:rgb(0,0,0)">ommon-ligatures">libapache2-mod-apreq2 t-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal= ;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">n style=3D"font-variant-ligatures:no-common-ligatures">
yle=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:norma= l;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;c= olor:rgb(0,0,0)">>what're their=C2=A0relations? Should=C2=A0I install both, or only the = first one? t-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:= normal;font-family:Menlo;color:rgb(0,0,0)">tures:no-common-ligatures">
nt-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-s= ize:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">Thanks. iv>
--0000000000000d879905b717a37d--
--===============1050259342== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Hangout mailing list Hangout-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/hangout
--===============1050259342==--
--===============1050259342== Content-Type: multipart/alternative; boundary="0000000000000d879905b717a37d"
--0000000000000d879905b717a37d Content-Type: text/plain; charset="UTF-8"
8.8.8.8 is google's public DNS server - yah they can handle whatever you throw at them but you shouldnt misuse it. The whole point of TTL in DNS is for suggested caching - you are welcome to ignore it but you are also being rude to others.
$r->connection->client_ip is the IP your apache server is seeing you come through which I assume is CloudFlare - I have no idea how to see the real ip behind cloudflare.
On Tue, Dec 22, 2020 at 7:19 PM Matthias Peng wrote:
> Thanks Mithun. > 1. Since the query is passed through cloudflare, so a CF- header is wanted > for fetching client's real IP. > 2. Since I am querying PTR via a stub resolver (such as 8.8.8.8), I guess > this public dns server has already cached the result. right? > > Regards. > > > On Wed, Dec 23, 2020 at 9:08 AM Mithun Bhattacharya > wrote: > >> Replying to the DL. >> >> On Tue, Dec 22, 2020 at 7:07 PM Mithun Bhattacharya >> wrote: >> >>> $r->connection->client_ip would report your proxy server if you have a >>> reverse proxy setup - this is not a common use case though. >>> >>> DNS lookup would usually be an expensive process and you are supposed to >>> be nice to other services so cache it for the TTL of the PTR record. >>> >>> On Tue, Dec 22, 2020 at 6:44 PM Matthias Peng >>> wrote: >>> >>>> I am a newbie to mp development stack. >>>> After one day of work, I have made a simple handler, which returns the >>>> client's address and its PTR record. >>>> The demo: >>>> https://myhostnames.com/ >>>> >>>> The code shown below: >>>> >>>> package MyHostname; >>>> >>>> >>>> use strict; >>>> >>>> use Net::DNS; >>>> >>>> use Apache2::RequestRec (); >>>> >>>> use Apache2::RequestIO (); >>>> >>>> use Apache2::Connection (); >>>> >>>> use APR::Table (); >>>> >>>> use Apache2::Const -compile => qw(OK FORBIDDEN); >>>> >>>> >>>> >>>> sub handler { >>>> >>>> >>>> my $r = shift; >>>> >>>> my $ip = $r->headers_in->{'CF-Connecting-IP'} || >>>> $r->connection->client_ip; >>>> >>>> >>>> my $host = dns_query($ip) || ""; >>>> >>>> >>>> $r->content_type('text/plain; charset=utf-8'); >>>> >>>> $r->print("Your IP: $ip, Hostname: $host"); >>>> >>>> >>>> return Apache2::Const::OK; >>>> >>>> } >>>> >>>> >>>> >>>> sub dns_query { >>>> >>>> my $ip = shift; >>>> >>>> my $resolver = Net::DNS::Resolver->new(); >>>> >>>> my $reply = $resolver->query($ip, 'PTR'); >>>> >>>> >>>> if ($reply) { >>>> >>>> for my $rr ($reply->answer) { >>>> >>>> return $rr->rdstring; # we need only one >>>> >>>> } >>>> >>>> } >>>> >>>> >>>> return; >>>> >>>> } >>>> >>>> >>>> >>>> 1; >>>> >>>> >>>> >>>> Can anyone give your review? Thanks in advance. >>>> >>>> >>>> Matthias >>>> >>>> >>>> >>>> >>>> On Tue, Dec 22, 2020 at 1:49 PM Matthias Peng >>>> wrote: >>>> >>>>> Hello >>>>> >>>>> I am developing a simple mp2 application. >>>>> I looked for the installation for mp2 utils, and found this two: >>>>> >>>>> libapache2-mod-perl2 >>>>> >>>>> libapache2-mod-apreq2 >>>>> >>>>> >>>>> what're their relations? Should I install both, or only the first one? >>>>> >>>>> >>>>> Thanks. >>>>> >>>>
--0000000000000d879905b717a37d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
8.8.8.8 is google's public DNS server - yah they can h= andle whatever you throw at them but you shouldnt=C2=A0misuse it. The whole= point of TTL in DNS is for suggested caching - you are welcome to ignore i= t but you are also being rude to others.
$r->connecti= on->client_ip is the IP your apache server is seeing you come through wh= ich I assume is CloudFlare - I have no idea how to see the real ip behind c= loudflare.
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">>Thanks=C2=A0Mithun. 1. Since the query is passed through cloudflare, s= o a CF- header is wanted for fetching client's real IP. 2. Si= nce I am querying PTR via a stub resolver (such as 8.8.8.8), I guess this p= ublic dns server has already cached the result. right?
= Regards.
dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 23, 2020 at 9:08 AM Mithun Bh= attacharya < mithnb= -at-gmail.com> wrote: =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex">Replying to the DL.
l_quote"> quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,= 204);padding-left:1ex">$r->connection->client_ip wou= ld report your proxy server if you have a reverse proxy setup - this is not= a common use case though.
DNS lookup would usually = be an expensive process and you are supposed to be nice=C2=A0to=C2=A0other = services so cache it for the TTL of the PTR record.
ss=3D"gmail_quote"> class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so= lid rgb(204,204,204);padding-left:1ex">I am a newbie to mp= development stack. After=C2=A0one day of work, I have made a simple ha= ndler, which returns the client's address and its PTR record. >The demo:
The code shown b= elow: olor:rgb(0,0,0);font-family:Menlo;font-size:11px">
an style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);fon= t-family:Menlo;font-size:11px">package MyHostname; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use strict; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Net::DNS; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestRec (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestIO (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Connection (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use APR::Table (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Const -compile =3D> qw(OK FORBIDDEN); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub handler { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $r =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D $r->headers_in->{'CF-= Connecting-IP'} ||=C2=A0 $r->connection->client_ip;<= /span> normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $host =3D dns_query($ip) || ""= ;; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->content_type('text/plain; chars= et=3Dutf-8'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->print("Your IP: $ip, Hostname:= $host"); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return Apache2::Const::OK; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub dns_query { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $resolver =3D Net::DNS::Resolver->ne= w(); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $reply =3D $resolver->query($ip, = 9;PTR'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 if ($reply) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 for my $rr ($reply->answe= r) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return $rr->= ;rdstring;=C2=A0 # we need only one normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">1; variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no= rmal;font-family:Menlo;color:rgb(0,0,0)">res:no-common-ligatures">
-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-siz= e:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">
margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-= stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rg= b(0,0,0)">Can an= yone give your review? Thanks in advance. font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:nor= mal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><= span style=3D"font-variant-ligatures:no-common-ligatures">
style=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:no= rmal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menl= o;color:rgb(0,0,0)">es">Matthias ont-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-heigh= t:normal;font-family:Menlo;color:rgb(0,0,0)">gatures:no-common-ligatures">
lass=3D"gmail_quote"> te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px = solid rgb(204,204,204);padding-left:1ex">Hello iv> I am developing a simple mp2 application. I looked for th= e installation for mp2 utils, and found this two:
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">libapache2-mod-perl2 meric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:1= 1px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">ont-variant-ligatures:no-common-ligatures">
east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;fon= t-family:Menlo;color:rgb(0,0,0)">ommon-ligatures">libapache2-mod-apreq2 t-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal= ;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">n style=3D"font-variant-ligatures:no-common-ligatures">
yle=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:norma= l;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;c= olor:rgb(0,0,0)">>what're their=C2=A0relations? Should=C2=A0I install both, or only the = first one? t-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:= normal;font-family:Menlo;color:rgb(0,0,0)">tures:no-common-ligatures">
nt-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-s= ize:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">Thanks. iv>
--0000000000000d879905b717a37d--
--===============1050259342== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Hangout mailing list Hangout-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/hangout
--===============1050259342==--
|
|