VCN: Difference between revisions

From ortiche
Jump to navigation Jump to search
No edit summary
No edit summary
 
(16 intermediate revisions by 2 users not shown)
Line 8: Line 8:
* difendere l'indifendibile.
* difendere l'indifendibile.


procurati un token, se non ce l'hai chiedi ad un amico oppure, se proprio necessario, a vcn [@] esiliati {.} org
procurati un token su https://webmail.esiliati.org/toolz/token/generate, se non ce l'hai chiedi ad un amico oppure, se proprio necessario, a vcn [@] esiliati {.} org


installa [http://www.tinc-vpn.org/ Tinc]
installa [http://www.tinc-vpn.org/ Tinc]


lancia '''tinc'''
lancia '''tinc''' (se non lo trovi prova con tincd) e fagli creare una chiave:


<source lang="bash">tinc -n vcn -K</source>
<source lang="bash">tinc -n vcn -K 2048</source>


se si arrabbia, crea la directory /etc/tinc/vcn
se si arrabbia, crea la directory /etc/tinc/vcn
Line 20: Line 20:
<source lang="bash">mkdir /etc/tinc/vcn</source>
<source lang="bash">mkdir /etc/tinc/vcn</source>


vai su https://webmail.esiliati.org/toolz/token/checktoken.php e dagli il token  
vai su https://webmail.esiliati.org/toolz/token/check e dagli il token  


* scegli un nome per il tuo nodo
* scegli un nome per il tuo nodo
Line 29: Line 29:


avvia tinc: <source lang="bash">tinc -n vcn</source>
avvia tinc: <source lang="bash">tinc -n vcn</source>
== Sicurezza ==
Il tuo nodo e' protetto dall'internet, ma visibile dagli altri nodi VCN
puoi proteggerlo con un muro di fuoco!
=== Linux ===
<syntaxhighlight lang="bash">
# fai vedere a tutti la tua ''webapp''
iptables -A INPUT -i vcn -p tcp --dport 80 -j ACCEPT
# fai passare i tuoi amici (172.20.0.31) sulle porte giuste (ssh)
iptables -A INPUT -i vcn -p tcp --dport ssh -s 172.20.0.31 -j ACCEPT
# fai passare le connessioni in uscita
iptables -A INPUT -i vcn -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
# blocca gli altri
iptables -A INPUT -i vcn -p tcp -j DROP
</syntaxhighlight>
=== NetBSD con NPF ===
<syntaxhighlight lang="bash">
$tun_if = inet4(tun0)
$services_tcp = { 22, 25, 80, 443, 110, 143, 587, 993, 995, 6667, 9999 }
$services_udp = { 53 }
$vcn_friends = { 172.20.x.y/32, 172.20.z.w/32 }
group "tun" on $tun_if {
        block in all
pass stateful in final proto tcp to $tun_if port $services_tcp
pass stateful in final proto udp to $tun_if port $services_udp
pass stateful from $vcn_friends
}
group default {
        ruleset "test-set"
        pass all
}
</syntaxhighlight>
== Gateway ==
sul gateway di uscita:
<syntaxhighlight lang="bash">
echo 1 >/proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i vcn -s ip.del.client -j ACCEPT
iptables -A FORWARD -i vcn  -j DROP
</syntaxhighlight>
sul client:
<syntaxhighlight lang="bash">
ORIGINAL_GATEWAY=`ip route show | grep ^default | cut -d ' ' -f 2-5`
route add default gw ip.del.gateway
ip route del default $ORIGINAL_GATEWAY
</syntaxhighlight>
== DNS ==
Dentro VCN c'è un server DNS.
Per usarlo devi dire al tuo server DNS locale di far risolvere i domini '''.vcn''' a '''172.20.1.35'''.
Con dnsmasq devi aggiungere questo a /etc/dnsmasq.conf
<source>
server=/vcn/172.20.1.35#53
</source>


qualsiasi problema, vcn [@] esiliati {.} org
qualsiasi problema, vcn [@] esiliati {.} org

Latest revision as of 23:34, 8 June 2016


Un reticolo di tubi. Il demone nega la cabala.

Un tunnel serve per:

  • passare inosservati
  • entrare dove si puo solo uscire
  • difendere l'indifendibile.

procurati un token su https://webmail.esiliati.org/toolz/token/generate, se non ce l'hai chiedi ad un amico oppure, se proprio necessario, a vcn [@] esiliati {.} org

installa Tinc

lancia tinc (se non lo trovi prova con tincd) e fagli creare una chiave:

tinc -n vcn -K 2048

se si arrabbia, crea la directory /etc/tinc/vcn

mkdir /etc/tinc/vcn

vai su https://webmail.esiliati.org/toolz/token/check e dagli il token

  • scegli un nome per il tuo nodo
  • apri il file rsa_key.pub, copia la chiave (la stringa contenuta tra -----BEGIN RSA PUBLIC KEY----- e -----END RSA PUBLIC KEY-----) e incollala nel form pubkey
  • premi GO

copia il contenuto delle finestrelle nei file indicati, tutti contenuti nella directory /etc/tinc/vcn

avvia tinc:

tinc -n vcn

Sicurezza

Il tuo nodo e' protetto dall'internet, ma visibile dagli altri nodi VCN

puoi proteggerlo con un muro di fuoco!

Linux

# fai vedere a tutti la tua ''webapp''
iptables -A INPUT -i vcn -p tcp --dport 80 -j ACCEPT
# fai passare i tuoi amici (172.20.0.31) sulle porte giuste (ssh)
iptables -A INPUT -i vcn -p tcp --dport ssh -s 172.20.0.31 -j ACCEPT
# fai passare le connessioni in uscita
iptables -A INPUT -i vcn -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
# blocca gli altri
iptables -A INPUT -i vcn -p tcp -j DROP

NetBSD con NPF

$tun_if = inet4(tun0)

$services_tcp = { 22, 25, 80, 443, 110, 143, 587, 993, 995, 6667, 9999 }
$services_udp = { 53 }

$vcn_friends = { 172.20.x.y/32, 172.20.z.w/32 }

group "tun" on $tun_if {
        block in all
	pass stateful in final proto tcp to $tun_if port $services_tcp
	pass stateful in final proto udp to $tun_if port $services_udp
	pass stateful from $vcn_friends
}

group default {
        ruleset "test-set"
        pass all
}

Gateway

sul gateway di uscita:

echo 1 >/proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

iptables -A FORWARD -i vcn -s ip.del.client -j ACCEPT
iptables -A FORWARD -i vcn  -j DROP

sul client:

ORIGINAL_GATEWAY=`ip route show | grep ^default | cut -d ' ' -f 2-5`
route add default gw ip.del.gateway
ip route del default $ORIGINAL_GATEWAY

DNS

Dentro VCN c'è un server DNS.

Per usarlo devi dire al tuo server DNS locale di far risolvere i domini .vcn a 172.20.1.35.

Con dnsmasq devi aggiungere questo a /etc/dnsmasq.conf

server=/vcn/172.20.1.35#53

qualsiasi problema, vcn [@] esiliati {.} org