public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment 7+ messages / 4 participants [nested] [flat]
* [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment @ 2022-03-11 03:19 Khushboo Vashi <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Khushboo Vashi @ 2022-03-11 03:19 UTC (permalink / raw) To: pgadmin-hackers; +Cc: Yogesh Mahajan <[email protected]> Hi, Please find the attached patch to fix the default Public IP range issue in AWS deployment. @Yogesh Mahajan <[email protected]>, please test. Thanks, Khushboo Attachments: [application/octet-stream] cloud_public_ip_fix.patch (1.6K, 3-cloud_public_ip_fix.patch) download | inline diff: diff --git a/web/pgacloud/utils/misc.py b/web/pgacloud/utils/misc.py index ddbbf04cb..586bf09c1 100644 --- a/web/pgacloud/utils/misc.py +++ b/web/pgacloud/utils/misc.py @@ -10,6 +10,7 @@ import random import string import urllib3 +import ipaddress def get_my_ip(): @@ -23,6 +24,15 @@ def get_my_ip(): except Exception: external_ip = '127.0.0.1' + if type(external_ip) == bytes: + external_ip = external_ip.decode('utf-8') + + ip = ipaddress.ip_address(external_ip) + if isinstance(ip, ipaddress.IPv4Address): + return '{}/{}'.format(external_ip, 32) + elif isinstance(ip, ipaddress.IPv6Address): + return '{}/{}'.format(external_ip, 128) + return '{}/{}'.format(external_ip, 32) diff --git a/web/pgadmin/misc/cloud/utils/__init__.py b/web/pgadmin/misc/cloud/utils/__init__.py index ba4b73331..4cded810f 100644 --- a/web/pgadmin/misc/cloud/utils/__init__.py +++ b/web/pgadmin/misc/cloud/utils/__init__.py @@ -8,6 +8,7 @@ # ########################################################################## import urllib3 +import ipaddress def get_my_ip(): @@ -21,4 +22,13 @@ def get_my_ip(): except Exception: external_ip = '127.0.0.1' + if type(external_ip) == bytes: + external_ip = external_ip.decode('utf-8') + + ip = ipaddress.ip_address(external_ip) + if isinstance(ip, ipaddress.IPv4Address): + return '{}/{}'.format(external_ip, 32) + elif isinstance(ip, ipaddress.IPv6Address): + return '{}/{}'.format(external_ip, 128) + return '{}/{}'.format(external_ip, 32) ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment @ 2022-03-11 03:51 Yogesh Mahajan <[email protected]> parent: Khushboo Vashi <[email protected]> 0 siblings, 2 replies; 7+ messages in thread From: Yogesh Mahajan @ 2022-03-11 03:51 UTC (permalink / raw) To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers Hi, Patch looks fine. IP Addresses are prefixed by 32 and 128 for IPv4 and IPv6 respectively. Thanks, Yogesh Mahajan EnterpriseDB On Fri, Mar 11, 2022 at 8:49 AM Khushboo Vashi < [email protected]> wrote: > Hi, > > Please find the attached patch to fix the default Public IP range issue in > AWS deployment. > > @Yogesh Mahajan <[email protected]>, please test. > > > Thanks, > Khushboo > ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment @ 2022-03-11 04:41 Akshay Joshi <[email protected]> parent: Yogesh Mahajan <[email protected]> 1 sibling, 1 reply; 7+ messages in thread From: Akshay Joshi @ 2022-03-11 04:41 UTC (permalink / raw) To: Yogesh Mahajan <[email protected]>; +Cc: Khushboo Vashi <[email protected]>; pgadmin-hackers Hi Khushboo Why there are two identical functions (def get_my_ip) in two different files, can you please make it generic in one place only and send the patch. On Fri, Mar 11, 2022 at 9:22 AM Yogesh Mahajan < [email protected]> wrote: > Hi, > > Patch looks fine. IP Addresses are prefixed by 32 and 128 for IPv4 and > IPv6 respectively. > > Thanks, > Yogesh Mahajan > EnterpriseDB > > > On Fri, Mar 11, 2022 at 8:49 AM Khushboo Vashi < > [email protected]> wrote: > >> Hi, >> >> Please find the attached patch to fix the default Public IP range issue >> in AWS deployment. >> >> @Yogesh Mahajan <[email protected]>, please test. >> >> >> Thanks, >> Khushboo >> > -- *Thanks & Regards* *Akshay Joshi* *pgAdmin Hacker | Principal Software Architect* *EDB Postgres <http://edbpostgres.com>* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment @ 2022-03-11 06:26 Khushboo Vashi <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Khushboo Vashi @ 2022-03-11 06:26 UTC (permalink / raw) To: Akshay Joshi <[email protected]>; +Cc: Yogesh Mahajan <[email protected]>; pgadmin-hackers One is for pgacloud standalone code for background process and one for pgadmin module. On Fri, 11 Mar 2022, 10:11 Akshay Joshi, <[email protected]> wrote: > Hi Khushboo > > Why there are two identical functions (def get_my_ip) in two different > files, can you please make it generic in one place only and send the patch. > > On Fri, Mar 11, 2022 at 9:22 AM Yogesh Mahajan < > [email protected]> wrote: > >> Hi, >> >> Patch looks fine. IP Addresses are prefixed by 32 and 128 for IPv4 and >> IPv6 respectively. >> >> Thanks, >> Yogesh Mahajan >> EnterpriseDB >> >> >> On Fri, Mar 11, 2022 at 8:49 AM Khushboo Vashi < >> [email protected]> wrote: >> >>> Hi, >>> >>> Please find the attached patch to fix the default Public IP range issue >>> in AWS deployment. >>> >>> @Yogesh Mahajan <[email protected]>, please test. >>> >>> >>> Thanks, >>> Khushboo >>> >> > > -- > *Thanks & Regards* > *Akshay Joshi* > *pgAdmin Hacker | Principal Software Architect* > *EDB Postgres <http://edbpostgres.com>* > > *Mobile: +91 976-788-8246* > ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment @ 2022-03-11 07:18 Dave Page <[email protected]> parent: Yogesh Mahajan <[email protected]> 1 sibling, 0 replies; 7+ messages in thread From: Dave Page @ 2022-03-11 07:18 UTC (permalink / raw) To: Yogesh Mahajan <[email protected]>; +Cc: Khushboo Vashi <[email protected]>; pgadmin-hackers On Fri, 11 Mar 2022 at 03:52, Yogesh Mahajan < [email protected]> wrote: > Hi, > > Patch looks fine. IP Addresses are prefixed by 32 and 128 for IPv4 and > IPv6 respectively. > I hope you mean suffixed, not prefixed :-) > Thanks, > Yogesh Mahajan > EnterpriseDB > > > On Fri, Mar 11, 2022 at 8:49 AM Khushboo Vashi < > [email protected]> wrote: > >> Hi, >> >> Please find the attached patch to fix the default Public IP range issue >> in AWS deployment. >> >> @Yogesh Mahajan <[email protected]>, please test. >> >> >> Thanks, >> Khushboo >> > -- -- Dave Page https://pgsnake.blogspot.com EDB Postgres https://www.enterprisedb.com ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment @ 2022-03-11 08:42 Akshay Joshi <[email protected]> parent: Khushboo Vashi <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Akshay Joshi @ 2022-03-11 08:42 UTC (permalink / raw) To: Khushboo Vashi <[email protected]>; +Cc: Yogesh Mahajan <[email protected]>; pgadmin-hackers Isn't it possible to define it at a common location? These types of duplicate code are error-prone since sometimes we fix an issue at one place and forget to fix it at another. On Fri, Mar 11, 2022 at 11:56 AM Khushboo Vashi < [email protected]> wrote: > One is for pgacloud standalone code for background process and one for > pgadmin module. > > On Fri, 11 Mar 2022, 10:11 Akshay Joshi, <[email protected]> > wrote: > >> Hi Khushboo >> >> Why there are two identical functions (def get_my_ip) in two different >> files, can you please make it generic in one place only and send the patch. >> >> On Fri, Mar 11, 2022 at 9:22 AM Yogesh Mahajan < >> [email protected]> wrote: >> >>> Hi, >>> >>> Patch looks fine. IP Addresses are prefixed by 32 and 128 for IPv4 and >>> IPv6 respectively. >>> >>> Thanks, >>> Yogesh Mahajan >>> EnterpriseDB >>> >>> >>> On Fri, Mar 11, 2022 at 8:49 AM Khushboo Vashi < >>> [email protected]> wrote: >>> >>>> Hi, >>>> >>>> Please find the attached patch to fix the default Public IP range issue >>>> in AWS deployment. >>>> >>>> @Yogesh Mahajan <[email protected]>, please test. >>>> >>>> >>>> Thanks, >>>> Khushboo >>>> >>> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> *pgAdmin Hacker | Principal Software Architect* >> *EDB Postgres <http://edbpostgres.com>* >> >> *Mobile: +91 976-788-8246* >> > -- *Thanks & Regards* *Akshay Joshi* *pgAdmin Hacker | Principal Software Architect* *EDB Postgres <http://edbpostgres.com>* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment @ 2022-03-11 09:04 Akshay Joshi <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 0 replies; 7+ messages in thread From: Akshay Joshi @ 2022-03-11 09:04 UTC (permalink / raw) To: Khushboo Vashi <[email protected]>; +Cc: Yogesh Mahajan <[email protected]>; pgadmin-hackers Thanks, the patch applied On Fri, Mar 11, 2022 at 2:12 PM Akshay Joshi <[email protected]> wrote: > Isn't it possible to define it at a common location? These types of > duplicate code are error-prone since sometimes we fix an issue at one place > and forget to fix it at another. > > On Fri, Mar 11, 2022 at 11:56 AM Khushboo Vashi < > [email protected]> wrote: > >> One is for pgacloud standalone code for background process and one for >> pgadmin module. >> >> On Fri, 11 Mar 2022, 10:11 Akshay Joshi, <[email protected]> >> wrote: >> >>> Hi Khushboo >>> >>> Why there are two identical functions (def get_my_ip) in two different >>> files, can you please make it generic in one place only and send the patch. >>> >>> On Fri, Mar 11, 2022 at 9:22 AM Yogesh Mahajan < >>> [email protected]> wrote: >>> >>>> Hi, >>>> >>>> Patch looks fine. IP Addresses are prefixed by 32 and 128 for IPv4 and >>>> IPv6 respectively. >>>> >>>> Thanks, >>>> Yogesh Mahajan >>>> EnterpriseDB >>>> >>>> >>>> On Fri, Mar 11, 2022 at 8:49 AM Khushboo Vashi < >>>> [email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> Please find the attached patch to fix the default Public IP range >>>>> issue in AWS deployment. >>>>> >>>>> @Yogesh Mahajan <[email protected]>, please test. >>>>> >>>>> >>>>> Thanks, >>>>> Khushboo >>>>> >>>> >>> >>> -- >>> *Thanks & Regards* >>> *Akshay Joshi* >>> *pgAdmin Hacker | Principal Software Architect* >>> *EDB Postgres <http://edbpostgres.com>* >>> >>> *Mobile: +91 976-788-8246* >>> >> > > -- > *Thanks & Regards* > *Akshay Joshi* > *pgAdmin Hacker | Principal Software Architect* > *EDB Postgres <http://edbpostgres.com>* > > *Mobile: +91 976-788-8246* > -- *Thanks & Regards* *Akshay Joshi* *pgAdmin Hacker | Principal Software Architect* *EDB Postgres <http://edbpostgres.com>* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2022-03-11 09:04 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-03-11 03:19 [pgAdmin4][Patch]: Fixed default public IP range issue in AWS deployment Khushboo Vashi <[email protected]> 2022-03-11 03:51 ` Yogesh Mahajan <[email protected]> 2022-03-11 04:41 ` Akshay Joshi <[email protected]> 2022-03-11 06:26 ` Khushboo Vashi <[email protected]> 2022-03-11 08:42 ` Akshay Joshi <[email protected]> 2022-03-11 09:04 ` Akshay Joshi <[email protected]> 2022-03-11 07:18 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox