summaryrefslogtreecommitdiff
path: root/selfpublish.sh
diff options
context:
space:
mode:
Diffstat (limited to 'selfpublish.sh')
-rw-r--r--selfpublish.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/selfpublish.sh b/selfpublish.sh
index 521d9da..fa366a8 100644
--- a/selfpublish.sh
+++ b/selfpublish.sh
@@ -83,6 +83,7 @@ fortune-mod
83fortunes-min 83fortunes-min
84gnupg (>= 2.2.14) 84gnupg (>= 2.2.14)
85libssl1.1 (>= 1.1.1d) 85libssl1.1 (>= 1.1.1d)
86netmask
86openssl 87openssl
87ssh 88ssh
88EOF 89EOF
@@ -178,6 +179,44 @@ EOF
178# File: /usr/share/doc/selfpublish-dot-sh/README.Debian 644 179# File: /usr/share/doc/selfpublish-dot-sh/README.Debian 644
179# This gets overwritten :( 180# This gets overwritten :(
180# EOF 181# EOF
182 control_file_file /usr/lib/cryptonomic/cryptonomic-ipv4 755 <<'EOF'
183#!/bin/bash
184
185ipv4_check_masks_()
186{
187 ip=$(netmask -x "$1"/32) || return
188 ip=${ip%/*}
189 shift
190 for cidr in "$@"
191 do
192 prefix=${cidr%/*}
193 mask=${cidr#*/}
194 if (( (ip & mask) == prefix ))
195 then
196 return 1
197 fi
198 done
199 true
200}
201
202ipv4_address_is_public()
203{
204 ipv4_check_masks_ "$1" $CIDR_NONPUBLIC
205}
206
207CIDR_NONPUBLIC=$(netmask -x 127.0/8 10.0/8 192.168.0/16 172.16.0/20 169.254.0/16)
208
209ip -4 -oneline addr |
210while read n dev _ inet _
211do
212 a=${inet%%/*}
213 if ipv4_address_is_public "$a"; then
214 echo "$a"
215 fi
216done
217
218
219EOF
181 control_file_file /usr/lib/cryptonomic/cryptonomic-gpg 755 <<'EOF' 220 control_file_file /usr/lib/cryptonomic/cryptonomic-gpg 755 <<'EOF'
182#!/bin/sh 221#!/bin/sh
183 222
@@ -407,6 +446,9 @@ elif [ "$1" = dyndns ]
407then 446then
408 shift 447 shift
409 # further command line options are ssh options 448 # further command line options are ssh options
449 if [ -z "$(cryptonomic ipv4)" ]
450 then set -- "$@" -6
451 fi
410 set -- ssh -i "$KEY_FILE" dyndns@"$DOMAIN" "$@" -- "$(hostname)" 452 set -- ssh -i "$KEY_FILE" dyndns@"$DOMAIN" "$@" -- "$(hostname)"
411 453
412 if [ -r "$KEY_FILE" ] 454 if [ -r "$KEY_FILE" ]