public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Samuraiii <samurai.no.dojo@gmail.com>
To: gentoo-user <gentoo-user@lists.gentoo.org>
Subject: [gentoo-user] Re: VPN vs LAN address hostname resolution
Date: Fri, 31 May 2013 18:04:36 +0200	[thread overview]
Message-ID: <51A8CA14.6030506@gmail.com> (raw)
In-Reply-To: <519CF41B.5040108@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]

If someone is intrested here is second (undebugged) incarnation of my
hostnames updater script:

#!/bin/sh
#verze 2.0.0_2013-05-31
lock=/var/run/hostnames-updater.pid
shmm="/dev/shm/hosts"

clean () {
    rm $lock
    rm $shmm
}
trap clean SIGHUP SIGINT SIGTERM

/bin/echo $$ > $lock
while /bin/true
    tst(){
    x=0
    if $3 = $(/usr/bin/ssh-keyscan -p $2 $5 2>/dev/null|/bin/sed 's/.*\
ssh-.*\ //g'|/usr/bin/whirpooldeep)
    then
        x=$5
    elif /usr/bin/test $1 -gt 2
    then
        if $3 = $(/usr/bin/ssh-keyscan -p $2 $6 2>/dev/null|/bin/sed
's/.*\ ssh-.*\ //g'|/usr/bin/whirlpooldeep)
        then
            x=$6
        else
            x=$4
        fi
    else
        x=$4
    fi
    }

#host testing line is as folows
#tst <number of addresses to try - some hosts do have wl and eth
interface)> \
#<output of  ssh-keyscan -p <port> <address> 2>/dev/null|/bin/sed 's/.*\
ssh-.*\ //g'|/usr/bin/whirlpooldeep> \
#<fallback address - eg. vpn one> <address 2> <address n>

####################host 1
tst <address count n> <port> <hash> <address 1 > ... <address n> 2>&1
>/dev/null
host1=$x


#lets create hosts file
/bin/echo "# /etc/hosts: Local Host Database
#
# This file describes a number of aliases-to-address mappings for the for
# local hosts that share this file.
#
# In the presence of the domain name service or NIS, this file may not be
# consulted at all; see /etc/host.conf for the resolution order.
#

# IPv4 and IPv6 localhost aliases
127.0.0.1    $(hostname).local $(hostname) localhost
::1        localhost

#
# Imaginary network.
    $host1        host1
#    Last update $(date --rfc-3339)

#
#
# According to RFC 1918, you can use the following IP networks for private
# nets which will never be connected to the Internet:
#
#       10.0.0.0        -   10.255.255.255
#       172.16.0.0      -   172.31.255.255
#       192.168.0.0     -   192.168.255.255
#
# In case you want to be able to connect directly to the Internet (i.e. not
# behind a NAT, ADSL router, etc...), you need real official assigned
# numbers.  Do not try to invent your own network numbers but instead
get one
# from your network provider (if any) or from your regional registry (ARIN,
# APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#
" > $shmm
/bin/mv $shmm /etc/hosts
/usr/bin/sleep 300
done


I hope I helps someone
S

[-- Attachment #2: Type: text/html, Size: 3468 bytes --]

  parent reply	other threads:[~2013-05-31 16:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22 16:36 [gentoo-user] VPN vs LAN address hostname resolution Samuraiii
2013-05-22 17:36 ` Michael Orlitzky
2013-05-22 17:52   ` Michael Mol
2013-05-22 18:30     ` Samuraiii
2013-05-22 18:40       ` Michael Mol
2013-05-22 18:52       ` Michael Orlitzky
2013-05-22 19:35         ` Samuraiii
2013-05-22 19:44           ` Michael Orlitzky
2013-05-22 20:52           ` Alex
2013-05-22 22:32         ` William Kenworthy
2013-05-22 20:43     ` covici
2013-05-22 20:40   ` covici
2013-05-31 16:04 ` Samuraiii [this message]
2013-05-31 16:32   ` [gentoo-user] " Samuraiii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51A8CA14.6030506@gmail.com \
    --to=samurai.no.dojo@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox