Projeto Integrador - 2012.2 - Equipe 1
Global Telecom

First Day 06/03
- Formatação e instalação dos Servidores da Matriz e da Filial.
IP Matriz: 192.168.1.228
IP Filial: 192.168.1.227
- DNS Matriz configurado ok:
zone "equipe1.sj.ifsc.edu.br" {
type master;
file "/etc/bind/zones/aula.zone";
};
// Secundário (slave) do domínio delegado
zone "filial.equipe1.sj.ifsc.edu.br" IN {
type slave;
file "slave.equipe1.sj.ifsc.edu.br";
masters {192.168.1.228;};
};
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";
};
- DNS Filial configurado ok:
zone "equipe1.sj.ifsc.edu.br" {
type master;
file "/etc/bind/zones/aula.zone";
};
// Secundário (slave) do domínio delegado
zone "filial.equipe1.sj.ifsc.edu.br" IN {
type slave;
file "slave.equipe1.sj.ifsc.edu.br";
masters {192.168.1.228;};
};
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";
};
> Foi dado inicio a instalação do openvpn na máquina da filial.
Second Day 07/03
- Configuração SMTP
myhostname = globaltelecom
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8 10.0.2.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
mydomain = equipe1.sj.ifsc.edu.br
myorigin = $mydomain
home_mailbox = Maildir/
message_size_limit = 10240000
body_checks = regexp:/etc/postfix/block_words
- Foi criado os usuários de e-mail renan@equipe1.sj.ifsc.edu.br, filipe@equipe1.sj.ifsc.edu.br e gustavo@equipe1.sj.ifsc.edu.br. Foram realizado testes e os e-mail chegaram ok.
renan@equipe1.sj.ifsc.edu.br | felipe@equipe1.sj.ifsc.edu.br | gustavo@equipe1.sj.ifsc.edu.br |
- Pasta de e-mail:
/$usuario/Maildir
Third Day 08/03
- Configuração DHCP
apt-get install dhcp3-server
O MAC do hardware ethernet é da eth0 da filial.
shared-network LOCAL-NET {
option domain-name "equipe1.sj.ifsc.edu.br";
option domain-name-servers 192.168.1.228, 8.8.8.8;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
range 10.0.0.220 10.0.0.240;
}
group {
host printer {
hardware ethernet 00:08:54:45:2e:04;
fixed-address 10.0.0.225;
}
}
}
- Configuração RADIUS
apt-get install freeradius freeradius-mysql
apt-get install mysql-server
# Connection info:
server = "localhost"
#port = 3306
login = "root"
password = "*****"
# Database table configuration for everything except Oracle
radius_db = "radius"
root@matriz:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 84
Server version: 5.1.67-0ubuntu0.10.04.1 (Ubuntu)
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use radius;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from radcheck;
+----+----------+-----------+----+---------+
| id | username | attribute | op | value |
+----+----------+-----------+----+---------+
| 1 | gustavo | Password | == | ******* |
| 2 | filipe | Password | == | ******* |
| 3 | renan | Password | == | ******* |
| 4 | rodrigo | Password | == | ******* |
| 5 | andrei | Password | == | ******* |
+----+----------+-----------+----+---------+
5 rows in set (0.00 sec)
</syntaxhighlight>
- Criado o arquivo de backup de configurações da central
/home/scripts/backupALL
- Criado a script de restabelecimento do serviço DNS:
/home/scripts/testeDNS
Fourth Day 11/03
- Configurado o IP externo da máquina:
eth0 Link encap:Ethernet HWaddr 00:1a:4d:a5:16:34
inet addr:200.135.37.95 Bcast:200.135.37.127 Mask:255.255.255.192
inet6 addr: fe80::21a:4dff:fea5:1634/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:173 errors:0 dropped:0 overruns:0 frame:0
TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14701 (14.7 KB) TX bytes:10447 (10.4 KB)
Interrupt:26 Base address:0xc000
- Rota
root@matriz:/home/administrador# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
200.135.37.64 0.0.0.0 255.255.255.192 U 0 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 200.135.37.126 0.0.0.0 UG 0 0 0 eth0
</syntaxhighlight>
Fifth Day 12/03
- Filial apresentou problemas no HD, executado o FSCK na partição /.
- Configuração do modem ADSL está com problemas, não estabelece link PPPoE
Sixth, Seventh and Eighth Day 13,15,18/03
- Configurado o modem ADSL que liberou acesso externo ao servidor:
- Configuração do modem na filial:
- Realizado as scripts de verificações dos serviços:
#!/bin/bash
TEMPVPN=$(ps -ef | grep vpn | wc -l)
TEMPRADIUS=$(ps -ef | grep radius | wc -l)
TEMPDNS=$(ps -ef | grep bind | wc -l)
if [ ${TEMPVPN} -lt "2" ]; then
date >> /var/log/projeto.log
/etc/init.d/openvpn restart >> /var/log/projeto.log
echo "" >> /var/log/projeto.log
fi
if [ ${TEMPRADIUS} -lt "2" ]; then
date >> /var/log/projeto.log
/etc/init.d/freeradius restart >> /var/log/projeto.log
echo "" >> /var/log/projeto.log
fi
if [ ${TEMPDNS} -lt "2" ]; then
date >> /var/log/projeto.log
/etc/init.d/bind9 restart >> /var/log/projeto.log
echo "" >> /var/log/projeto.log
fi
- Criado arquivo /var/log/projeto.log com as informações dos serviços de SLA:
## Arquivo de log dos processos OpenVPN, FreeRadius e DNS ##
Seg Mar 18 20:59:25 BRT 2013
* Stopping virtual private network daemon(s)...
* No VPN is running.
* Starting virtual private network daemon(s)...
* Autostarting VPN 'server'
...fail!
Seg Mar 18 20:59:26 BRT 2013
* Stopping FreeRADIUS daemon freeradius
* /var/run/freeradius/freeradius.pid not found...
...done.
* Starting FreeRADIUS daemon freeradius
- Habilitado o acesso remoto
root@matriz:/home/administrador# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e1:c5:ed:30:22:dc:1d:75:f3:8a:64:af:dd:69:b1:66 root@matriz
The key's randomart image is:
+--[ RSA 2048]----+
| ... o |
| . . o o . o |
| o + * + .|
| o + * o . |
| S o o. |
| o .+|
| . .E.|
| + |
| |
+-----------------+
root@matriz:~/.ssh# scp -p id_rsa.pub projeto@10.1.1.130:/root/.ssh/authorized_keys
-> Dentro do arquivo: /etc/ssh/sshd_config
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
Final - Projeto integrador (19 à 22/03)
- Verificações de Serviço (SLA)
→ A scritp está na página da Equipe 1 desde o dia 15/03. O arquivo /var/log/projeto.log não foi solicitado pelo professor, foi apenas um EXTRA que realizamos. Se retirar o mesmo, a script é executada sem nenhum problema. No registro do dia 15/03, existe um trecho do log gerado.
#!/bin/bash
TEMPVPN=$(ps -ef | grep vpn | wc -l)
TEMPRADIUS=$(ps -ef | grep radius | wc -l)
TEMPDNS=$(ps -ef | grep bind | wc -l)
if [ ${TEMPVPN} -lt "2" ]; then
date >> /var/log/projeto.log
/etc/init.d/openvpn restart >> /var/log/projeto.log
echo "" >> /var/log/projeto.log
fi
if [ ${TEMPRADIUS} -lt "2" ]; then
date >> /var/log/projeto.log
/etc/init.d/freeradius restart >> /var/log/projeto.log
echo "" >> /var/log/projeto.log
fi
if [ ${TEMPDNS} -lt "2" ]; then
date >> /var/log/projeto.log
/etc/init.d/bind9 restart >> /var/log/projeto.log
echo "" >> /var/log/projeto.log
fi
- Backup remoto entre matriz e filial
→ A script é da matriz para a filial. Da filial para a matriz, é apenas alterado o IP.
#!/bin/bash
date=$(date |awk '{print $3 $2}')
DESTINO="200.135.37.96:/var/backupGeral"
ssh 200.135.37.96 mkdir /var/backupGeral/${date}
ORIGEM1="/etc/"
ORIGEMUSERS="/home/"
scp -r ${ORIGEM1} ${DESTINO}/${date}
scp -r ${ORIGEMUSERS} ${DESTINO}/${date}
→ O máximo de backup realizado é de 7. Quando um novo backup é gerado e ultrapassa o limite, o backup mais antigo é apagado. Este script roda na própria máquina.
remove=$(ls -ltr /var/backupGeral/ |tail -8 |head -1 | awk '{print $8}')
rm -rf /var/backupGeral/${remove}
- Configuração named.conf.local
zone "equipe1.sj.ifsc.edu.br" {
type master;
file "/etc/bind/zones/aula.zone";
};
// Secundário (slave) do domínio delegado
// zone "filial.equipe1.sj.ifsc.edu.br" IN {
// type slave;
// file "slave.equipe1.sj.ifsc.edu.br";
// masters {200.135.37.95;};
// };
zone "37.135.200.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.37.135.200.in-addr.arpa";
};
- Configuração aula.zone
$TTL 86400
$ORIGIN equipe1.sj.ifsc.edu.br.
@ IN SOA ns1.equipe1.sj.ifsc.edu.br. admin.ns1.equipe1.sj.ifsc.edu.br. (
2013032201 ; Serial
28800 ; Refresh
3600 ; Retry
604800 ; Expire
38400 ) ; Default TTL
NS ns1.equipe1.sj.ifsc.edu.br.
; NS ns2.equipe1.sj.ifsc.edu.br.
MX 10 mta.equipe1.sj.ifsc.edu.br.
IN A 200.135.37.95
ns1 IN A 200.135.37.95
mta IN A 200.135.37.95
dns IN A 200.135.37.95
;ns2 IN A 10.1.1.2
mail IN A 200.135.37.95
www IN A 200.135.37.95
web IN CNAME www
;$ORIGIN filial.equipe1.sj.ifsc.edu.br.
; definicao dos dois servidores de nome
;@ IN NS ns3.filial.equipe1.sj.ifsc.edu.br
; o proximo servidor aponta para o servidor acima (slave)
;IN NS ns1.filial.equipe1.sj.ifsc.edu.br.
; endereco do servidor do subdominio
;ns3 IN A 200.135.37.96
- Configuração rev.37.135.200.in-addr.arpa
$TTL 86400
$ORIGIN 37.135.200.in-addr.arpa.
@ IN SOA dns1.equipe1.sj.ifsc.edu.br. admin.dns1.equipe1.sj.ifsc.edu.br. (
2013022101; serial
8h; refresh
1w; retry
1w; expire
1d ) ;negative cache ttl
IN NS dns.equipe1.sj.ifsc.edu.br.
; IN NS ns2.equipe1.sj.ifsc.edu.br.
95 IN PTR dns.equipe1.sj.ifsc.edu.br.
;96 IN PTR ns2.equipe1.sj.ifsc.edu.br.
95 IN PTR mail.equipe1.sj.ifsc.edu.br.
95 IN PTR www.equipe1.sj.ifsc.edu.br.
- Configuração resolv.conf
nameserver 200.135.37.95
search equipe1.sj.ifsc.edu.br
- Configuração interfaces
# The loopback network interface
auto lo eth1 br0
iface lo inet loopback
# The primary network interface
iface br0 inet static
address 10.1.1.2
netmask 255.255.255.0
gateway 10.1.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 10.0.0.1
netmask 255.255.255.0
- Configuração dhcpd.conf
shared-network LOCAL-NET {
option domain-name "equipe1.sj.ifsc.edu.br";
option domain-name-servers 10.1.1.2, 8.8.8.8;
subnet 10.1.1.0 netmask 255.255.255.0 {
option routers 10.1.1.1;
range 10.1.1.3 10.1.1.200;
}
group {
host printer {
hardware ethernet 00:08:54:45:2e:05;
fixed-address 10.0.0.2;
}
}
}
Testado o AP, conseguimos se autentificar na rede usando uma senha WPA-EAP, pegando o IP 10.1.1.6 (configurado no DHCP), conforme imagem abaixo:
- Script para gerar relatorio informando usuários logados no sistema:
# Varivel com a data. Formato mes/dia
DATECR=$(date |awk '{print $2 $3}')
# Cria um arquivo na pasta de relatórios (criada antes de executar a script) com a data em formato texto.
touch /var/log/relatorios/${DATECR}.txt
# Varialvel com a data da central.
DATE=$(date)
# Escreve o horário em que o relatório é gerado.
echo "Relatório gerado as: ${DATE}" >> /var/log/relatorios/${DATECR}.txt
echo " " >> /var/log/relatorios/${DATECR}.txt
# Descritivo de como é gerado o relatório, para a pessoa que ver, enderder o mesmo.
echo "O relatório é gerado da seguinte forma:" >> /var/log/relatorios/${DATECR}.txt
echo "Usuário Mes Dia Horário" >> /var/log/relatorios/${DATECR}.txt
echo "________________________________________" >> /var/log/relatorios/${DATECR}.txt
echo " " >> /var/log/relatorios/${DATECR}.txt
# Lista o histórico de usuários logados no sistema, pegando apenas o usuário, mes, dia e horário do login.
last |grep -v '^reboot' |grep -v '^wtmp' |awk '{print $1 " " $5 " " $6 " " $7}' >> /var/log/relatorios/${DATECR}.txt
O resultado da script executada:
- Script para derrubar o usuário logado no sistema:
#!/bin/bash
# Pega apenas a quantidade de usuários, tira a linha do titulo e data
LINHAS=$(w | wc -l)
LINHAS=$(echo "${LINHAS} - 2" | bc)
# Pega o nome dos usuarios, sem as primeiras linhas q são data e título
USUARIOS=$(w | awk '{print $1 " " $2}' | tail -${LINHAS})
echo "Usuários logados no sistema: "
echo ${USUARIOS}
echo ""
echo "Se deseja derrubar algum usuário digite o tty do usuário ou de um enter para fechar o programa: "
read TTYUSER
if [ "${TTYUSER}" != "" ]; then
# Pega o número do processo do usuário
PROCESSO=$(ps aux | grep ${TTYUSER} | awk '{print $2}' | head -1)
echo ${PROCESSO}
if [ ${PROCESSO} -gt "0" ]; then
kill -9 ${PROCESSO}
fi
fi
- A script do relatório de login e para derrubar o mesmo foram realizado no:
- Topologia da rede:
Assinatura abaixo - Página editada pela última vez às:
--Filipe.cs 22h03min de 23 de março de 2013 (BRT) //// Renan de Souza Fagundes
Lista de comandos
- tar:
tar -xvf nomedoarquivo.tar
- ssh:
/etc/init.d/ssh start/stop/restart
- network:
/etc/init.d/networking restart
- Acesso:
/etc/ssh/sshd_config
PermitRootLogin no
/etc/init.d/ssh start/stop/restart
- Imagem: PI_-_Topologia_da_Rede(3).jpg