Mudanças entre as edições de "Projeto Integrador - 2012.2 - Equipe 2"

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
 
(40 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 11: Linha 11:
 
Leando Rodrigues
 
Leando Rodrigues
 
Renan Rodolfo  
 
Renan Rodolfo  
Vinicius Pléticos
+
Vinícius Pléticos
 
</syntaxhighlight>
 
</syntaxhighlight>
 
----
 
----
Linha 26: Linha 26:
  
 
----
 
----
 +
Named.conf.local
 
<syntaxhighlight lang=c>
 
<syntaxhighlight lang=c>
 
zone "equipe2.sj.ifsc.edu.br"  {
 
zone "equipe2.sj.ifsc.edu.br"  {
Linha 31: Linha 32:
 
     file "/etc/bind/zones/aula.zone";
 
     file "/etc/bind/zones/aula.zone";
 
       };
 
       };
 +
 
zone "subdominio.equipe2.sj.ifsc.edu.br" IN {
 
zone "subdominio.equipe2.sj.ifsc.edu.br" IN {
 
     type slave;
 
     type slave;
 
     file "slave/slave.subdominio.equipe2.sj.ifsc.edu.br";
 
     file "slave/slave.subdominio.equipe2.sj.ifsc.edu.br";
     masters {192.168.1.114;};
+
     masters {192.168.1.113;};
 
     // secundario (slave) do dominio delegado
 
     // secundario (slave) do dominio delegado
 +
 +
};
 
zone "1.168.192.in-addr.arpa" {
 
zone "1.168.192.in-addr.arpa" {
 
     type master;
 
     type master;
     file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";  
+
     file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";
 +
};
 +
</syntaxhighlight>
 +
 
 +
 
 +
Aula.Zone
 +
 
 +
<syntaxhighlight lang=c>
 +
----
 +
@  IN  SOA ns1.equipe2.sj.ifsc.edu.br. admin.ns1.equipe2.sj.ifsc.edu.br. (
 +
2011091401 ; Serial
 +
28800 ; Refresh
 +
3600 ; Retry
 +
604800 ; Expire
 +
38400 ) ; Default TTL
 +
NS ns1.equipe2.sj.ifsc.edu.br.
 +
NS ns2.equipe2.sj.ifsc.edu.br.
 +
MX 10 mta.equipe2.sj.ifsc.edu.br.
 +
IN A 192.168.1.113
 +
 
 +
$ORIGIN equipe2.sj.ifsc.edu.br.
 +
ns1 IN A 192.168.1.113
 +
ns2 IN A 192.168.1.115
 +
mta IN A 192.168.1.113
 +
www IN A 192.168.1.113
 +
web IN CNAME www
 +
 
 +
</syntaxhighlight>
 +
----
 +
 
 +
Arquivo Reverso
 +
 
 +
<syntaxhighlight lang=c>
 +
$ORIGIN 1.168.192.in-addr.arpa.
 +
@  IN  SOA ns1.equipe2.sj.ifsc.edu.br. admin.ns1.equipe2.sj.ifsc.edu.br. (
 +
2011091401;
 +
28800;
 +
604800;
 +
604800;
 +
86400 )
 +
 
 +
IN NS ns1.equipe2.sj.ifsc.edu.br.
 +
IN NS ns2.equipe2.sj.ifsc.edu.br.
 +
113 IN PTR ns1.equipe2.sj.ifsc.edu.br.
 +
115 IN PTR ns2.equipe2.sj.ifsc.edu.br.
 +
113 IN PTR mta.equipe2.sj.ifsc.edu.br.
 +
113 IN PTR www.equipe2.sj.ifsc.edu.br.
 +
 
 +
</syntaxhighlight>
 +
 
 +
Resolv.comf
 +
 
 +
----
 +
<syntaxhighlight lang=c>
 +
nameserver 192.168.1.113
 +
nameserver 8.8.8.8
 +
nameserver 192.168.1.1
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
'''07/03/2013'''
 
'''07/03/2013'''
Linha 108: Linha 169:
  
 
Instalar servidor FreeRadius
 
Instalar servidor FreeRadius
----<syntaxhighlight lang=c>
+
----
 +
<syntaxhighlight lang=c>
 
apt-get install freeradius freeradius-mysql
 
apt-get install freeradius freeradius-mysql
 
apt-get install mysql-server
 
apt-get install mysql-server
----</syntaxhighlight>
+
 
 +
 
 +
</syntaxhighlight>
 +
 
 +
<syntaxhighlight lang=c>
 +
Instalação da rede ADSL para a filial.
 +
 
 +
Configuração do roteador da Matriz, um CISCO 2500.
 +
-noshutdown na s0 e na e0
 +
-IP válido configurado na s0
 +
-Link up Protocol up
 +
-IP interno configurado na e0
 +
-Link up Protocol up
 +
 
 +
'''21/03/2013'''
 +
 
 +
Término da instalação do link ADSL da filial
 +
-Refeitos os patchpanel de ambos os laboratórios
 +
-Trocada a porta do DSLAN, a anterior apresentava problema.
 +
-Trocada a porta do patchpanel do lado da matriz, a antrior apresentava problemas.
 +
-Link ADSL ok!
 +
</syntaxhighlight>
 +
 
 +
AGORA A PORRA FICOU SÉRIA DI NOVO .... HD SE FOI ... E NÃO SAI DO GRUB ..
 +
 
 +
 
 +
'''22/03/2013'''
 +
 
 +
Configuração DHCP ---
 +
apt-get install dhcp3-server
 +
----
 +
<syntaxhighlight lang=c>
 +
shared-network LOCAL-NET {
 +
        option domain-name "equipe2.sj.ifsc.edu.br";
 +
        option domain-name-servers 192.168.1.113, 8.8.8.8;
 +
        subnet 10.0.0.0 netmask 255.255.255.0 {
 +
                option routers 200.135.37.97;
 +
                range 10.0.0.100 10.0.0.200;
 +
        }
 +
        group                host printer {
 +
                        hardware ethernet 00:08:54:45:2e:04;
 +
                        fixed-address 10.0.0.1;
 +
                }
 +
        }
 +
}
 +
</syntaxhighlight>
 +
----
 +
 
 +
 
 +
'''OPENVPN SERVIDOR'''
 +
<syntaxhighlight lang=c>
 +
apt-get install openvpn bridge-utils
 +
cp -R /usr/share/doc/openvpn/examples/easy-rsa/2.0/
 +
/etc/openvpn
 +
sysctl net.ipv4.ip forward=1
 +
iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
 +
 
 +
</syntaxhighlight>
 +
 
 +
<syntaxhighlight lang=c>
 +
/etc/openvpn/2.0/vars:
 +
Chaves exportadas
 +
 
 +
KEY_COUNTRY="BR"
 +
KEY_PROVINCE="SC"
 +
KEY_CITY="SaoJose"
 +
KEY_ORG="IFSC"
 +
KEY_EMAIL="admin@equipe2.sj.ifsc.edu.br"
 +
</syntaxhighlight>
 +
 
 +
'''Script para iniciar as chaves autorizadoras'''
 +
 
 +
<syntaxhighlight lang=c>
 +
cd /etc/openvpn/2.0/
 +
source vars
 +
./clean-all
 +
./build-dh
 +
./pkitool --initca
 +
./pkitool --server servidor
 +
cd keys
 +
openvpn --genkey --secret ta.key
 +
</syntaxhighlight>
 +
 
 +
----
 +
 
 +
'''Certificados'''
 +
 
 +
<syntaxhighlight lang=c>
 +
cd /etc/openvpn/2.0/
 +
source vars
 +
./pkitool cliente
 +
</syntaxhighlight>
 +
----
 +
 
 +
'''Chaves Cliente'''
 +
 
 +
<syntaxhighlight lang=c>
 +
ta.key
 +
ca.crt
 +
cliente1.crt
 +
cliente1.key
 +
</syntaxhighlight>
 +
 
 +
'''Chaves Servidor'''
 +
<syntaxhighlight lang=c>
 +
 
 +
ta.key
 +
ca.crt
 +
ca.key
 +
dh1024.pem
 +
servidor.crt
 +
servidor.key
 +
</syntaxhighlight>
 +
 
 +
'''Server.conf'''
 +
<syntaxhighlight lang=c>
 +
 
 +
local 10.0.0.1
 +
port 1194
 +
proto udp
 +
dev tap0
 +
up "/etc/openvpn/up.sh br0 tap0 1500"
 +
down "/etc/openvpn/down.sh br0 tap0"
 +
ca ca.crt
 +
cert server.crt
 +
key server.key
 +
dh dh1024.pem
 +
ifconfig-pool-persist ipp.txt
 +
server-bridge 10.0.0.100 255.255.255.0  10.0.0.100 10.0.0.200
 +
push "redirect-gateway def1"
 +
push "dhcp-option DNS 8.8.8.8"
 +
keepalive 10 120
 +
tls-auth ta.key 0 # This file is secret
 +
comp-lzo
 +
user nobody
 +
group nogroup
 +
persist-key
 +
persist-tun
 +
status openvpn-status.log
 +
verb 3
 +
 
 +
</syntaxhighlight>
 +
 
 +
'''Adicionar Tap0 na bridge /etc/openvpn/up.sh'''
 +
 
 +
<syntaxhighlight lang=c>
 +
#!/bin/bash
 +
BR=$1
 +
DEV=$2
 +
MTU=$3
 +
 
 +
/sbin/ip link set $DEV up promisc on mtu $MTU
 +
/usr/sbin/brctl addif $BR $DEV
 +
</syntaxhighlight>
 +
 
 +
'''Desativar interface quando desligar servidor /etc/openvpn/down.sh'''
 +
<syntaxhighlight lang=c>
 +
#!/bin/sh
 +
BR=$1
 +
DEV=$2
 +
 
 +
/usr/sbin/brctl delif $BR $DEV
 +
/sbin/ip link set $dev down
 +
</syntaxhighlight>
 +
 
 +
'''Interface de rede do servidor /etc/network/interfaces'''
 +
<syntaxhighlight lang=c>
 +
auto lo eth1 br0
 +
iface lo inet loopback
 +
 
 +
iface br0 inet static
 +
address 10.0.0.1
 +
netmask 255.255.255.0
 +
gateway 192.168.1.1
 +
bridge_ports eth0
 +
bridge_fd 9
 +
bridge_hello 2
 +
bridge_maxage 12
 +
bridge_stp off
 +
 
 +
iface eth0 inet manual
 +
up ip link set $IFACE up promisc on
 +
down ip link set $IFACE down promisc off
 +
 
 +
iface eth1 inet static
 +
address 192.168.1.113
 +
netmask 255.255.255.0
 +
</syntaxhighlight>
 +
 
 +
'''OPENVPN CLIENTE'''
 +
<syntaxhighlight lang=c>
 +
cp -r /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn
 +
</syntaxhighlight>
 +
 
 +
'''Script de verificação do serviço'''
 +
 
 +
<syntaxhighlight lang=c>
 +
 
 +
#!/bin/bash
 +
 +
TEMPOPENVPN=$(ps -ef | grep openvpn | wc -l)
 +
TEMPFREERADIUS=$(ps -ef | grep freeradius | wc -l)
 +
TEMPDNS=$(ps -ef | grep bind | wc -l)
 +
 +
if [ ${TEMOPENPVPN} -lt "2" ]; then
 +
echo "" >> /var/log/equipe2.log
 +
date >> /var/log/equipe2.log
 +
echo "" >> /var/log/equipe2.log
 +
/etc/init.d/openvpn restart >> /var/log/equipe2.log
 +
fi
 +
 +
if [ ${TEMPFREERADIUS} -lt "2" ]; then
 +
echo "" >> /var/log/equipe2.log
 +
date >> /var/log/equipe2.log
 +
echo "" >> /var/log/equipe2.log
 +
/etc/init.d/freeradius restart >> /var/log/equipe2.log
 +
fi
 +
 +
if [ ${TEMPDNS} -lt "2" ]; then
 +
echo "" >> /var/log/equipe2.log
 +
date >> /var/log/equipe2.log
 +
echo "" >> /var/log/equipe2.log
 +
/etc/init.d/bind9 restart >> /var/log/equipe2.log
 +
fi
 +
</syntaxhighlight>
 +
 
 +
'''23/03/2013'''
 +
 
 +
Script Backup Cruzado:
 +
'''
 +
Crontab'''
 +
<syntaxhighlight lang=c>
 +
0 8 * * * /etc/backup.sh
 +
</syntaxhighlight>
 +
 
 +
obs: Havendo autenticação entre a matriz e a filial via keychain, segue abaixo as scripts para backup.
 +
 
 +
'''Matriz'''
 +
<syntaxhighlight lang=c>
 +
#!/bin/bash
 +
 
 +
 
 +
tar -cvzf /home/backup/openvpn.tar /etc/openvpn
 +
tar -cvzf /home/backup/dns.tar /etc/bind
 +
tar -cvzf /home/backup/dhcp /etc/dhcp3
 +
 
 +
scp -r /home/backup root@10.0.0.101:/home/backup-server
 +
</syntaxhighlight>
 +
 
 +
'''Filial'''
 +
<syntaxhighlight lang=c>
 +
#!/bin/bash
 +
 
 +
 
 +
tar -cvzf /home/backup/openvpn.tar /etc/openvpn
 +
tar -cvzf /home/backup/dns.tar /etc/bind
 +
tar -cvzf /home/backup/dhcp /etc/dhcp3
 +
 
 +
scp -r /home/backup root@10.0.0.1:/home/backup-filial
 +
</syntaxhighlight>
 +
'''
 +
Diagrama da Rede'''
 +
 
 +
[[Arquivo:Diagrama da Rede.jpg]]

Edição atual tal como às 16h39min de 23 de março de 2013

Inicio do Projeto Integrador:

Telecom.jpg



EQUIPE 2:
Jeferson Baixo
Leando Rodrigues
Renan Rodolfo 
Vinícius Pléticos

06/03/2013


--Divisão das equipes Pelo professor Paula Mafra... Pegamos o material necessário para o projeto na sala de apoio: CPU's, monitores... Instalação do Ubuntu 10.04.4 Server na Matriz e Filial. Configuração dos IP's:

Matriz: 192.168.1.113 Será substituido por um ip válido, fornecido pelo Torresine.
Filial: 192.168.1.114 Será substituido por um ip válido, fornecido pelo Torresine.

Configuração do DNS: Servidor - equipe2.sj.ifsc.edu.br


Named.conf.local

zone "equipe2.sj.ifsc.edu.br"   {
     type master;
     file "/etc/bind/zones/aula.zone";
      };

zone "subdominio.equipe2.sj.ifsc.edu.br" IN {
     type slave;
     file "slave/slave.subdominio.equipe2.sj.ifsc.edu.br";
     masters {192.168.1.113;};
     // secundario (slave) do dominio delegado

};
zone "1.168.192.in-addr.arpa" {
     type master;
     file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";
};


Aula.Zone

----
@   IN  SOA ns1.equipe2.sj.ifsc.edu.br. admin.ns1.equipe2.sj.ifsc.edu.br. (
	2011091401 ; Serial
	28800 ; Refresh
	3600 ; Retry
	604800 ; Expire
	38400 ) ; Default TTL
 NS	ns1.equipe2.sj.ifsc.edu.br.
 NS	ns2.equipe2.sj.ifsc.edu.br.
 MX	10 mta.equipe2.sj.ifsc.edu.br.
 IN	A 192.168.1.113

$ORIGIN equipe2.sj.ifsc.edu.br.
ns1	IN	A	192.168.1.113
ns2	IN	A	192.168.1.115
mta	IN	A	192.168.1.113
www	IN	A	192.168.1.113
web	IN	CNAME	www

Arquivo Reverso

$ORIGIN 1.168.192.in-addr.arpa.
@  IN  SOA ns1.equipe2.sj.ifsc.edu.br. admin.ns1.equipe2.sj.ifsc.edu.br. (
2011091401;
28800;
604800;
604800;
86400 )

	IN	NS	ns1.equipe2.sj.ifsc.edu.br.
	IN	NS	ns2.equipe2.sj.ifsc.edu.br.
113	IN	PTR	ns1.equipe2.sj.ifsc.edu.br.
115	IN	PTR	ns2.equipe2.sj.ifsc.edu.br.
113	IN	PTR	mta.equipe2.sj.ifsc.edu.br.
113	IN	PTR	www.equipe2.sj.ifsc.edu.br.

Resolv.comf


nameserver 192.168.1.113
nameserver 8.8.8.8
nameserver 192.168.1.1


07/03/2013

--Explicação da parte de IER dada pelo Sobral Iniciamos a instalação da rede VPN, utilizando o OpenVPN.

08/03/2013

Instalando VPN.

apt-get install openvpn
apt-get install openvpn bridge-utils

11/03/2013

Ainda tentando instalar VPN ... Está dando erro ao iniciar o cliente.

13/03/2013

Termino da instalação do VPN..

IP Interno Matriz: 10.0.0.1
IP Externo Matriz: 192.168.1.133

IP Interno Filial: 10.0.0.101


Certificações necessárias para rodar corretamente.


"ca.crt" Todo problema estava aqui ...
 ca.key
 filial.crt
 filial.key
 server.conf
 filial.conf
 ta.key
 server.key
 server.crt
 dh1024.pem

Instalado Modem DHDSL DT2048, Já está sincronizado com o servidor de acesso.

14/03/2013

>>> Prova Com Sobral, sem Projeto Integrador.

15/03/2013

HD Queimou, Necessitando instalar tudo novamente no servidor.

18/03/2013

OpenVpn Funcionando, Tap0 e br0 Configurados e ativos.


IP: 200.135.37.97


20/03/2013

Instalar servidor FreeRadius


apt-get install freeradius freeradius-mysql
apt-get install mysql-server
Instalação da rede ADSL para a filial.

Configuração do roteador da Matriz, um CISCO 2500.
-noshutdown na s0 e na e0
-IP válido configurado na s0
-Link up Protocol up
-IP interno configurado na e0
-Link up Protocol up

'''21/03/2013'''

Término da instalação do link ADSL da filial
-Refeitos os patchpanel de ambos os laboratórios
-Trocada a porta do DSLAN, a anterior apresentava problema.
-Trocada a porta do patchpanel do lado da matriz, a antrior apresentava problemas.
-Link ADSL ok!

AGORA A PORRA FICOU SÉRIA DI NOVO .... HD SE FOI ... E NÃO SAI DO GRUB ..


22/03/2013

Configuração DHCP --- apt-get install dhcp3-server


shared-network LOCAL-NET {
        option domain-name "equipe2.sj.ifsc.edu.br";
        option domain-name-servers 192.168.1.113, 8.8.8.8;
        subnet 10.0.0.0 netmask 255.255.255.0 {
                option routers 200.135.37.97;
                range 10.0.0.100 10.0.0.200;
        }
        group                 host printer {
                        hardware ethernet 00:08:54:45:2e:04;
                        fixed-address 10.0.0.1;
                }
        }
}


OPENVPN SERVIDOR

apt-get install openvpn bridge-utils
cp -R /usr/share/doc/openvpn/examples/easy-rsa/2.0/
/etc/openvpn
sysctl net.ipv4.ip forward=1
iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
/etc/openvpn/2.0/vars:
Chaves exportadas

KEY_COUNTRY="BR"
KEY_PROVINCE="SC"
KEY_CITY="SaoJose"
KEY_ORG="IFSC"
KEY_EMAIL="admin@equipe2.sj.ifsc.edu.br"

Script para iniciar as chaves autorizadoras

cd /etc/openvpn/2.0/
source vars
./clean-all
./build-dh
./pkitool --initca
./pkitool --server servidor
cd keys
openvpn --genkey --secret ta.key

Certificados

cd /etc/openvpn/2.0/
source vars
./pkitool cliente

Chaves Cliente

ta.key
ca.crt
cliente1.crt
cliente1.key

Chaves Servidor

ta.key
ca.crt
ca.key
dh1024.pem
servidor.crt
servidor.key

Server.conf

local 10.0.0.1
port 1194
proto udp
dev tap0
up "/etc/openvpn/up.sh br0 tap0 1500"
down "/etc/openvpn/down.sh br0 tap0"
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
ifconfig-pool-persist ipp.txt
server-bridge 10.0.0.100 255.255.255.0  10.0.0.100 10.0.0.200
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
keepalive 10 120
tls-auth ta.key 0 # This file is secret
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3

Adicionar Tap0 na bridge /etc/openvpn/up.sh

#!/bin/bash
BR=$1
DEV=$2
MTU=$3

/sbin/ip link set $DEV up promisc on mtu $MTU
/usr/sbin/brctl addif $BR $DEV

Desativar interface quando desligar servidor /etc/openvpn/down.sh

#!/bin/sh
BR=$1
DEV=$2

/usr/sbin/brctl delif $BR $DEV
/sbin/ip link set $dev down

Interface de rede do servidor /etc/network/interfaces

auto lo eth1 br0
iface lo inet loopback 

iface br0 inet static
	address 10.0.0.1
	netmask 255.255.255.0
	gateway 192.168.1.1
	bridge_ports eth0
	bridge_fd 9
	bridge_hello 2
	bridge_maxage 12
	bridge_stp off

iface eth0 inet manual 
	up ip link set $IFACE up promisc on
	down ip link set $IFACE down promisc off

iface eth1 inet static
	address 192.168.1.113
	netmask 255.255.255.0

OPENVPN CLIENTE

cp -r /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn

Script de verificação do serviço

#!/bin/bash
 
TEMPOPENVPN=$(ps -ef | grep openvpn | wc -l)
TEMPFREERADIUS=$(ps -ef | grep freeradius | wc -l)
TEMPDNS=$(ps -ef | grep bind | wc -l)
 
if [ ${TEMOPENPVPN} -lt "2" ]; then
echo "" >> /var/log/equipe2.log
date >> /var/log/equipe2.log
echo "" >> /var/log/equipe2.log
	/etc/init.d/openvpn restart >> /var/log/equipe2.log
fi
 
if [ ${TEMPFREERADIUS} -lt "2" ]; then
echo "" >> /var/log/equipe2.log
date >> /var/log/equipe2.log
echo "" >> /var/log/equipe2.log
	/etc/init.d/freeradius restart >> /var/log/equipe2.log
fi
 
if [ ${TEMPDNS} -lt "2" ]; then
echo "" >> /var/log/equipe2.log
date >> /var/log/equipe2.log
echo "" >> /var/log/equipe2.log
	/etc/init.d/bind9 restart >> /var/log/equipe2.log
fi

23/03/2013

Script Backup Cruzado: Crontab

0 8 * * * /etc/backup.sh

obs: Havendo autenticação entre a matriz e a filial via keychain, segue abaixo as scripts para backup.

Matriz

#!/bin/bash


tar -cvzf /home/backup/openvpn.tar /etc/openvpn
tar -cvzf /home/backup/dns.tar /etc/bind
tar -cvzf /home/backup/dhcp /etc/dhcp3

scp -r /home/backup root@10.0.0.101:/home/backup-server

Filial

#!/bin/bash


tar -cvzf /home/backup/openvpn.tar /etc/openvpn
tar -cvzf /home/backup/dns.tar /etc/bind
tar -cvzf /home/backup/dhcp /etc/dhcp3

scp -r /home/backup root@10.0.0.1:/home/backup-filial

Diagrama da Rede

Diagrama da Rede.jpg