mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Validate IP addresses returned by ipX.yunohost.org
This commit is contained in:
parent
dfd8780a10
commit
83f4c6a65f
1 changed files with 6 additions and 2 deletions
|
@ -3,6 +3,8 @@ set -e
|
||||||
|
|
||||||
force=$1
|
force=$1
|
||||||
|
|
||||||
|
. /usr/share/yunohost/apps/helpers
|
||||||
|
|
||||||
function safe_copy () {
|
function safe_copy () {
|
||||||
if [[ "$force" == "True" ]]; then
|
if [[ "$force" == "True" ]]; then
|
||||||
sudo yunohost service safecopy \
|
sudo yunohost service safecopy \
|
||||||
|
@ -16,10 +18,12 @@ function safe_copy () {
|
||||||
cd /usr/share/yunohost/templates/dnsmasq
|
cd /usr/share/yunohost/templates/dnsmasq
|
||||||
|
|
||||||
# Get IPv4 address
|
# Get IPv4 address
|
||||||
ip=$(curl -s -4 https://ip.yunohost.org 2>/dev/null || echo '0.0.0.0')
|
ip=$(curl -s -4 https://ip.yunohost.org 2>/dev/null)
|
||||||
|
ynh_validate_ip4 $ip || ip='0.0.0.0'
|
||||||
|
|
||||||
# Get IPv6 IP address
|
# Get IPv6 IP address
|
||||||
ipv6=$(curl -s -6 http://ip6.yunohost.org 2>/dev/null || echo '')
|
ipv6=$(curl -s -6 http://ip6.yunohost.org 2>/dev/null)
|
||||||
|
ynh_validate_ip6 $ipv6 || ipv6=''
|
||||||
|
|
||||||
sudo mkdir -p /etc/dnsmasq.d
|
sudo mkdir -p /etc/dnsmasq.d
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue