ip_address: make external IP address source configurable

Bug #1869483 reported by pdecat
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
byobu
New
Undecided
Unassigned

Bug Description

The following URLs used to report the external IP address are currently inaccessible with my K-Net ISP:

- http://v4.ipv6-test.com/api/myip.php
- http://v6.ipv6-test.com/api/myip.php

When I try to access them from my main ISP, I get a timeout:

```
# wget -4 -O- --timeout=5 --tries=1 --progress=dot http://v4.ipv6-test.com/api/myip.php
--2020-03-28 11:36:32-- http://v4.ipv6-test.com/api/myip.php
Resolving v4.ipv6-test.com (v4.ipv6-test.com)... 51.75.78.103
Connecting to v4.ipv6-test.com (v4.ipv6-test.com)|51.75.78.103|:80... failed: Connection timed out.
Giving up.
```

Somehow, either there's a routing issue or my IP address is blocked.

When using my backup Free ISP or a VM on Google Cloud, no problem:

```
# wget -4 -O- --timeout=5 --tries=1 --progress=dot http://v4.ipv6-test.com/api/myip.php
--2020-03-28 11:35:48-- http://v4.ipv6-test.com/api/myip.php
Resolving v4.ipv6-test.com (v4.ipv6-test.com)... 51.75.78.103
Connecting to v4.ipv6-test.com (v4.ipv6-test.com)|51.75.78.103|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘STDOUT’
82.64.xxx.xxx
     0K 749K=0s

2020-03-28 11:35:48 (749 KB/s) - written to stdout [13]
```

Would it be possible to make them configurable?

For the time being, I've switched to another source with this change:

```
# diff /usr/lib/byobu/ip_address{.bak,}
44c44
< timeout 1 wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
---
> timeout 1 wget -6 -q -O- http://ip.clara.net </dev/null >"$cache" 2>/dev/null &
63c63
< timeout 1 wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
---
> timeout 1 wget -4 -q -O- http://ip.clara.net </dev/null >"$cache" 2>/dev/null &
68c68
< timeout 0.2 wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &
---
> timeout 0.2 wget -4 -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &

```

Note: that I've added -4 or -6 to the wget commands to make sure the proper protocol version is selected as the hostname is the same for both cases here.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.