diff options
Diffstat (limited to 'selfpublish.sh')
-rw-r--r-- | selfpublish.sh | 42 |
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 | |||
83 | fortunes-min | 83 | fortunes-min |
84 | gnupg (>= 2.2.14) | 84 | gnupg (>= 2.2.14) |
85 | libssl1.1 (>= 1.1.1d) | 85 | libssl1.1 (>= 1.1.1d) |
86 | netmask | ||
86 | openssl | 87 | openssl |
87 | ssh | 88 | ssh |
88 | EOF | 89 | EOF |
@@ -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 | |||
185 | ipv4_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 | |||
202 | ipv4_address_is_public() | ||
203 | { | ||
204 | ipv4_check_masks_ "$1" $CIDR_NONPUBLIC | ||
205 | } | ||
206 | |||
207 | CIDR_NONPUBLIC=$(netmask -x 127.0/8 10.0/8 192.168.0/16 172.16.0/20 169.254.0/16) | ||
208 | |||
209 | ip -4 -oneline addr | | ||
210 | while read n dev _ inet _ | ||
211 | do | ||
212 | a=${inet%%/*} | ||
213 | if ipv4_address_is_public "$a"; then | ||
214 | echo "$a" | ||
215 | fi | ||
216 | done | ||
217 | |||
218 | |||
219 | EOF | ||
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 ] | |||
407 | then | 446 | then |
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" ] |