Mudanças entre as edições de "Projeto Integrador - 2010.2 - Equipe Ritz"
(124 revisões intermediárias por 2 usuários não estão sendo mostradas) | |||
Linha 33: | Linha 33: | ||
* Sistema Operacional: Ubuntu Linux Server 9.10 | * Sistema Operacional: Ubuntu Linux Server 9.10 | ||
+ | ====Equipamentos==== | ||
+ | * MODEM D-LINK 500B | ||
+ | * DSLAN - DAS3324 | ||
+ | * Placa wifi ATHEROS comunication AR500IXplus | ||
====Particionamento do sistema==== | ====Particionamento do sistema==== | ||
Linha 43: | Linha 47: | ||
/dev/sda4 4GB SWAP swap | /dev/sda4 4GB SWAP swap | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | [[Imagem:24112010020.jpg]][[Imagem:24112010047.jpg]] | |
====Configurações de rede==== | ====Configurações de rede==== | ||
Linha 62: | Linha 66: | ||
====Cabeamento==== | ====Cabeamento==== | ||
− | * Definido padrão | + | * Definido padrão 568-B para todo o cabeamento da equipe Ritz; |
* Todos os cabos equipe Ritz categoria 5e; | * Todos os cabos equipe Ritz categoria 5e; | ||
* Crimpados os conectores RJ-45 Machos em uma das pontas de cada ponto (chão, alto e parede), e fêmeas nas outras pontas; | * Crimpados os conectores RJ-45 Machos em uma das pontas de cada ponto (chão, alto e parede), e fêmeas nas outras pontas; | ||
* Conectato o cabo principal do Patch Panel Equipe Ritz, ao patch panel a (equipe Celtics); | * Conectato o cabo principal do Patch Panel Equipe Ritz, ao patch panel a (equipe Celtics); | ||
+ | |||
+ | [[Imagem:25112010050.jpg]] [[Imagem:25112010053.jpg]] | ||
====Equipamento==== | ====Equipamento==== | ||
Linha 79: | Linha 85: | ||
* Fizemos então o acabamento (fixação do patch panel em definitivo no rack, encaixe dos conectores fêmeas nos suportes de chão e de parede, marcação das pontas dos cabos) e depois refizemos todos os testes. | * Fizemos então o acabamento (fixação do patch panel em definitivo no rack, encaixe dos conectores fêmeas nos suportes de chão e de parede, marcação das pontas dos cabos) e depois refizemos todos os testes. | ||
* Todos os pontos e a porta 10 do patch panel foram testados e aprovados. | * Todos os pontos e a porta 10 do patch panel foram testados e aprovados. | ||
+ | [[Imagem:29112010059.jpg]] [[Imagem:29112010065.jpg]] | ||
+ | [[Imagem:29112010060.jpg]] [[Imagem:29112010067.jpg]] | ||
+ | |||
+ | RACK PRINCIPAL: | ||
+ | |||
+ | -Path painel do DSLAM | ||
+ | |||
+ | PORTA 1 corresponde a porta 24 no DSLAM | ||
+ | PORTA 2 corresponde a porta 22 no DSLAM | ||
+ | PORTA 3 corresponde a porta 20 no DSLAM | ||
+ | PORTA 4 corresponde a porta 18 no DSLAM | ||
====Instalação dos softwares==== | ====Instalação dos softwares==== | ||
Linha 89: | Linha 106: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * Configurando interfaces - /etc/network/interfaces | + | * Configurando interfaces - '''/etc/network/interfaces''' |
<syntaxhighlight lang=lang="html4strict"> | <syntaxhighlight lang=lang="html4strict"> | ||
+ | |||
+ | |||
auto lo | auto lo | ||
iface lo inet loopback | iface lo inet loopback | ||
− | + | #auto eth0 | |
+ | #iface eth0 inet loopback | ||
+ | |||
# The primary network interface | # The primary network interface | ||
# Interface externa ip 200.135.37.100/26 | # Interface externa ip 200.135.37.100/26 | ||
auto eth0 | auto eth0 | ||
iface eth0 inet static | iface eth0 inet static | ||
− | + | address 200.135.37.100 | |
− | + | netmask 255.255.255.192 | |
− | + | broadcast 200.135.37.127 | |
− | + | network 200.135.37.64 | |
− | + | gateway 200.135.37.126 | |
# dns-* options are implemented by the resolvconf package, if installed | # dns-* options are implemented by the resolvconf package, if installed | ||
− | + | dns-nameservers 127.0.0.1 dns1.ritz.sj.ifsc.edu.br | |
− | + | dns-search ritz.sj.ifsc.edu.br | |
</syntaxhighlight> | </syntaxhighlight> | ||
− | * Arquivo de configuração dos servidores DNS que o sistema utilizara, no caso é a própria maquina pois ela sera um servidor também DNS - /etc/resolv.conf | + | * Arquivo de configuração dos servidores DNS que o sistema utilizara, no caso é a própria maquina pois ela sera um servidor também DNS - '''/etc/resolv.conf''' |
<syntaxhighlight lang=lang="html4strict"> | <syntaxhighlight lang=lang="html4strict"> | ||
search ritz.sj.ifsc.edu.br | search ritz.sj.ifsc.edu.br | ||
Linha 117: | Linha 138: | ||
− | * Configuração DNS - /etc/bind/named.conf.options | + | * Configuração DNS -''' /etc/bind/named.conf.options''' |
<syntaxhighlight lang=lang="html4strict"> | <syntaxhighlight lang=lang="html4strict"> | ||
options{ | options{ | ||
− | + | //todas as interfaces de rede | |
− | + | listen-on { any; }; | |
− | |||
− | + | //qualquer um pode perguntar | |
− | + | allow-query { any; }; | |
− | |||
− | |||
− | |||
− | + | //Quem pode perguntar sobre meus dominios | |
− | + | allow-query-cache { any; }; | |
+ | |||
+ | //Sobre dominio de terceiros, loopback e rede ifsc | ||
+ | allow-recursion { 127.0.0.0/8; 192.168.30.0/24; 192.168.31.0/24; }; | ||
+ | |||
+ | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * Configurando informações de domínio e de seu domínio reverso que no nossa caso é respectivamente "ritz.sj.ifsc.edu.br' | + | * Configurando informações de domínio e de seu domínio reverso que no nossa caso é respectivamente "ritz.sj.ifsc.edu.br' -''' /etc/bind/named.conf.local''' |
<syntaxhighlight lang=lang="html4strict"> | <syntaxhighlight lang=lang="html4strict"> | ||
+ | //Configuracao de dominio | ||
+ | |||
zone "ritz.sj.ifsc.edu.br" { | zone "ritz.sj.ifsc.edu.br" { | ||
type master; | type master; | ||
file "/etc/bind/ritz.sj.ifsc.edu.br"; | file "/etc/bind/ritz.sj.ifsc.edu.br"; | ||
}; | }; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * | + | * Criando o arquivo "ritz.sj.ifsc.edu.br" dentro da pasta "bind" - '''/etc/bind/ritz.sj.ifsc.edu.br''' |
<syntaxhighlight lang=lang="html4strict"> | <syntaxhighlight lang=lang="html4strict"> | ||
− | + | ; Configuracoes especificas para o dominio ritz.ifsc.edu.br | |
$TTL 86400 | $TTL 86400 | ||
− | @ | + | @ IN SOA dns1.ritz.sj.ifsc.edu.br. admin.ritz.sj.ifsc.edu.br. ( |
− | + | 2010120201 ; serial | |
− | + | 1d ; refresh | |
− | + | 1h ; retry | |
− | + | 1w ; expire | |
− | + | 1d ; negative cache ttl | |
− | |||
) | ) | ||
+ | @ IN NS dns1 | ||
+ | @ IN A 200.135.37.100 | ||
+ | @ IN MX 0 mail.ritz.sj.ifsc.edu.br. | ||
+ | dns1 IN A 200.135.37.100 | ||
+ | ns1 IN A 200.135.37.100 | ||
+ | mail IN A 200.135.37.100 | ||
+ | www IN A 200.135.37.100 | ||
+ | smtp IN CNAME mail.ritz.sj.ifsc.edu.br. | ||
+ | pop IN CNAME mail.ritz.sj.ifsc.edu.br. | ||
+ | imap IN CNAME mail.ritz.sj.ifsc.edu.br. | ||
+ | ssl IN CNAME www.ritz.sj.ifsc.edu.br. | ||
+ | cacti IN CNAME www.ritz.sj.ifsc.edu.br. | ||
+ | ;prevencao contra SPAM usando pacote spf1 | ||
+ | ritz.sj.ifsc.edu.br. IN TXT "v=spf1 mx -all" | ||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | |||
* Efetuando testes para a confirmação do funcionamento do DNS | * Efetuando testes para a confirmação do funcionamento do DNS | ||
Linha 237: | Linha 248: | ||
* 15 * * * root ntpdate -s ntp.cais.rnp.br | * 15 * * * root ntpdate -s ntp.cais.rnp.br | ||
* 23 * * * root ntpdate -s ntp.cais.rnp.br | * 23 * * * root ntpdate -s ntp.cais.rnp.br | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====DHCP==== | ||
+ | |||
+ | * Realizando a Instalação do pacote DHCP | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:~# aptitude install dhcp3 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Configurando o arquivo '''etc/dhcp3/dhcpd.conf''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #Integração com os outros serviços | ||
+ | # | ||
+ | # Atualizar alguma informação com origem no DNS? Nenhuma (none). | ||
+ | ddns-update-style none; | ||
+ | # | ||
+ | # O 'log' das atividades do servidor serão registradas pela 'facility' local7 - arquivo /var/log/sys | ||
+ | log | ||
+ | log-facility local7; | ||
+ | |||
+ | # Rede interna: 192.168.100.0/24 | ||
+ | subnet 192.168.30.0 netmask 255.255.255.0 { | ||
+ | # | ||
+ | # Faixa de IPs disponÃveis | ||
+ | range 192.168.30.1 192.168.30.100; | ||
+ | # | ||
+ | # Máscara de rede | ||
+ | option subnet-mask 255.255.255.0; | ||
+ | # | ||
+ | # | ||
+ | # Rotas | ||
+ | option routers 192.168.30.100; | ||
+ | # | ||
+ | # Servidores e domÃnios DNS | ||
+ | option domain-name-servers 192.168.30.100; | ||
+ | option domain-name "ritz.sj.ifsc.edu.br"; | ||
+ | |||
+ | default-lease-time 3600; | ||
+ | max-lease-time 14400; | ||
+ | |||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====SNMP==== | ||
+ | |||
+ | * Realizando a Instalação do pacote SNMP | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:~# aptitude install snmpd | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Configurando o arquivo '''/etc/snmp/snmpd.conf''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | rocommunity ritz | ||
+ | syslocation ritz-TI | ||
+ | syscontact root@ritz.sj.ifsc.edu.br | ||
+ | sysservices 72 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | ====Contabilização==== | ||
+ | |||
+ | =====CACTI===== | ||
+ | [[Imagem:Cacti.JPG]] | ||
+ | |||
+ | * Baixando o programa cacti | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | cd /usr/local/src | ||
+ | wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz | ||
+ | </syntaxhighlight> | ||
+ | * Instalando apache2, php5 e mysql-server | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | aptitude install apache2 php5 mysql-server | ||
+ | </syntaxhighlight> | ||
+ | * Instalando pacote para guardar dados de gráfico em texto | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | aptitude install rrdtool | ||
+ | </syntaxhighlight> | ||
+ | * Descompactando o pacote do cacti | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | cd /var/www | ||
+ | tar xzf /usr/local/src/cacti-0.8.7g.tar.gz | ||
+ | mv cacti-0.8.7g /cacti | ||
+ | </syntaxhighlight> | ||
+ | * Reiniciando apache2 para validar as configurações | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | /etc/init.d/apache2 restart | ||
+ | </syntaxhighlight> | ||
+ | * Instalando php5-mysql e php5-cli | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | aptitude install php5-mysql php5-cli | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Entrando no banco de dados e Listando as bases | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql -uroot -p | ||
+ | mysql> show databases; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criando a base do cacti e aplicando privilégio total | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> create database cacti; | ||
+ | mysql> grant all privileges on cacti.* to 'cactiadmin'@localhost identified by '********'; | ||
+ | mysql> flush privileges; | ||
+ | mysql> quit; | ||
+ | </syntaxhighlight> | ||
+ | * Configurado login e senha para acesso a base cacti | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | cd /var/www/cacti | ||
+ | vi include/config.php | ||
+ | (alterar na linha 29 e 30) | ||
+ | $database_type = "mysql"; | ||
+ | $database_default = "cacti"; | ||
+ | $database_hostname = "localhost"; | ||
+ | $database_username = "cactiadmin"; | ||
+ | $database_password = "*******"; | ||
+ | $database_port = "3306"; | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Adicionando na''' /etc/crontab''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | */5 * * * * www-data php /var/www/cacti/poller.php > /dev/null 2>&1 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Aplicando total permissão aos arquivos de log. | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/var/log/cacti# chmod 777 rrd.log | ||
+ | root@Ritz:/var/log/cacti# chmod 777 cacti.log | ||
+ | root@Ritz:/var/log/cacti# chmod 777 poller-error.log | ||
+ | </syntaxhighlight> | ||
+ | [[Imagem:Cacti11.JPG]] | ||
+ | [[Imagem:Cacti2.JPG]] | ||
+ | |||
+ | =====NTOP===== | ||
+ | [[Imagem:Ntop.JPG]] | ||
+ | |||
+ | * Instalando o pacote | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/var/www# aptitude install ntop | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Atribuindo senha para o administrador | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/var/www# ntop -A | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Rode ntop no servidor e abre um browser com o '''ip-do-servidor:3000'''. | ||
+ | [[Imagem:Ntop1.JPG]] | ||
+ | [[Imagem:Ntop2.JPG]] | ||
+ | [[Imagem:Ntop3.JPG]] | ||
+ | [[Imagem:Ntop4.JPG]][[Imagem:Ntop5.JPG]] | ||
+ | |||
+ | ==Dia: 01/12/2010 - 8º Dia== | ||
+ | |||
+ | ====Servidor==== | ||
+ | - Configurado o IP externo 200.135.37.100, para acesso remoto e fixado o servidor no RAK. | ||
+ | |||
+ | - Testado o DNS e configurado com o IP externo. | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/home/ritz# /etc/init.d/bind9 restart | ||
+ | * Stopping domain name service... bind9 [ OK ] | ||
+ | * Starting domain name service... bind9 [ OK ] | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==Dia: 02/12/2010 - 9º Dia== | ||
+ | |||
+ | TAREFAS sugeridas pelo Professor Marcelo Sobral. | ||
+ | |||
+ | 1) Ativar o link sem-fio (modo ad hoc) | ||
+ | - Pensar em como passar a informaação sobre Vlans através do link. | ||
+ | |||
+ | 2) Configurar as vlans nos switchs, para estruturar as LANs (as mesas, servidores/dsl) | ||
+ | |||
+ | 3) Ativar os links DSL | ||
+ | - Decifrar DSL LAN. | ||
+ | |||
+ | ====DSLAN==== | ||
+ | - Aberto máquina virtual windows, no qual foi baixado o EMS para gerenciar o DSLAN. | ||
+ | - Executado o EMSClient (Menu Iniciar -> Todos os Programas -> EMS Client), e fornecido o IP 192.168.1.101, com usuário root e senha admin123. | ||
+ | - Conseguimos abrir a interface do DSLAN e com a ajuda do manual estamos tentando configura-lo. | ||
+ | |||
+ | [[Imagem:Captura_de_tela-1.jpg]] [[Imagem:Captura_de_tela-2.jpg]] | ||
+ | [[Imagem:Dslan.jpg]] | ||
+ | |||
+ | |||
+ | |||
+ | ==Dia: 03/12/2010 - 10º Dia== | ||
+ | |||
+ | * Feito o cabo de interligação do patch panel com o dslan. (cabo manga) | ||
+ | |||
+ | [[Imagem:DSC00457.JPG]][[Imagem:DSC00444.JPG]] | ||
+ | [[Imagem:DSC00451.JPG]][[Imagem:DSC00460.JPG]] | ||
+ | ====MYSQL==== | ||
+ | |||
+ | * Baixando pacote | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | ritz@Ritz:~$ aptitude install mysql | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Logando no banco de dados | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | ritz@Ritz:~$ mysql -u root -p | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criando a base de dados ritz | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> create database ritz; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Listando as bases criadas | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> show databases; | ||
+ | +--------------------+ | ||
+ | | Database | | ||
+ | +--------------------+ | ||
+ | | information_schema | | ||
+ | | cacti | | ||
+ | | mysql | | ||
+ | | ritz | | ||
+ | +--------------------+ | ||
+ | 4 rows in set (0,00 sec) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Usando a base de dados ritz | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> use ritz; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criando a tabela administrador, com os dados de quem irá administrar a rede, tanto login e senha para entrar na interface gráfica. | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> create table administrador (cID INTEGER NOT NULL AUTO_INCREMENT, cNOME VARCHAR(40), | ||
+ | cTELEFONE VARCHAR (20), cLOGIN VARCHAR(40), cSENHA VARCHAR(40), PRIMARY KEY (cID)); | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Verificando as informações na tabela administrador | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> desc administrador; | ||
+ | +-----------+-------------+------+-----+---------+----------------+ | ||
+ | | Field | Type | Null | Key | Default | Extra | | ||
+ | +-----------+-------------+------+-----+---------+----------------+ | ||
+ | | cID | int(11) | NO | PRI | NULL | auto_increment | | ||
+ | | cNOME | varchar(40) | YES | | NULL | | | ||
+ | | cTELEFONE | varchar(20) | YES | | NULL | | | ||
+ | | cLOGIN | varchar(40) | YES | | NULL | | | ||
+ | | cSENHA | varchar(40) | YES | | NULL | | | ||
+ | +-----------+-------------+------+-----+---------+----------------+ | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Inserindo dados na tabela administrador | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> INSERT into administrador (cNOME, cTELEFONE, cLOGIN, cSENHA) VALUES ('Andreia Bunn', '4884588453', 'administrador', 'projetoritz'); | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Selecionando a tabela adminsitrador, para verificar os dados cadastrados | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> SELECT * FROM administrador; | ||
+ | +-----+--------------+------------+---------------+-------------+ | ||
+ | | cID | cNOME | cTELEFONE | cLOGIN | cSENHA | | ||
+ | +-----+--------------+------------+---------------+-------------+ | ||
+ | | 1 | Andreia Bunn | ********** | administrador | *********** | | ||
+ | +-----+--------------+------------+---------------+-------------+ | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Saindo do Banco de Dados | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> quit | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | * Para alterar informações no banco. Ex: alterar a senha na tela administrador de projetoritz para projeto integrador, no qual está associado ao nome Andreia Bunn. | ||
+ | |||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> update admninistrador set cSENHA='projetointegrador' WHERE cNOME='Andreia Bunn'; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criando a tabela usuários para cadastrados os usuários ADSL. | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> create table usuarios (cID INTEGER NOT NULL AUTO_INCREMENT,cNome VARCHAR(40), | ||
+ | cEmail VARCHAR(50), cTelefone VARCHAR(20), cUsuario VARCHAR(20), cSenha VARCHAR(20), PRIMARY KEY (cID)); | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Verificando as informações na tabela usuarios | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> desc usuarios; | ||
+ | +-----------+-------------+------+-----+---------+----------------+ | ||
+ | | Field | Type | Null | Key | Default | Extra | | ||
+ | +-----------+-------------+------+-----+---------+----------------+ | ||
+ | | cID | int(11) | NO | PRI | NULL | auto_increment | | ||
+ | | cNome | varchar(40) | YES | | NULL | | | ||
+ | | cEmail | varchar(50) | YES | | NULL | | | ||
+ | | cTelefone | varchar(20) | YES | | NULL | | | ||
+ | | cUsuario | varchar(20) | YES | | NULL | | | ||
+ | | cSenha | varchar(20) | YES | | NULL | | | ||
+ | +-----------+-------------+------+-----+---------+----------------+ | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Inserindo dados na tabela usuarios | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> INSERT into usuarios (cNome, cEmail, cTelefone, cUsuario, cSenha) | ||
+ | VALUES ('Andreia', 'andreia_bunn@hotmail.com', '4884588453', 'andreiabunn', 'andreia'); | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Selecionando a tabela usuarios, para verificar os dados cadastrados | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> SELECT * FROM usuarios; | ||
+ | +-----+---------+--------------------------+------------+-------------+---------+ | ||
+ | | cID | cNome | cEmail | cTelefone | cUsuario | cSenha | | ||
+ | +-----+---------+--------------------------+------------+-------------+---------+ | ||
+ | | 1 | Andreia | andreia_bunn@hotmail.com | ********** | andreiabunn |******** | | ||
+ | +-----+---------+--------------------------+------------+-------------+---------+ | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====FIREWALL==== | ||
+ | |||
+ | * Instalando o pacote | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/var/www# aptitude install iptables | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Scritp para NAT e redirecionamento de portas '''/etc/init.d/firewall''' | ||
+ | |||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #!/bin/bash | ||
+ | #Politica Padrão bloqueado, exceto o contrário | ||
+ | iptables -t filter -P INPUT DROP iptables -t filter -P FORWARD ACCEPT | ||
+ | iptables -t filter -P OUTPUT ACCEPT | ||
+ | iptables -t nat -P PREROUTING ACCEPT | ||
+ | iptables -t nat -P POSTROUTING ACCEPT | ||
+ | iptables -t nat -P OUTPUT ACCEPT | ||
+ | |||
+ | iptables -t filter -F | ||
+ | iptables -t nat -F | ||
+ | |||
+ | # Filtro de pacotes: saida de pacotes | ||
+ | iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT | ||
+ | #Filtro de pacotes: entrada de pacotes | ||
+ | iptables -A INPUT -p tcp --dport 22 -j ACCEPT | ||
+ | iptables -A INPUT -p tcp --dport 8080 -j ACCEPT | ||
+ | iptables -A INPUT -p udp --dport 53 -j ACCEPT | ||
+ | iptables -A INPUT -p tcp --dport 3000 -j ACCEPT | ||
+ | iptables -A INPUT -p tcp --dport 80 -j ACCEPT | ||
+ | iptables -A INPUT -p udp --dport 1812 -j ACCEPT | ||
+ | iptables -A INPUT -p udp --dport 1813 -j ACCEPT | ||
+ | iptables -A INPUT -p udp --dport 123 -j ACCEPT | ||
+ | iptables -A INPUT -p udp --dport 67 -j ACCEPT | ||
+ | |||
+ | exit 0 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Concecendo permissão de leitura, escrita e execução ao arquivo firewall | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/etc/init.d# chmod 777 firewall | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criando link para script iniciar com o sistema | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/etc/init.d# ln -s /etc/init.d/firewall /etc/rc2.d/S99firewall | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====MONITORAÇÃO==== | ||
+ | |||
+ | * Criado a script de monitoramente dos processos DNS, HTTP e testes de máquina em '''/etc/init.d/monitoramento.sh''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | ALVO="200.135.37.100" | ||
+ | MENSAGEM="/tmp/mensagem.txt" | ||
+ | DIA=`date +%d-%m-%Y-%H-%M` | ||
+ | |||
+ | #dns | ||
+ | if [ `dig @${ALVO} a ritz.sj.ifsc.edu.br | \ | ||
+ | grep -q "no servers could be reached"` ] | ||
+ | then | ||
+ | echo "DNS fora do ar em $DIA" >> ${MENSAGEM}; | ||
+ | /etc/init.d/bind9 start | ||
+ | fi | ||
+ | |||
+ | #http | ||
+ | TMP="/tmp/.http" | ||
+ | wget http://${ALVO}/ -O /dev/null > /dev/null 2> ${TMP} | ||
+ | if [ "`grep -q recusada ${TMP} && echo $?`" = "0" ] | ||
+ | then | ||
+ | echo "HTTP fora do ar em $DIA" >> ${MENSAGEM}; | ||
+ | /etc/init.d/apache2 start | ||
+ | fi | ||
+ | |||
+ | #ntp | ||
+ | processo=`ps -ef | grep ntp | wc -l` | ||
+ | echo $processo | ||
+ | if [ $processo -ne 1 ] | ||
+ | then | ||
+ | echo "NTP fora do ar em $DIA." >> ${MENSAGEM}; | ||
+ | /etc/init.d/ntp start | ||
+ | fi | ||
+ | |||
+ | #ssh | ||
+ | processo=`ps -ef | grep /usr/sbin/sshd | wc -l` | ||
+ | if [ $processo -ne 1 ] | ||
+ | then | ||
+ | echo "SSH fora do ar em $DIA." >> ${MENSAGEM}; | ||
+ | /etc/init.d/ssh start | ||
+ | fi | ||
+ | |||
+ | #freeradius | ||
+ | processo=`ps -ef | grep freeradius | wc -l` | ||
+ | if [ $processo -ne 1 ] | ||
+ | then | ||
+ | echo "FREERADIUS fora do ar em $DIA." >> ${MENSAGEM}; | ||
+ | /etc/init.d/freeradius start | ||
+ | fi | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | * Concecida permissão de leituta, escrita e execução ao arquivo monitoramento.sh | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:/etc/init.d# chmod 777 monitoramento.sh | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==Dia: 06/12/2010 - 11º Dia== | ||
+ | |||
+ | * Realizando configurações da camada de aplicação com integridade com o banco de dados mysql. | ||
+ | |||
+ | * Pesquisando sobre streaming. | ||
+ | |||
+ | |||
+ | ==Dia: 07/12/2010 - 12º Dia== | ||
+ | |||
+ | * Pesquisado sobre o Software Zoneminder de gerenciamento de câmeras via rede. | ||
+ | |||
+ | * Testado a parte de sessões na camada de aplicação e a parte de autenticação de usuários. | ||
+ | |||
+ | * Indicação do professor Emerson: wiki.freeradius.org/HOWTO | ||
+ | |||
+ | ==Dia: 08/12/2010 - 13º Dia== | ||
+ | |||
+ | * Configurado portas e criado a VLAN 3030 no DSLAN | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | OPERADORA: brasil telecom | ||
+ | VPI: 0 | ||
+ | VCI:35 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Feito funcionar a webcan no software Zoneminder. | ||
+ | |||
+ | * Desinstalado o Dansguardian, pois o mesmo utiliza a porta 8080 e o zoneminder também. | ||
+ | |||
+ | ====BACKUP==== | ||
+ | |||
+ | * Criado a script de Backup em '''/var/backup/backup.sh''' | ||
+ | |||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | ORIGEM="/etc /home /var" | ||
+ | DESTINO="/var/backup" | ||
+ | DIA=`date +%d-%m-%Y-%H-%M` | ||
+ | DIA_DA_SEMANA=`date +%A` | ||
+ | |||
+ | # Criar o diretório de destino | ||
+ | mkdir -p ${DESTINO} | ||
+ | chmod 700 ${DESTINO} | ||
+ | chown root ${DESTINO} | ||
+ | |||
+ | # Função: backup completo | ||
+ | completo() | ||
+ | { | ||
+ | tar cvzf ${DESTINO}/${DIA}.tar.gz ${ORIGEM} \ | ||
+ | 2> /dev/null | ||
+ | echo "Completo ; $DIA ; $ORIGEM ; $DIA_DA_SEMANA" >> /var/backup/relatorios/relatorio.txt | ||
+ | } | ||
+ | |||
+ | # Função: backup incremental (somente último dia) | ||
+ | incremental() | ||
+ | { | ||
+ | tar cvzf ${DESTINO}/${DIA}.tar.gz `find ${ORIGEM} ! -type d -mtime -1` \ | ||
+ | 2> /dev/null | ||
+ | echo "Incremental ; $DIA ; $ORIGEM ; $DIA_DA_SEMANA" >> /var/backup/relatorios/relatorio.txt | ||
+ | } | ||
+ | |||
+ | # Função principal | ||
+ | if [ "${DIA_DA_SEMANA}" = "sunday" -o "${DIA_DA_SEMANA}" = "domingo" ] | ||
+ | then | ||
+ | completo | ||
+ | else | ||
+ | incremental | ||
+ | fi | ||
+ | mysqldump -uroot -proot --all-databases > ${DESTINO}/${DIA}.sql | ||
+ | find ${DESTINO} -type f -mtime +7 -exec rm -f {} \; | ||
+ | exit 0 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====RADIUS==== | ||
+ | |||
+ | * Baixando pacote | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:~# aptitude install freeradius | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Configurando o arquivo '''/etc/freeradius/radiusd.conf''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | Descomentar as linhas que aparece "authorize" e "accounting". | ||
+ | |||
+ | * Configurando o arquivo '''/etc/freeradius/sql.conf''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | Nas linhas abaixo, coloque os dados do banco de dados. | ||
+ | server = "localhost" | ||
+ | login = "root" | ||
+ | password = "******" | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Configurando o arquivo '''/etc/freeradius/clients.conf''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | cliente dslan { | ||
+ | secret= projetoritz | ||
+ | shortname=ritz | ||
+ | nastype = other | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * No banco de dados, criando a base de dados radius. | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> create database radius; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Verificando a tabela criada | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> show databases; | ||
+ | +--------------------+ | ||
+ | | Database | | ||
+ | +--------------------+ | ||
+ | | information_schema | | ||
+ | | cacti | | ||
+ | | mysql | | ||
+ | | radius | | ||
+ | | ritz | | ||
+ | | zm | | ||
+ | +--------------------+ | ||
+ | 6 rows in set (0,00 sec) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Dando total permisão a base radius e definindo identificação | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:~# GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "ritz"; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Adicionando tabelas na base radius | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | root@Ritz:~# mysql -u root -p radius < /etc/freeradius/sql/mysql/schema.sql | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Usando a base radius | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> use radius; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Tabelas criadas na base radius | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> show tables; | ||
+ | +------------------+ | ||
+ | | Tables_in_radius | | ||
+ | +------------------+ | ||
+ | | radacct | | ||
+ | | radcheck | | ||
+ | | radgroupcheck | | ||
+ | | radgroupreply | | ||
+ | | radpostauth | | ||
+ | | radreply | | ||
+ | | radusergroup | | ||
+ | +------------------+ | ||
+ | 7 rows in set (0,00 sec) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Inserindo usuário na tabela radcheck | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> INSERT INTO radcheck (UserName, Attribute, op, Value) VALUES ('andreia', 'Cleartext-Password', ':=', 'teste'); | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Litando usuários | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | mysql> select * from radcheck; | ||
+ | +----+----------+--------------------+----+-------+ | ||
+ | | id | username | attribute | op | value | | ||
+ | +----+----------+--------------------+----+-------+ | ||
+ | | 1 | andreia | Cleartext-Password | := | teste | | ||
+ | +----+----------+--------------------+----+-------+ | ||
+ | 1 row in set (0,00 sec) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Configurando conexão com banco de dados no arquivo '''/etc/freeradius/sql.conf''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | sql { | ||
+ | database = "mysql" | ||
+ | driver = "rlm_sql_${database}" | ||
+ | |||
+ | # Connection info: | ||
+ | server = "localhost" | ||
+ | login = "root" | ||
+ | password = "projetoritz" | ||
+ | |||
+ | radius_db = "radius" | ||
+ | |||
+ | |||
+ | # Allow for storing data after authentication | ||
+ | postauth_table = "radpostauth" | ||
+ | |||
+ | authcheck_table = "radcheck" | ||
+ | authreply_table = "radreply" | ||
+ | |||
+ | groupcheck_table = "radgroupcheck" | ||
+ | groupreply_table = "radgroupreply" | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Adicionado no final do arquivo '''/etc/freeradius/radiusd.conf''' | ||
+ | |||
+ | * Autoriza a seção | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | authorize { | ||
+ | preprocess | ||
+ | chap | ||
+ | mschap | ||
+ | suffix | ||
+ | eap | ||
+ | sql | ||
+ | pap | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Armazena registros contáveis | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | accounting { | ||
+ | detail | ||
+ | sql | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Verificando integridade das configurações realizadas | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | freeradius -X | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Testando usuário | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | radtest andreia teste 1812 testing123 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==Dia: 13/12/2010 == | ||
+ | |||
+ | ====Zoneminder==== | ||
+ | |||
+ | * Instalando zoneminder | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | # wget -c http://www2.zoneminder.com/downloads/ZoneMinder-1.24.1.tar.gz | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Descompactando o pacote | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | # tar czf ZoneMinder-1.24.1.tar.gz | ||
+ | # cd ZoneMinder-1.24.1 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Instalação | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | # ./configure –with-webdir=/var/www/zm –with-cgidir=/usr/lib/cgi-bin –with-webuser=www-data –with-webgroup=www-data | ||
+ | # make | ||
+ | # make install | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criando base no banco de dados | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | # mysql mysql < db/zm_create.sql -p | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * No banco de dados, conceder privilégios a base zm | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | # mysql -u root -p | ||
+ | mysql> grant select,insert,update,delete on zm.* to ‘zmuser’@localhost identified by ‘zmpass’; | ||
+ | mysql> flush privileges; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Script para inicialização automática em '''/etc/init.d/zoneminder''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #!/bin/sh | ||
+ | prog=ZoneMinder | ||
+ | ZM_PATH_BIN=”/usr/bin” | ||
+ | command=`which zmpkg.pl` | ||
+ | start() { | ||
+ | echo -n “Starting $prog: ” | ||
+ | $command start | ||
+ | RETVAL=$? | ||
+ | [ $RETVAL = 0 ] && echo success | ||
+ | [ $RETVAL != 0 ] && echo failure | ||
+ | echo | ||
+ | [ $RETVAL = 0 ] && touch /var/lock/zm | ||
+ | return $RETVAL | ||
+ | } | ||
+ | stop() { | ||
+ | echo -n $”Stopping $prog: ” | ||
+ | result=`$command status` | ||
+ | if [ ! "$result" = "running" ]; then | ||
+ | echo “Zoneminder already stopped” | ||
+ | echo | ||
+ | RETVAL=0 | ||
+ | else | ||
+ | $command stop | ||
+ | RETVAL=$? | ||
+ | [ $RETVAL = 0 ] && echo success | ||
+ | [ $RETVAL != 0 ] && echo failure | ||
+ | echo | ||
+ | [ $RETVAL = 0 ] && rm -f /var/lock/zm | ||
+ | fi | ||
+ | } | ||
+ | status() { | ||
+ | result=`$command status` | ||
+ | if [ "$result" = "running" ]; then | ||
+ | echo “ZoneMinder is running” | ||
+ | RETVAL=0 | ||
+ | else | ||
+ | echo “ZoneMinder is stopped” | ||
+ | RETVAL=1 | ||
+ | fi | ||
+ | } | ||
+ | case “$1″ in | ||
+ | ‘start’) | ||
+ | start | ||
+ | ;; | ||
+ | ‘stop’) | ||
+ | stop | ||
+ | ;; | ||
+ | ‘restart’ | ‘force-reload’) | ||
+ | stop | ||
+ | start | ||
+ | ;; | ||
+ | ‘status’) | ||
+ | status | ||
+ | ;; | ||
+ | *) | ||
+ | echo “Usage: $0 { start | stop | restart | status }” | ||
+ | RETVAL=1 | ||
+ | ;; | ||
+ | esac | ||
+ | exit $RETVAL | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criando links simbólicos | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | # ln -s /etc/init.d/zoneminder /etc/rc0.d/K20zoneminder | ||
+ | # ln -s /etc/init.d/zoneminder /etc/rc1.d/K20zoneminder | ||
+ | # ln -s /etc/init.d/zoneminder /etc/rc2.d/S20zoneminder | ||
+ | # ln -s /etc/init.d/zoneminder /etc/rc3.d/S20zoneminder | ||
+ | # ln -s /etc/init.d/zoneminder /etc/rc4.d/S20zoneminder | ||
+ | # ln -s /etc/init.d/zoneminder /etc/rc5.d/S20zoneminder | ||
+ | # ln -s /etc/init.d/zoneminder /etc/rc6.d/K20zoneminder | ||
+ | </syntaxhighlight> | ||
+ | [[Arquivo:Zm1.JPG]][[Arquivo:Zm2.JPG]] | ||
+ | |||
+ | * Instalar '''mjpg_streamer''' dentro de '''/etc/zm''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | wget http://sourceforge.net/projects/mjpg-streamer/files/mjpg-streamer_r94-1_i386.deb/download | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | dpkg mjpg-streamer_r94-1_i386.deb | ||
+ | ./StreamWebCam.sh | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Criar um arquivo dentro de /etc/zm chamado StreamWebCam.sh | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #!/bin/bash | ||
+ | # Script que cria um stream do video da webcam na porta 8080 | ||
+ | # utilizando a aplicação mjpg_streamer | ||
+ | |||
+ | depmod -a | ||
+ | modprobe uvcvideo | ||
+ | |||
+ | cd /usr/bin | ||
+ | ./mjpg_streamer -i "input_uvc.so -d /dev/video0 -fps 4 -r CIF" | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * Permissão para o arquivo '''/etc/zm/StreamWebCam.sh''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | chmod 777 StreamWebCam.sh | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==Dia: 14/12/2010 == | ||
+ | |||
+ | ====CRONTAB==== | ||
+ | * Configurando agendamentos em '''/etc/crontab''' | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | SHELL=/bin/sh | ||
+ | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
+ | |||
+ | # m h dom mon dow user command | ||
+ | 17 * * * * root cd / && run-parts --report /etc/cron.hourly | ||
+ | 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) | ||
+ | 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) | ||
+ | 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) | ||
+ | * 7 * * * root ntpdate -s ntp.cais.rnp.br | ||
+ | * 15 * * * root ntpdate -s ntp.cais.rnp.br | ||
+ | * 23 * * * root ntpdate -s ntp.cais.rnp.br | ||
+ | */5 * * * * root php /var/www/cacti/poller.php > /dev/null 2>&1 | ||
+ | 00 3 * * * root /var/backup/backup.sh 2>/var/backup/relatorios/relatorio.txt | ||
+ | |||
+ | */1 * * * * root /etc/init.d/Stream | ||
+ | |||
+ | */5 * * * * root /etc/init.d/monitoramento.sh 2>/tmp/mensagem.txt | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====Aplicação==== | ||
+ | |||
+ | * index.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | ?> | ||
+ | <HTML> | ||
+ | <HEAD> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <TITLE> Centro Comercial Ritz </TITLE> | ||
+ | </HEAD> | ||
+ | |||
+ | <frameset rows="130,*" border="2" bordercolor="black" scrolling="no"> | ||
+ | |||
+ | <frame src="topo1.php" name="top" scrolling="NO" noresize> | ||
+ | <? | ||
+ | if (!isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <frame src="administrador.php" name="administrador"> | ||
+ | |||
+ | <? | ||
+ | }else{ | ||
+ | ?> | ||
+ | <frame src="index1.php" name="index1"> | ||
+ | <? | ||
+ | } | ||
+ | |||
+ | ?> | ||
+ | </frameset> | ||
+ | |||
+ | </HTML> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * administrador.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | ?> | ||
+ | <HTML> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | |||
+ | <font face="tahoma"> | ||
+ | |||
+ | <center><h2> Administração de Usuários</h2></center> | ||
+ | |||
+ | <br> | ||
+ | |||
+ | <form name="administrador.php" method="post" action="outra.php" | ||
+ | |||
+ | <p><b> <center>Usuário:</b> <input type="text" name="usuario"></p> | ||
+ | |||
+ | <p><b>Senha: </b><input type="password" name="senha"></p> | ||
+ | |||
+ | <input type="submit" name"botao" value="Entrar"></center> | ||
+ | |||
+ | </form> | ||
+ | </BODY> | ||
+ | </font> | ||
+ | </html> | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | * index1.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <HTML> | ||
+ | <HEAD> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <TITLE> Centro Comercial Ritz </TITLE> | ||
+ | |||
+ | </HEAD> | ||
+ | |||
+ | |||
+ | <frameset cols="200,*" border="2" bordercolor="black" scrolling="no"> | ||
+ | <frame src="menu.php" name="menu"> | ||
+ | <frame src="principal.php" name="principal"> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | </frameset> | ||
+ | </HTML> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * topo.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <body background="logo3.jpg"> | ||
+ | <div align="center"> | ||
+ | </body> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * menu.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <HTML> | ||
+ | <HEAD><title>Centro Comercial Ritz </TITLE></HEAD> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <p> | ||
+ | <a href="principal.php" target="principal"><p align="center"><img src="logotipo.jpg" border="0"></a></li> | ||
+ | <b> | ||
+ | <a href="sair.php" target="new"><p align="center"><img src="sair.jpg"></a></li> | ||
+ | <link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center" border="3" bordercolor="black" width="200" height="200"><cellpadding"9" border="5"><cellspacing="9" border="4"><cell content="10" border="5"> | ||
+ | <TR> | ||
+ | <br> | ||
+ | <TD link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center"><font face="tahoma"><a href="cadastro.php" target="principal"> Usuarios </font></TD> | ||
+ | <br> | ||
+ | </TR> | ||
+ | <br> | ||
+ | <TD align="center"><font face="tahoma"><a href="http://ritz.sj.ifsc.edu.br:8080/?action=stream" target="new"> Cameras de Monitoramento</font></TD> | ||
+ | </TR><br> | ||
+ | <br> | ||
+ | <TD align="center"><font face="tahoma"><a href="backup.php" target="principal"> Backup</font></TD> | ||
+ | </TR><br> | ||
+ | <br> | ||
+ | <TD align="center"><font face="tahoma"><a href="http://ritz.sj.ifsc.edu.br/cacti" target="principal"> Cacti </font></TD> | ||
+ | </TR> | ||
+ | <br> | ||
+ | <br> | ||
+ | <TD align="center"><font face="tahoma"><a href="administrador1.php" target="principal"> Administrador</font></TD> | ||
+ | </TR> | ||
+ | <br> | ||
+ | </b> | ||
+ | </BODY> | ||
+ | </HTML> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * principal.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <HTML> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <HEAD><TITLE>Centro Comercial Ritz </TITLE></HEAD> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <br> | ||
+ | <br> | ||
+ | <center><img src="predio.jpg" ></center> | ||
+ | |||
+ | <br> | ||
+ | <b> | ||
+ | <p align="center"><font face="tahoma"> | ||
+ | ritz.sj.ifsc.edu.br | ||
+ | |||
+ | </b> | ||
+ | |||
+ | </body> | ||
+ | |||
+ | |||
+ | |||
+ | </HTML> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * adicionar.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <font face="tahoma"> | ||
+ | <br> | ||
+ | <center><h2> Autenticação de Usuários</h2></center> | ||
+ | <br> | ||
+ | |||
+ | <TABLE link="003399" alink="9966cc" vlink="6600FF" align="center" border="0" bordercolor="black" width="120" height="120"><cellpadding"9" border="0"><cellspacing="9" border="0"><cell content="10" border="0"> | ||
+ | <form name="adicionar.php" method="post" action="outra1.php" | ||
+ | <TR> | ||
+ | <TD align="center"><p><b> Usuários:</b> <input type="text" name="usuario"></p></TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD align="center"><p><b>Senha: </b><input type="password" name="senha"></p></TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD align="center"></b><input type="submit" name"botao" value="Enviar Dados"></TD> | ||
+ | </TR> | ||
+ | </form> | ||
+ | </table> | ||
+ | </BODY> | ||
+ | </font> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | * alterar.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <? | ||
+ | $codigo = $_GET['id']; | ||
+ | ?> | ||
+ | <html> | ||
+ | <font face="tahoma"> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <p><b><center> <h2> | ||
+ | <? | ||
+ | echo "Alterando informações do Usuário " . $usuario; | ||
+ | ?> | ||
+ | </b></center></h2> | ||
+ | <br> | ||
+ | <br> | ||
+ | <form name="alterar.php" method="post" action="mudarsenha.php"> | ||
+ | <center><b> | ||
+ | Digite a nova senha:<br> <input type="password" name="senha"><br> | ||
+ | <br> | ||
+ | Confirme a nova senha:<br> <input type="password" name="nsenha"><br> | ||
+ | <input type="submit" name"botao" value="Enviar"> | ||
+ | <input name="codigo" value="<?echo $codigo;?>" type="hidden"> | ||
+ | </center></b> | ||
+ | </form> | ||
+ | </font> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | * backup.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <font face="tahoma"> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <center><h2><b><br> | ||
+ | BACKUPS REALIZADOS | ||
+ | <br> | ||
+ | <br> | ||
+ | TIPO | DATA/HORA | DIRETORIOS | DIA DA SEMANA | ||
+ | <br> | ||
+ | <? | ||
+ | $tipo= "/var/backup/relatorios/relatorio.txt"; | ||
+ | $tipo1= fopen($tipo, "rb"); | ||
+ | $tipo2= fread($tipo1, filesize($tipo)); | ||
+ | |||
+ | echo $tipo2; | ||
+ | |||
+ | |||
+ | fclose($tipo1); | ||
+ | |||
+ | ?> | ||
+ | |||
+ | |||
+ | |||
+ | </center> | ||
+ | |||
+ | </font> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | * cadastro.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <font face="tahoma"> | ||
+ | |||
+ | <center><h2> Bem Vindo ao ambiente dos Usuários ADSL</h2> | ||
+ | <b> | ||
+ | <TD link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center"><font face="tahoma"><a href="adicionar.php" target="principal"> Adicionar Usuários</font></TD> | ||
+ | <br> | ||
+ | </TR> | ||
+ | <br> | ||
+ | |||
+ | <TD link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center"><font face="tahoma"><a href="listar.php" target="principal"> Lista dos Usuários Cadastrados</font></TD> | ||
+ | <br> | ||
+ | </TR> | ||
+ | <br> | ||
+ | <b> | ||
+ | </center> | ||
+ | </BODY> | ||
+ | |||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | * administrador1.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <font face="tahoma"> | ||
+ | <br> | ||
+ | <center><h2> Autenticação dos Administradores do Sistema</h2></center> | ||
+ | <br> | ||
+ | |||
+ | <TABLE link="003399" alink="9966cc" vlink="6600FF" align="center" border="0" bordercolor="black" width="120" height="120"><cellpadding"9" border="0"><cellspacing="9" border="0"><cell content="10" border="0"> | ||
+ | <form name="administrador1.php" method="post" action="outra2.php" | ||
+ | <TR> | ||
+ | <TD align="center"><p><b> Nome:</b> <input type="text" name="nome"></p></TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD align="center"><p><b>Telefone: </b><input type="text" name="telefone"></p></TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD align="center"><p><b> Login:</b> <input type="text" name="usuario"></p></TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD align="center"><p><b>Senha: </b><input type="password" name="senha"></p></TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD align="center"></b><input type="submit" name"botao" value="Enviar Dados"></TD> | ||
+ | </TR> | ||
+ | </form> | ||
+ | </table> | ||
+ | </BODY> | ||
+ | </font> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * excluir.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <font face="tahoma"> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <center><h2><b><br> | ||
+ | <? | ||
+ | $usuario = $_GET['id']; | ||
+ | echo "Tem certeza que deseja excluir o Usuário " . $usuario . "?"; | ||
+ | |||
+ | ?> | ||
+ | <br> | ||
+ | <br> | ||
+ | <center> | ||
+ | <? | ||
+ | echo "<a href=sim.php?id=" . $usuario . ">" . "<img src=sim.JPG>" . "<br><br>"; | ||
+ | echo "<a href=nao.php?id=" . $usuario . ">" . "<img src=nao.JPG>"; | ||
+ | ?> | ||
+ | </center> | ||
+ | |||
+ | </font> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * erro.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (!isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <HTML> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | |||
+ | <font face="tahoma"> | ||
+ | <center> | ||
+ | <br> | ||
+ | <h1>Desculpe!</h1> | ||
+ | <hr> | ||
+ | <b> | ||
+ | <p>Login incorreto</p></b> | ||
+ | <a href="administrador.php"> Voltar </a> | ||
+ | </center> | ||
+ | </body> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * listar.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <font face="tahoma"> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <br> | ||
+ | <center><h1>Usuarios Cadastrados</h1><P> | ||
+ | <b> | ||
+ | <br> | ||
+ | <? | ||
+ | //conectando no servidor | ||
+ | $conexao = mysql_connect("localhost","root","projetoritz"); | ||
+ | |||
+ | //selecao da base de dados | ||
+ | $base_ok = mysql_select_db("radius",$conexao); | ||
+ | |||
+ | //obtendo os registro da tabela contatos | ||
+ | $consulta = "SELECT * from radcheck"; | ||
+ | $resultado = mysql_query($consulta,$conexao); | ||
+ | |||
+ | //percorrendo a linhas obtidas pela consulta | ||
+ | while($linha = mysql_fetch_array($resultado)){ | ||
+ | echo "<a href=processausuario.php?nome=" . $linha['username'] . ">" . $linha['username'] . "<br> <br>"; | ||
+ | } | ||
+ | |||
+ | //liberando a consulta | ||
+ | mysql_free_result($resultado); | ||
+ | |||
+ | //fechando a conexao | ||
+ | mysql_close($conexao); | ||
+ | |||
+ | ?> | ||
+ | </b> | ||
+ | </center> | ||
+ | </font> | ||
+ | </body> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * mudarsenha.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <font face="tahoma"> | ||
+ | |||
+ | <? | ||
+ | $cod = $_POST['codigo']; | ||
+ | $pass = $_POST ['senha']; | ||
+ | $passn = $_POST ['nsenha']; | ||
+ | |||
+ | if (($pass == $passn)){ | ||
+ | |||
+ | $conexao = mysql_connect ("localhost", "root", "projetoritz"); | ||
+ | $base_ok = mysql_select_db("radius",$conexao); | ||
+ | |||
+ | $alterar = "UPDATE radcheck set value='$pass' where ID='$cod'"; mysql_query ($alterar,$conexao); | ||
+ | mysql_close($conexao); | ||
+ | |||
+ | }else{ | ||
+ | |||
+ | echo "Senha incorreta!"; | ||
+ | echo "<a href=alterar.php?id=$cod>Voltar</a>"; | ||
+ | } | ||
+ | |||
+ | |||
+ | if ($base_ok) { | ||
+ | echo "<h2><center><b>Dados Atualizados com Sucesso!</h2></center></b>"; | ||
+ | }else{ | ||
+ | echo "<h2><center><b>Usuario nao modificado.</h2></center></b>"; | ||
+ | } | ||
+ | |||
+ | ?> | ||
+ | |||
+ | </font> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * outra1.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | |||
+ | |||
+ | <font face="tahoma"> | ||
+ | <br> | ||
+ | <? | ||
+ | |||
+ | $usu = $_POST['usuario']; | ||
+ | $pass = $_POST ['senha']; | ||
+ | |||
+ | |||
+ | $conexao = mysql_connect ("localhost", "root", "projetoritz"); | ||
+ | |||
+ | $base_ok = mysql_select_db("radius",$conexao); | ||
+ | |||
+ | $inserir = "INSERT INTO radcheck (username, attribute, op, value) VALUES ('$usu', 'Cleartext-Password', ':=', '$pass')"; mysql_query ($inserir,$conexao); | ||
+ | |||
+ | mysql_close($conexao); | ||
+ | |||
+ | ?> | ||
+ | <center><h2><b> | ||
+ | Dados inseridos com sucesso no banco de dados. | ||
+ | <br> | ||
+ | A rede RITZ agradece! | ||
+ | </center></h2></b> | ||
+ | </BODY> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * outra2.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | |||
+ | |||
+ | <font face="tahoma"> | ||
+ | <br> | ||
+ | <? | ||
+ | |||
+ | $nome = $_POST['nome']; | ||
+ | $tel = $_POST['telefone']; | ||
+ | $usu = $_POST['usuario']; | ||
+ | $pass = $_POST ['senha']; | ||
+ | |||
+ | |||
+ | $conexao = mysql_connect ("localhost", "root", "projetoritz"); | ||
+ | |||
+ | $base_ok = mysql_select_db("ritz",$conexao); | ||
+ | |||
+ | $inserir = "INSERT INTO administrador (cNome, cTelefone, cLogin, cSenha) VALUES ('$nome', '$tel', '$usu', '$pass')"; mysql_query ($inserir,$conexao); | ||
+ | |||
+ | mysql_close($conexao); | ||
+ | |||
+ | |||
+ | ?> | ||
+ | <center><h2><b> | ||
+ | Dados inseridos com sucesso no banco de dados. | ||
+ | <br> | ||
+ | A rede RITZ agradece! | ||
+ | </center></h2></b> | ||
+ | </BODY> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * outra.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <html> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <? | ||
+ | |||
+ | session_start(); | ||
+ | $nome = $_POST['usuario']; | ||
+ | $password = $_POST ['senha']; | ||
+ | |||
+ | $conexao = mysql_connect ("localhost", "root", "projetoritz"); | ||
+ | |||
+ | $base_ok = mysql_select_db("ritz",$conexao); | ||
+ | |||
+ | $consultar = "select cID from administrador where cLOGIN = '$nome' && cSENHA = '$password'"; | ||
+ | $resultado = mysql_query ($consultar,$conexao); | ||
+ | $linhas = mysql_num_rows($resultado); | ||
+ | |||
+ | mysql_close($conexao); | ||
+ | |||
+ | |||
+ | if ($linhas == 1) | ||
+ | { | ||
+ | $_SESSION['usuario'] = $nome; | ||
+ | $_SESSION['senha'] = $password; | ||
+ | echo "<script>window.location='index1.php';</script>"; | ||
+ | }else{ | ||
+ | |||
+ | echo "<script>window.location='erro.php';</script>"; | ||
+ | } | ||
+ | ?> | ||
+ | </html> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * processausuario.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="Content-Type" content="text/html charset=utf-8"> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | |||
+ | <font face="tahoma"> | ||
+ | |||
+ | <center><b><h2> | ||
+ | <? | ||
+ | echo "Usuario " . $_GET['nome']; | ||
+ | |||
+ | $usuario = $_GET['nome']; | ||
+ | |||
+ | ?> </h2> | ||
+ | |||
+ | <? | ||
+ | //conectando no servidor | ||
+ | $conexao = mysql_connect("localhost","root","projetoritz") or die ("erro de conexao"); | ||
+ | |||
+ | //selecao da base de dados | ||
+ | $base_ok = mysql_select_db("radius",$conexao) or die ("erro no esquema"); | ||
+ | |||
+ | //obtendo os registro da tabela contatos | ||
+ | $consulta = "select * from radcheck where username = '$usuario'"; | ||
+ | $resultado = mysql_query($consulta,$conexao) or die ("erro no select"); | ||
+ | |||
+ | $linha = mysql_fetch_row($resultado) or die ("erro no row"); | ||
+ | |||
+ | //percorrendo a linhas obtidas pela consulta | ||
+ | echo "Identificacao: " . $linha[0] . "<br>"; | ||
+ | echo "Usuário: " . $linha[1] . "<br>" ; | ||
+ | echo "<BR><HR><BR>"; | ||
+ | |||
+ | //liberando a consulta | ||
+ | mysql_free_result($resultado); | ||
+ | |||
+ | //fechando a conexao | ||
+ | mysql_close($conexao); | ||
+ | |||
+ | echo "<u><a href=alterar.php?id$cod=$linha[0]>Alterar</u></a>" . "<br> <br>"; | ||
+ | echo "<u><a href=excluir.php?id$cod=$linha[0]> Excluir</u></a>"; | ||
+ | ?> | ||
+ | </center></b> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * sair.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | session_destroy(); | ||
+ | header("Location:administrador.php"); | ||
+ | |||
+ | }else{ | ||
+ | session_destroy(); | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * sim.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | if (isset($_SESSION['usuario'])){ | ||
+ | ?> | ||
+ | <html> | ||
+ | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
+ | <BODY background="fundo.jpg" > | ||
+ | |||
+ | |||
+ | <font face="tahoma"> | ||
+ | <br> | ||
+ | <? | ||
+ | $codigo = $_GET['id']; | ||
+ | $conexao = mysql_connect ("localhost", "root", "projetoritz"); | ||
+ | |||
+ | $base_ok = mysql_select_db("radius",$conexao); | ||
+ | |||
+ | $inserir = "delete from radcheck where ID=$codigo"; mysql_query ($inserir,$conexao); | ||
+ | |||
+ | if ($base_ok) { | ||
+ | echo "<h2><center><b>Usuario excluido com sucesso!</h2></center></b>"; | ||
+ | }else{ | ||
+ | echo "<h2><center><b>Usuario nao excluido.</h2></center></b>"; | ||
+ | } | ||
+ | mysql_close($conexao); | ||
+ | ?> | ||
+ | </BODY> | ||
+ | </html> | ||
+ | <? | ||
+ | }else{ | ||
+ | header("Location:index.php"); | ||
+ | } | ||
+ | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | * topo1.php | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | <? | ||
+ | session_start(); | ||
+ | ?> | ||
+ | <html> | ||
+ | <body background="logo4.jpg"> | ||
+ | |||
+ | <div align="center"> | ||
+ | |||
+ | </body> | ||
+ | |||
+ | </html> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==Dia: 15/12/2010 == | ||
+ | |||
+ | ====Protocolos utilizados na camada de enlace==== | ||
+ | |||
+ | * PPPoE - Utilizado na comunicação entre a estação cliente e o DSLAN. | ||
+ | |||
+ | * IEEE 802.11 modo ad hoc - Utilizado na rede sem fio para fazer a comunicação entre os laboratórios. Rede ad hoc. | ||
+ | |||
+ | * Ethernet - Utilizado na rede do laboratório redes I. | ||
+ | |||
+ | |||
+ | ====MODEM D-LINK 500B==== | ||
+ | [[Arquivo:2.jpg]][[Arquivo:3.jpg]][[Arquivo:4.jpg]][[Arquivo:5.jpg]][[Arquivo:6.jpg]][[Arquivo:7.jpg]][[Arquivo:8.jpg]][[Arquivo:9.jpg]][[Arquivo:10.jpg]][[Arquivo:11.jpg]] | ||
+ | |||
+ | ====Computador semfio2 (preto) do Laboratório de Redes I==== | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | # Script para configuração das interfaces das redes sem-fio no computador semfio2 (preto) do Laboratório de Redes I | ||
+ | # Lembrando: wlan0 = Equipe Celtics, wlan1 = Equipe Ritz, wlan2 = Equipe TechSpot (todas configuradas conjuntamente) | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] derruba as interfaces de rede sem-fio e mostra | ||
+ | ifconfig wlan0 down | ||
+ | ifconfig wlan1 down | ||
+ | ifconfig wlan2 down | ||
+ | ifconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] coloca as interface em modo Ad-Hoc (conectividade direta sem APs) e mostra | ||
+ | iwconfig wlan0 mode ad-hoc | ||
+ | iwconfig wlan1 mode ad-hoc | ||
+ | iwconfig wlan2 mode ad-hoc | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] levanta as interfaces de rede sem-fio conforme /etc/network/interfaces e mostra | ||
+ | ifconfig wlan0 up | ||
+ | ifconfig wlan1 up | ||
+ | ifconfig wlan2 up | ||
+ | ifconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] define identificação (ESSID) para cada rede sem-fio (conforme nomes das Equipes) e mostra | ||
+ | iwconfig wlan0 essid "Celtics" | ||
+ | iwconfig wlan1 essid "Ritz" | ||
+ | iwconfig wlan2 essid "TechSpot" | ||
+ | iwconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] define canal/frequência para cada rede sem-fio (conforme http://atalho.to/IFSC_PI2010-2) e mostra | ||
+ | iwconfig wlan0 channel 1 | ||
+ | iwconfig wlan1 channel 11 | ||
+ | iwconfig wlan2 channel 6 | ||
+ | iwconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] define chave/senha para criptografia WEP para cada rede sem-fio (exatos 5 caracteres) e mostra | ||
+ | iwconfig wlan0 key s:wlan0 | ||
+ | iwconfig wlan1 key s:wlan1 | ||
+ | iwconfig wlan2 key s:wlan2 | ||
+ | iwconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [1 linha] mostra finalmente configuração das interfaces de rede | ||
+ | ifconfig -a | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====Computador semfio1 (branco) do Laboratório de Meios de Transmissão==== | ||
+ | <syntaxhighlight lang=lang="html4strict"> | ||
+ | #!/bin/bash | ||
+ | |||
+ | # Script para configuração das interfaces das redes sem-fio no computador semfio1 (branco) do Laboratório de Meios de Transmissão | ||
+ | # Lembrando: wlan0 = Equipe Celtics, wlan1 = Equipe Ritz, wlan2 = Equipe TechSpot (todas configuradas conjuntamente) | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] derruba as interfaces de rede sem-fio e mostra | ||
+ | ifconfig wlan0 down | ||
+ | ifconfig wlan1 down | ||
+ | ifconfig wlan2 down | ||
+ | ifconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] coloca as interface em modo Ad-Hoc (conectividade direta sem APs) e mostra | ||
+ | iwconfig wlan0 mode ad-hoc | ||
+ | iwconfig wlan1 mode ad-hoc | ||
+ | iwconfig wlan2 mode ad-hoc | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] levanta as interfaces de rede sem-fio conforme /etc/network/interfaces e mostra | ||
+ | ifconfig wlan0 up | ||
+ | ifconfig wlan1 up | ||
+ | ifconfig wlan2 up | ||
+ | ifconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] define identificação (ESSID) para cada rede sem-fio (conforme nomes das Equipes) e mostra | ||
+ | iwconfig wlan0 essid "Celtics" | ||
+ | iwconfig wlan1 essid "Ritz" | ||
+ | iwconfig wlan2 essid "TechSpot" | ||
+ | iwconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] define canal/frequência para cada rede sem-fio (conforme http://atalho.to/IFSC_PI2010-2) e mostra | ||
+ | iwconfig wlan0 channel 1 | ||
+ | iwconfig wlan1 channel 11 | ||
+ | iwconfig wlan2 channel 6 | ||
+ | iwconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [3 linhas] define chave/senha para criptografia WEP para cada rede sem-fio (exatos 5 caracteres) e mostra | ||
+ | iwconfig wlan0 key s:wlan0 | ||
+ | iwconfig wlan1 key s:wlan1 | ||
+ | iwconfig wlan2 key s:wlan2 | ||
+ | iwconfig | ||
+ | |||
+ | # 20101203 Ronaldo Lages [1 linha] mostra finalmente configuração das interfaces de rede | ||
+ | ifconfig -a | ||
</syntaxhighlight> | </syntaxhighlight> |
Edição atual tal como às 18h36min de 16 de dezembro de 2010
Dia: 22/11/2010 - 1º Dia
- Apresentação do projeto pelo professor Ederson Torresini.
- Criação do nome da equipe: Centro comercial Ritz.
Dia: 23/11/2010 - 2º Dia
Serviço final
- 1º - ADSL para os usuários
* DSLAM (ADSL) 8 portas por equipe * DHCP - fornecimento de IP - DHCP com vlan * DNS - subdomínios,pacotes, conteúdo Web * Filtro de conteúdo (pacotes / conteúdos web)
- 2º - Vigilância IP (web com usb)
* Webcam - captura e alguem envia para rede * ferramenta de streaming * sistema de controle de autenticação (PRC)
- 3º - Segurança nos dados
* BACKUP * Filtro de Conteúdo/pacotes - para se proteger e proteger os outros * Redes separadas (VLAN): 1 admin + 1 por cada cliente ADSL
Dia: 24/11/2010 - 3º Dia
Configurações do Servidor
- 80 GB de HD
- 1 GB de Memória RAM
- Processador: AMD Sempron 1.81 GHZ - 32 bits
- Sistema Operacional: Ubuntu Linux Server 9.10
Equipamentos
- MODEM D-LINK 500B
- DSLAN - DAS3324
- Placa wifi ATHEROS comunication AR500IXplus
Particionamento do sistema
Partição "Tamanho" Tipo Ponto de montagem
====================================================
/dev/sda1 40GB EXT4 /
/dev/sda2 10GB EXT4 /home
/dev/sda3 26GB EXT4 /var
/dev/sda4 4GB SWAP swap
Configurações de rede
Rede Externa:
IP:200.135.37.100 Mascara: 255.255.255.192 (/26) Broadcast 200.135.37.127
Rede:200.135.37.64/26 1°IP valido: 200.135.37.65 Ultimo IP valido: 200.135.37.126
Gateway:200.135.37.126
Cabeamento
- Foi passado os cabos do Patch Panel do Armário Principal para o Armário Ritz.
- Feitos os pontos de acesso (Tomadas).
Dia: 25/11/2010 - 4º Dia
Cabeamento
- Definido padrão 568-B para todo o cabeamento da equipe Ritz;
- Todos os cabos equipe Ritz categoria 5e;
- Crimpados os conectores RJ-45 Machos em uma das pontas de cada ponto (chão, alto e parede), e fêmeas nas outras pontas;
- Conectato o cabo principal do Patch Panel Equipe Ritz, ao patch panel a (equipe Celtics);
Equipamento
- Recebemos o equipamento DSLAM que ficou disponível para estudo;
Dia: 29/11/2010 - 6º Dia
Cabeamento
- Tivemos problemas nos testes do ponto no chão e do ponto no alto. O ponto de parede passou já no primeiro teste.
- A porta 1 do patch panel inicialmente escolhida para ser a porta de ligação com o armário principal, também deve que ser substituída pela porta 10 pois apresentou problemas nos testes.
- Substituímos os conectores RJ-45 fêmeas dos pontos e refizemos os conectores RJ-45 machos. Todos os pontos, e o patch panel então passaram no teste.
- Fizemos então o acabamento (fixação do patch panel em definitivo no rack, encaixe dos conectores fêmeas nos suportes de chão e de parede, marcação das pontas dos cabos) e depois refizemos todos os testes.
- Todos os pontos e a porta 10 do patch panel foram testados e aprovados.
RACK PRINCIPAL:
-Path painel do DSLAM
PORTA 1 corresponde a porta 24 no DSLAM PORTA 2 corresponde a porta 22 no DSLAM PORTA 3 corresponde a porta 20 no DSLAM PORTA 4 corresponde a porta 18 no DSLAM
Instalação dos softwares
DNS
- Instalando o pacote DNS
# aptitude install bind9
- Configurando interfaces - /etc/network/interfaces
auto lo
iface lo inet loopback
#auto eth0
#iface eth0 inet loopback
# The primary network interface
# Interface externa ip 200.135.37.100/26
auto eth0
iface eth0 inet static
address 200.135.37.100
netmask 255.255.255.192
broadcast 200.135.37.127
network 200.135.37.64
gateway 200.135.37.126
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 127.0.0.1 dns1.ritz.sj.ifsc.edu.br
dns-search ritz.sj.ifsc.edu.br
- Arquivo de configuração dos servidores DNS que o sistema utilizara, no caso é a própria maquina pois ela sera um servidor também DNS - /etc/resolv.conf
search ritz.sj.ifsc.edu.br
nameserver 127.0.0.1
- Configuração DNS - /etc/bind/named.conf.options
options{
//todas as interfaces de rede
listen-on { any; };
//qualquer um pode perguntar
allow-query { any; };
//Quem pode perguntar sobre meus dominios
allow-query-cache { any; };
//Sobre dominio de terceiros, loopback e rede ifsc
allow-recursion { 127.0.0.0/8; 192.168.30.0/24; 192.168.31.0/24; };
};
- Configurando informações de domínio e de seu domínio reverso que no nossa caso é respectivamente "ritz.sj.ifsc.edu.br' - /etc/bind/named.conf.local
//Configuracao de dominio
zone "ritz.sj.ifsc.edu.br" {
type master;
file "/etc/bind/ritz.sj.ifsc.edu.br";
};
- Criando o arquivo "ritz.sj.ifsc.edu.br" dentro da pasta "bind" - /etc/bind/ritz.sj.ifsc.edu.br
; Configuracoes especificas para o dominio ritz.ifsc.edu.br
$TTL 86400
@ IN SOA dns1.ritz.sj.ifsc.edu.br. admin.ritz.sj.ifsc.edu.br. (
2010120201 ; serial
1d ; refresh
1h ; retry
1w ; expire
1d ; negative cache ttl
)
@ IN NS dns1
@ IN A 200.135.37.100
@ IN MX 0 mail.ritz.sj.ifsc.edu.br.
dns1 IN A 200.135.37.100
ns1 IN A 200.135.37.100
mail IN A 200.135.37.100
www IN A 200.135.37.100
smtp IN CNAME mail.ritz.sj.ifsc.edu.br.
pop IN CNAME mail.ritz.sj.ifsc.edu.br.
imap IN CNAME mail.ritz.sj.ifsc.edu.br.
ssl IN CNAME www.ritz.sj.ifsc.edu.br.
cacti IN CNAME www.ritz.sj.ifsc.edu.br.
;prevencao contra SPAM usando pacote spf1
ritz.sj.ifsc.edu.br. IN TXT "v=spf1 mx -all"
- Efetuando testes para a confirmação do funcionamento do DNS
# tail -f /var/log/daemon.log &
# /etc/init.d/bind9 restart
# dig SOA ritz.sj.ifsc.edu.br
Dia: 30/11/2010 - 7º Dia
Cabeamento
- Realizado testes de todos os patch panels e pontos de acesso dos armários das equipes com o armário principal;
- Feito o cabo RJ45/RJ11 que fará a ligação do ponto de acesso com o modem ADSL.
NTP
- Realizando a Instalação do pacote NTP
root@Ritz:~# aptitude install ntp
- Configurado o arquivo /etc/ntp.conf para sincronizar o horário
#Linhas adicionadas para que o ntpd sincronize o horario com os servidores abaixo
#servidor da rnp
server ntp.cais.rnp.br
#servidor "a" do observatorio nacional
server a.ntp.br
#servidor "b" do observatorio nacional
server b.ntp.br
#Restringe o acesso ao servidor ntp apenas a dispositivos da rede local
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.200.0 mask 255.255.255.0 nomodify notrap
- Sincronizando o horário
ntpdate ntp.cais.rnp.br
- Adicionando na /etc/crontab, para sincronizar o horário várias vezes por dia, sem ter alguém para fazer esse trabalho.
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
* 7 * * * root ntpdate -s ntp.cais.rnp.br
* 15 * * * root ntpdate -s ntp.cais.rnp.br
* 23 * * * root ntpdate -s ntp.cais.rnp.br
DHCP
- Realizando a Instalação do pacote DHCP
root@Ritz:~# aptitude install dhcp3
- Configurando o arquivo etc/dhcp3/dhcpd.conf
#Integração com os outros serviços
#
# Atualizar alguma informação com origem no DNS? Nenhuma (none).
ddns-update-style none;
#
# O 'log' das atividades do servidor serão registradas pela 'facility' local7 - arquivo /var/log/sys
log
log-facility local7;
# Rede interna: 192.168.100.0/24
subnet 192.168.30.0 netmask 255.255.255.0 {
#
# Faixa de IPs disponÃveis
range 192.168.30.1 192.168.30.100;
#
# Máscara de rede
option subnet-mask 255.255.255.0;
#
#
# Rotas
option routers 192.168.30.100;
#
# Servidores e domÃnios DNS
option domain-name-servers 192.168.30.100;
option domain-name "ritz.sj.ifsc.edu.br";
default-lease-time 3600;
max-lease-time 14400;
SNMP
- Realizando a Instalação do pacote SNMP
root@Ritz:~# aptitude install snmpd
- Configurando o arquivo /etc/snmp/snmpd.conf
rocommunity ritz
syslocation ritz-TI
syscontact root@ritz.sj.ifsc.edu.br
sysservices 72
Contabilização
CACTI
- Baixando o programa cacti
cd /usr/local/src
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
- Instalando apache2, php5 e mysql-server
aptitude install apache2 php5 mysql-server
- Instalando pacote para guardar dados de gráfico em texto
aptitude install rrdtool
- Descompactando o pacote do cacti
cd /var/www
tar xzf /usr/local/src/cacti-0.8.7g.tar.gz
mv cacti-0.8.7g /cacti
- Reiniciando apache2 para validar as configurações
/etc/init.d/apache2 restart
- Instalando php5-mysql e php5-cli
aptitude install php5-mysql php5-cli
- Entrando no banco de dados e Listando as bases
mysql -uroot -p
mysql> show databases;
- Criando a base do cacti e aplicando privilégio total
mysql> create database cacti;
mysql> grant all privileges on cacti.* to 'cactiadmin'@localhost identified by '********';
mysql> flush privileges;
mysql> quit;
- Configurado login e senha para acesso a base cacti
cd /var/www/cacti
vi include/config.php
(alterar na linha 29 e 30)
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiadmin";
$database_password = "*******";
$database_port = "3306";
- Adicionando na /etc/crontab
*/5 * * * * www-data php /var/www/cacti/poller.php > /dev/null 2>&1
- Aplicando total permissão aos arquivos de log.
root@Ritz:/var/log/cacti# chmod 777 rrd.log
root@Ritz:/var/log/cacti# chmod 777 cacti.log
root@Ritz:/var/log/cacti# chmod 777 poller-error.log
NTOP
- Instalando o pacote
root@Ritz:/var/www# aptitude install ntop
- Atribuindo senha para o administrador
root@Ritz:/var/www# ntop -A
- Rode ntop no servidor e abre um browser com o ip-do-servidor:3000.
Dia: 01/12/2010 - 8º Dia
Servidor
- Configurado o IP externo 200.135.37.100, para acesso remoto e fixado o servidor no RAK.
- Testado o DNS e configurado com o IP externo.
root@Ritz:/home/ritz# /etc/init.d/bind9 restart
* Stopping domain name service... bind9 [ OK ]
* Starting domain name service... bind9 [ OK ]
Dia: 02/12/2010 - 9º Dia
TAREFAS sugeridas pelo Professor Marcelo Sobral.
1) Ativar o link sem-fio (modo ad hoc) - Pensar em como passar a informaação sobre Vlans através do link.
2) Configurar as vlans nos switchs, para estruturar as LANs (as mesas, servidores/dsl)
3) Ativar os links DSL - Decifrar DSL LAN.
DSLAN
- Aberto máquina virtual windows, no qual foi baixado o EMS para gerenciar o DSLAN. - Executado o EMSClient (Menu Iniciar -> Todos os Programas -> EMS Client), e fornecido o IP 192.168.1.101, com usuário root e senha admin123. - Conseguimos abrir a interface do DSLAN e com a ajuda do manual estamos tentando configura-lo.
Dia: 03/12/2010 - 10º Dia
- Feito o cabo de interligação do patch panel com o dslan. (cabo manga)
MYSQL
- Baixando pacote
ritz@Ritz:~$ aptitude install mysql
- Logando no banco de dados
ritz@Ritz:~$ mysql -u root -p
- Criando a base de dados ritz
mysql> create database ritz;
- Listando as bases criadas
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cacti |
| mysql |
| ritz |
+--------------------+
4 rows in set (0,00 sec)
- Usando a base de dados ritz
mysql> use ritz;
- Criando a tabela administrador, com os dados de quem irá administrar a rede, tanto login e senha para entrar na interface gráfica.
mysql> create table administrador (cID INTEGER NOT NULL AUTO_INCREMENT, cNOME VARCHAR(40),
cTELEFONE VARCHAR (20), cLOGIN VARCHAR(40), cSENHA VARCHAR(40), PRIMARY KEY (cID));
- Verificando as informações na tabela administrador
mysql> desc administrador;
+-----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+----------------+
| cID | int(11) | NO | PRI | NULL | auto_increment |
| cNOME | varchar(40) | YES | | NULL | |
| cTELEFONE | varchar(20) | YES | | NULL | |
| cLOGIN | varchar(40) | YES | | NULL | |
| cSENHA | varchar(40) | YES | | NULL | |
+-----------+-------------+------+-----+---------+----------------+
- Inserindo dados na tabela administrador
mysql> INSERT into administrador (cNOME, cTELEFONE, cLOGIN, cSENHA) VALUES ('Andreia Bunn', '4884588453', 'administrador', 'projetoritz');
- Selecionando a tabela adminsitrador, para verificar os dados cadastrados
mysql> SELECT * FROM administrador;
+-----+--------------+------------+---------------+-------------+
| cID | cNOME | cTELEFONE | cLOGIN | cSENHA |
+-----+--------------+------------+---------------+-------------+
| 1 | Andreia Bunn | ********** | administrador | *********** |
+-----+--------------+------------+---------------+-------------+
- Saindo do Banco de Dados
mysql> quit
- Para alterar informações no banco. Ex: alterar a senha na tela administrador de projetoritz para projeto integrador, no qual está associado ao nome Andreia Bunn.
mysql> update admninistrador set cSENHA='projetointegrador' WHERE cNOME='Andreia Bunn';
- Criando a tabela usuários para cadastrados os usuários ADSL.
mysql> create table usuarios (cID INTEGER NOT NULL AUTO_INCREMENT,cNome VARCHAR(40),
cEmail VARCHAR(50), cTelefone VARCHAR(20), cUsuario VARCHAR(20), cSenha VARCHAR(20), PRIMARY KEY (cID));
- Verificando as informações na tabela usuarios
mysql> desc usuarios;
+-----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+----------------+
| cID | int(11) | NO | PRI | NULL | auto_increment |
| cNome | varchar(40) | YES | | NULL | |
| cEmail | varchar(50) | YES | | NULL | |
| cTelefone | varchar(20) | YES | | NULL | |
| cUsuario | varchar(20) | YES | | NULL | |
| cSenha | varchar(20) | YES | | NULL | |
+-----------+-------------+------+-----+---------+----------------+
- Inserindo dados na tabela usuarios
mysql> INSERT into usuarios (cNome, cEmail, cTelefone, cUsuario, cSenha)
VALUES ('Andreia', 'andreia_bunn@hotmail.com', '4884588453', 'andreiabunn', 'andreia');
- Selecionando a tabela usuarios, para verificar os dados cadastrados
mysql> SELECT * FROM usuarios;
+-----+---------+--------------------------+------------+-------------+---------+
| cID | cNome | cEmail | cTelefone | cUsuario | cSenha |
+-----+---------+--------------------------+------------+-------------+---------+
| 1 | Andreia | andreia_bunn@hotmail.com | ********** | andreiabunn |******** |
+-----+---------+--------------------------+------------+-------------+---------+
FIREWALL
- Instalando o pacote
root@Ritz:/var/www# aptitude install iptables
- Scritp para NAT e redirecionamento de portas /etc/init.d/firewall
#!/bin/bash
#Politica Padrão bloqueado, exceto o contrário
iptables -t filter -P INPUT DROP iptables -t filter -P FORWARD ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t filter -F
iptables -t nat -F
# Filtro de pacotes: saida de pacotes
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#Filtro de pacotes: entrada de pacotes
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p udp --dport 1812 -j ACCEPT
iptables -A INPUT -p udp --dport 1813 -j ACCEPT
iptables -A INPUT -p udp --dport 123 -j ACCEPT
iptables -A INPUT -p udp --dport 67 -j ACCEPT
exit 0
- Concecendo permissão de leitura, escrita e execução ao arquivo firewall
root@Ritz:/etc/init.d# chmod 777 firewall
- Criando link para script iniciar com o sistema
root@Ritz:/etc/init.d# ln -s /etc/init.d/firewall /etc/rc2.d/S99firewall
MONITORAÇÃO
- Criado a script de monitoramente dos processos DNS, HTTP e testes de máquina em /etc/init.d/monitoramento.sh
#!/bin/bash
ALVO="200.135.37.100"
MENSAGEM="/tmp/mensagem.txt"
DIA=`date +%d-%m-%Y-%H-%M`
#dns
if [ `dig @${ALVO} a ritz.sj.ifsc.edu.br | \
grep -q "no servers could be reached"` ]
then
echo "DNS fora do ar em $DIA" >> ${MENSAGEM};
/etc/init.d/bind9 start
fi
#http
TMP="/tmp/.http"
wget http://${ALVO}/ -O /dev/null > /dev/null 2> ${TMP}
if [ "`grep -q recusada ${TMP} && echo $?`" = "0" ]
then
echo "HTTP fora do ar em $DIA" >> ${MENSAGEM};
/etc/init.d/apache2 start
fi
#ntp
processo=`ps -ef | grep ntp | wc -l`
echo $processo
if [ $processo -ne 1 ]
then
echo "NTP fora do ar em $DIA." >> ${MENSAGEM};
/etc/init.d/ntp start
fi
#ssh
processo=`ps -ef | grep /usr/sbin/sshd | wc -l`
if [ $processo -ne 1 ]
then
echo "SSH fora do ar em $DIA." >> ${MENSAGEM};
/etc/init.d/ssh start
fi
#freeradius
processo=`ps -ef | grep freeradius | wc -l`
if [ $processo -ne 1 ]
then
echo "FREERADIUS fora do ar em $DIA." >> ${MENSAGEM};
/etc/init.d/freeradius start
fi
- Concecida permissão de leituta, escrita e execução ao arquivo monitoramento.sh
root@Ritz:/etc/init.d# chmod 777 monitoramento.sh
Dia: 06/12/2010 - 11º Dia
- Realizando configurações da camada de aplicação com integridade com o banco de dados mysql.
- Pesquisando sobre streaming.
Dia: 07/12/2010 - 12º Dia
- Pesquisado sobre o Software Zoneminder de gerenciamento de câmeras via rede.
- Testado a parte de sessões na camada de aplicação e a parte de autenticação de usuários.
- Indicação do professor Emerson: wiki.freeradius.org/HOWTO
Dia: 08/12/2010 - 13º Dia
- Configurado portas e criado a VLAN 3030 no DSLAN
OPERADORA: brasil telecom
VPI: 0
VCI:35
- Feito funcionar a webcan no software Zoneminder.
- Desinstalado o Dansguardian, pois o mesmo utiliza a porta 8080 e o zoneminder também.
BACKUP
- Criado a script de Backup em /var/backup/backup.sh
#!/bin/bash
ORIGEM="/etc /home /var"
DESTINO="/var/backup"
DIA=`date +%d-%m-%Y-%H-%M`
DIA_DA_SEMANA=`date +%A`
# Criar o diretório de destino
mkdir -p ${DESTINO}
chmod 700 ${DESTINO}
chown root ${DESTINO}
# Função: backup completo
completo()
{
tar cvzf ${DESTINO}/${DIA}.tar.gz ${ORIGEM} \
2> /dev/null
echo "Completo ; $DIA ; $ORIGEM ; $DIA_DA_SEMANA" >> /var/backup/relatorios/relatorio.txt
}
# Função: backup incremental (somente último dia)
incremental()
{
tar cvzf ${DESTINO}/${DIA}.tar.gz `find ${ORIGEM} ! -type d -mtime -1` \
2> /dev/null
echo "Incremental ; $DIA ; $ORIGEM ; $DIA_DA_SEMANA" >> /var/backup/relatorios/relatorio.txt
}
# Função principal
if [ "${DIA_DA_SEMANA}" = "sunday" -o "${DIA_DA_SEMANA}" = "domingo" ]
then
completo
else
incremental
fi
mysqldump -uroot -proot --all-databases > ${DESTINO}/${DIA}.sql
find ${DESTINO} -type f -mtime +7 -exec rm -f {} \;
exit 0
RADIUS
- Baixando pacote
root@Ritz:~# aptitude install freeradius
- Configurando o arquivo /etc/freeradius/radiusd.conf
Descomentar as linhas que aparece "authorize" e "accounting".
* Configurando o arquivo '''/etc/freeradius/sql.conf'''
<syntaxhighlight lang=lang="html4strict">
Nas linhas abaixo, coloque os dados do banco de dados.
server = "localhost"
login = "root"
password = "******"
- Configurando o arquivo /etc/freeradius/clients.conf
cliente dslan {
secret= projetoritz
shortname=ritz
nastype = other
}
- No banco de dados, criando a base de dados radius.
mysql> create database radius;
- Verificando a tabela criada
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cacti |
| mysql |
| radius |
| ritz |
| zm |
+--------------------+
6 rows in set (0,00 sec)
- Dando total permisão a base radius e definindo identificação
root@Ritz:~# GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "ritz";
- Adicionando tabelas na base radius
root@Ritz:~# mysql -u root -p radius < /etc/freeradius/sql/mysql/schema.sql
- Usando a base radius
mysql> use radius;
- Tabelas criadas na base radius
mysql> show tables;
+------------------+
| Tables_in_radius |
+------------------+
| radacct |
| radcheck |
| radgroupcheck |
| radgroupreply |
| radpostauth |
| radreply |
| radusergroup |
+------------------+
7 rows in set (0,00 sec)
- Inserindo usuário na tabela radcheck
mysql> INSERT INTO radcheck (UserName, Attribute, op, Value) VALUES ('andreia', 'Cleartext-Password', ':=', 'teste');
- Litando usuários
mysql> select * from radcheck;
+----+----------+--------------------+----+-------+
| id | username | attribute | op | value |
+----+----------+--------------------+----+-------+
| 1 | andreia | Cleartext-Password | := | teste |
+----+----------+--------------------+----+-------+
1 row in set (0,00 sec)
- Configurando conexão com banco de dados no arquivo /etc/freeradius/sql.conf
sql {
database = "mysql"
driver = "rlm_sql_${database}"
# Connection info:
server = "localhost"
login = "root"
password = "projetoritz"
radius_db = "radius"
# Allow for storing data after authentication
postauth_table = "radpostauth"
authcheck_table = "radcheck"
authreply_table = "radreply"
groupcheck_table = "radgroupcheck"
groupreply_table = "radgroupreply"
- Adicionado no final do arquivo /etc/freeradius/radiusd.conf
- Autoriza a seção
authorize {
preprocess
chap
mschap
suffix
eap
sql
pap
}
- Armazena registros contáveis
accounting {
detail
sql
}
- Verificando integridade das configurações realizadas
freeradius -X
- Testando usuário
radtest andreia teste 1812 testing123
Dia: 13/12/2010
Zoneminder
- Instalando zoneminder
# wget -c http://www2.zoneminder.com/downloads/ZoneMinder-1.24.1.tar.gz
- Descompactando o pacote
# tar czf ZoneMinder-1.24.1.tar.gz
# cd ZoneMinder-1.24.1
- Instalação
# ./configure –with-webdir=/var/www/zm –with-cgidir=/usr/lib/cgi-bin –with-webuser=www-data –with-webgroup=www-data
# make
# make install
- Criando base no banco de dados
# mysql mysql < db/zm_create.sql -p
- No banco de dados, conceder privilégios a base zm
# mysql -u root -p
mysql> grant select,insert,update,delete on zm.* to ‘zmuser’@localhost identified by ‘zmpass’;
mysql> flush privileges;
- Script para inicialização automática em /etc/init.d/zoneminder
#!/bin/sh
prog=ZoneMinder
ZM_PATH_BIN=”/usr/bin”
command=`which zmpkg.pl`
start() {
echo -n “Starting $prog: ”
$command start
RETVAL=$?
[ $RETVAL = 0 ] && echo success
[ $RETVAL != 0 ] && echo failure
echo
[ $RETVAL = 0 ] && touch /var/lock/zm
return $RETVAL
}
stop() {
echo -n $”Stopping $prog: ”
result=`$command status`
if [ ! "$result" = "running" ]; then
echo “Zoneminder already stopped”
echo
RETVAL=0
else
$command stop
RETVAL=$?
[ $RETVAL = 0 ] && echo success
[ $RETVAL != 0 ] && echo failure
echo
[ $RETVAL = 0 ] && rm -f /var/lock/zm
fi
}
status() {
result=`$command status`
if [ "$result" = "running" ]; then
echo “ZoneMinder is running”
RETVAL=0
else
echo “ZoneMinder is stopped”
RETVAL=1
fi
}
case “$1″ in
‘start’)
start
;;
‘stop’)
stop
;;
‘restart’ | ‘force-reload’)
stop
start
;;
‘status’)
status
;;
*)
echo “Usage: $0 { start | stop | restart | status }”
RETVAL=1
;;
esac
exit $RETVAL
- Criando links simbólicos
# ln -s /etc/init.d/zoneminder /etc/rc0.d/K20zoneminder
# ln -s /etc/init.d/zoneminder /etc/rc1.d/K20zoneminder
# ln -s /etc/init.d/zoneminder /etc/rc2.d/S20zoneminder
# ln -s /etc/init.d/zoneminder /etc/rc3.d/S20zoneminder
# ln -s /etc/init.d/zoneminder /etc/rc4.d/S20zoneminder
# ln -s /etc/init.d/zoneminder /etc/rc5.d/S20zoneminder
# ln -s /etc/init.d/zoneminder /etc/rc6.d/K20zoneminder
- Instalar mjpg_streamer dentro de /etc/zm
wget http://sourceforge.net/projects/mjpg-streamer/files/mjpg-streamer_r94-1_i386.deb/download
dpkg mjpg-streamer_r94-1_i386.deb
./StreamWebCam.sh
- Criar um arquivo dentro de /etc/zm chamado StreamWebCam.sh
#!/bin/bash
# Script que cria um stream do video da webcam na porta 8080
# utilizando a aplicação mjpg_streamer
depmod -a
modprobe uvcvideo
cd /usr/bin
./mjpg_streamer -i "input_uvc.so -d /dev/video0 -fps 4 -r CIF"
- Permissão para o arquivo /etc/zm/StreamWebCam.sh
chmod 777 StreamWebCam.sh
Dia: 14/12/2010
CRONTAB
- Configurando agendamentos em /etc/crontab
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
* 7 * * * root ntpdate -s ntp.cais.rnp.br
* 15 * * * root ntpdate -s ntp.cais.rnp.br
* 23 * * * root ntpdate -s ntp.cais.rnp.br
*/5 * * * * root php /var/www/cacti/poller.php > /dev/null 2>&1
00 3 * * * root /var/backup/backup.sh 2>/var/backup/relatorios/relatorio.txt
*/1 * * * * root /etc/init.d/Stream
*/5 * * * * root /etc/init.d/monitoramento.sh 2>/tmp/mensagem.txt
Aplicação
- index.php
<?
session_start();
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<TITLE> Centro Comercial Ritz </TITLE>
</HEAD>
<frameset rows="130,*" border="2" bordercolor="black" scrolling="no">
<frame src="topo1.php" name="top" scrolling="NO" noresize>
<?
if (!isset($_SESSION['usuario'])){
?>
<frame src="administrador.php" name="administrador">
<?
}else{
?>
<frame src="index1.php" name="index1">
<?
}
?>
</frameset>
</HTML>
- administrador.php
<?
session_start();
?>
<HTML>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<BODY background="fundo.jpg" >
<br>
<br>
<br>
<br>
<font face="tahoma">
<center><h2> Administração de Usuários</h2></center>
<br>
<form name="administrador.php" method="post" action="outra.php"
<p><b> <center>Usuário:</b> <input type="text" name="usuario"></p>
<p><b>Senha: </b><input type="password" name="senha"></p>
<input type="submit" name"botao" value="Entrar"></center>
</form>
</BODY>
</font>
</html>
- index1.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<TITLE> Centro Comercial Ritz </TITLE>
</HEAD>
<frameset cols="200,*" border="2" bordercolor="black" scrolling="no">
<frame src="menu.php" name="menu">
<frame src="principal.php" name="principal">
</frameset>
</HTML>
<?
}else{
header("Location:index.php");
}
?>
- topo.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<body background="logo3.jpg">
<div align="center">
</body>
</html>
<?
}else{
header("Location:index.php");
}
?>
- menu.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<HTML>
<HEAD><title>Centro Comercial Ritz </TITLE></HEAD>
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<BODY background="fundo.jpg" >
<p>
<a href="principal.php" target="principal"><p align="center"><img src="logotipo.jpg" border="0"></a></li>
<b>
<a href="sair.php" target="new"><p align="center"><img src="sair.jpg"></a></li>
<link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center" border="3" bordercolor="black" width="200" height="200"><cellpadding"9" border="5"><cellspacing="9" border="4"><cell content="10" border="5">
<TR>
<br>
<TD link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center"><font face="tahoma"><a href="cadastro.php" target="principal"> Usuarios </font></TD>
<br>
</TR>
<br>
<TD align="center"><font face="tahoma"><a href="http://ritz.sj.ifsc.edu.br:8080/?action=stream" target="new"> Cameras de Monitoramento</font></TD>
</TR><br>
<br>
<TD align="center"><font face="tahoma"><a href="backup.php" target="principal"> Backup</font></TD>
</TR><br>
<br>
<TD align="center"><font face="tahoma"><a href="http://ritz.sj.ifsc.edu.br/cacti" target="principal"> Cacti </font></TD>
</TR>
<br>
<br>
<TD align="center"><font face="tahoma"><a href="administrador1.php" target="principal"> Administrador</font></TD>
</TR>
<br>
</b>
</BODY>
</HTML>
<?
}else{
header("Location:index.php");
}
?>
- principal.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<HTML>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<HEAD><TITLE>Centro Comercial Ritz </TITLE></HEAD>
<BODY background="fundo.jpg" >
<br>
<br>
<center><img src="predio.jpg" ></center>
<br>
<b>
<p align="center"><font face="tahoma">
ritz.sj.ifsc.edu.br
</b>
</body>
</HTML>
<?
}else{
header("Location:index.php");
}
?>
- adicionar.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<BODY background="fundo.jpg" >
<font face="tahoma">
<br>
<center><h2> Autenticação de Usuários</h2></center>
<br>
<TABLE link="003399" alink="9966cc" vlink="6600FF" align="center" border="0" bordercolor="black" width="120" height="120"><cellpadding"9" border="0"><cellspacing="9" border="0"><cell content="10" border="0">
<form name="adicionar.php" method="post" action="outra1.php"
<TR>
<TD align="center"><p><b> Usuários:</b> <input type="text" name="usuario"></p></TD>
</TR>
<TR>
<TD align="center"><p><b>Senha: </b><input type="password" name="senha"></p></TD>
</TR>
<TR>
<TD align="center"></b><input type="submit" name"botao" value="Enviar Dados"></TD>
</TR>
</form>
</table>
</BODY>
</font>
</html>
<?
}else{
header("Location:index.php");
}
?>
- alterar.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<?
$codigo = $_GET['id'];
?>
<html>
<font face="tahoma">
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<BODY background="fundo.jpg" >
<p><b><center> <h2>
<?
echo "Alterando informações do Usuário " . $usuario;
?>
</b></center></h2>
<br>
<br>
<form name="alterar.php" method="post" action="mudarsenha.php">
<center><b>
Digite a nova senha:<br> <input type="password" name="senha"><br>
<br>
Confirme a nova senha:<br> <input type="password" name="nsenha"><br>
<input type="submit" name"botao" value="Enviar">
<input name="codigo" value="<?echo $codigo;?>" type="hidden">
</center></b>
</form>
</font>
</html>
<?
}else{
header("Location:index.php");
}
?>
- backup.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<font face="tahoma">
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<BODY background="fundo.jpg" >
<center><h2><b><br>
BACKUPS REALIZADOS
<br>
<br>
TIPO | DATA/HORA | DIRETORIOS | DIA DA SEMANA
<br>
<?
$tipo= "/var/backup/relatorios/relatorio.txt";
$tipo1= fopen($tipo, "rb");
$tipo2= fread($tipo1, filesize($tipo));
echo $tipo2;
fclose($tipo1);
?>
</center>
</font>
</html>
<?
}else{
header("Location:index.php");
}
?>
- cadastro.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<BODY background="fundo.jpg" >
<br>
<br>
<br>
<br>
<font face="tahoma">
<center><h2> Bem Vindo ao ambiente dos Usuários ADSL</h2>
<b>
<TD link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center"><font face="tahoma"><a href="adicionar.php" target="principal"> Adicionar Usuários</font></TD>
<br>
</TR>
<br>
<TD link="#FF0000" alink="#FF0000" vlink="#FF0000" align="center"><font face="tahoma"><a href="listar.php" target="principal"> Lista dos Usuários Cadastrados</font></TD>
<br>
</TR>
<br>
<b>
</center>
</BODY>
</html>
<?
}else{
header("Location:index.php");
}
?>
- administrador1.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<BODY background="fundo.jpg" >
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<font face="tahoma">
<br>
<center><h2> Autenticação dos Administradores do Sistema</h2></center>
<br>
<TABLE link="003399" alink="9966cc" vlink="6600FF" align="center" border="0" bordercolor="black" width="120" height="120"><cellpadding"9" border="0"><cellspacing="9" border="0"><cell content="10" border="0">
<form name="administrador1.php" method="post" action="outra2.php"
<TR>
<TD align="center"><p><b> Nome:</b> <input type="text" name="nome"></p></TD>
</TR>
<TR>
<TD align="center"><p><b>Telefone: </b><input type="text" name="telefone"></p></TD>
</TR>
<TR>
<TD align="center"><p><b> Login:</b> <input type="text" name="usuario"></p></TD>
</TR>
<TR>
<TD align="center"><p><b>Senha: </b><input type="password" name="senha"></p></TD>
</TR>
<TR>
<TD align="center"></b><input type="submit" name"botao" value="Enviar Dados"></TD>
</TR>
</form>
</table>
</BODY>
</font>
</html>
<?
}else{
header("Location:index.php");
}
?>
- excluir.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<font face="tahoma">
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<BODY background="fundo.jpg" >
<center><h2><b><br>
<?
$usuario = $_GET['id'];
echo "Tem certeza que deseja excluir o Usuário " . $usuario . "?";
?>
<br>
<br>
<center>
<?
echo "<a href=sim.php?id=" . $usuario . ">" . "<img src=sim.JPG>" . "<br><br>";
echo "<a href=nao.php?id=" . $usuario . ">" . "<img src=nao.JPG>";
?>
</center>
</font>
</html>
<?
}else{
header("Location:index.php");
}
?>
- erro.php
<?
session_start();
if (!isset($_SESSION['usuario'])){
?>
<HTML>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<BODY background="fundo.jpg" >
<font face="tahoma">
<center>
<br>
<h1>Desculpe!</h1>
<hr>
<b>
<p>Login incorreto</p></b>
<a href="administrador.php"> Voltar </a>
</center>
</body>
</html>
<?
}else{
header("Location:index.php");
}
?>
- listar.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<font face="tahoma">
<BODY background="fundo.jpg" >
<br>
<center><h1>Usuarios Cadastrados</h1><P>
<b>
<br>
<?
//conectando no servidor
$conexao = mysql_connect("localhost","root","projetoritz");
//selecao da base de dados
$base_ok = mysql_select_db("radius",$conexao);
//obtendo os registro da tabela contatos
$consulta = "SELECT * from radcheck";
$resultado = mysql_query($consulta,$conexao);
//percorrendo a linhas obtidas pela consulta
while($linha = mysql_fetch_array($resultado)){
echo "<a href=processausuario.php?nome=" . $linha['username'] . ">" . $linha['username'] . "<br> <br>";
}
//liberando a consulta
mysql_free_result($resultado);
//fechando a conexao
mysql_close($conexao);
?>
</b>
</center>
</font>
</body>
</html>
<?
}else{
header("Location:index.php");
}
?>
- mudarsenha.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<BODY background="fundo.jpg" >
<font face="tahoma">
<?
$cod = $_POST['codigo'];
$pass = $_POST ['senha'];
$passn = $_POST ['nsenha'];
if (($pass == $passn)){
$conexao = mysql_connect ("localhost", "root", "projetoritz");
$base_ok = mysql_select_db("radius",$conexao);
$alterar = "UPDATE radcheck set value='$pass' where ID='$cod'"; mysql_query ($alterar,$conexao);
mysql_close($conexao);
}else{
echo "Senha incorreta!";
echo "<a href=alterar.php?id=$cod>Voltar</a>";
}
if ($base_ok) {
echo "<h2><center><b>Dados Atualizados com Sucesso!</h2></center></b>";
}else{
echo "<h2><center><b>Usuario nao modificado.</h2></center></b>";
}
?>
</font>
</html>
<?
}else{
header("Location:index.php");
}
?>
- outra1.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<BODY background="fundo.jpg" >
<font face="tahoma">
<br>
<?
$usu = $_POST['usuario'];
$pass = $_POST ['senha'];
$conexao = mysql_connect ("localhost", "root", "projetoritz");
$base_ok = mysql_select_db("radius",$conexao);
$inserir = "INSERT INTO radcheck (username, attribute, op, value) VALUES ('$usu', 'Cleartext-Password', ':=', '$pass')"; mysql_query ($inserir,$conexao);
mysql_close($conexao);
?>
<center><h2><b>
Dados inseridos com sucesso no banco de dados.
<br>
A rede RITZ agradece!
</center></h2></b>
</BODY>
</html>
<?
}else{
header("Location:index.php");
}
?>
- outra2.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<BODY background="fundo.jpg" >
<font face="tahoma">
<br>
<?
$nome = $_POST['nome'];
$tel = $_POST['telefone'];
$usu = $_POST['usuario'];
$pass = $_POST ['senha'];
$conexao = mysql_connect ("localhost", "root", "projetoritz");
$base_ok = mysql_select_db("ritz",$conexao);
$inserir = "INSERT INTO administrador (cNome, cTelefone, cLogin, cSenha) VALUES ('$nome', '$tel', '$usu', '$pass')"; mysql_query ($inserir,$conexao);
mysql_close($conexao);
?>
<center><h2><b>
Dados inseridos com sucesso no banco de dados.
<br>
A rede RITZ agradece!
</center></h2></b>
</BODY>
</html>
<?
}else{
header("Location:index.php");
}
?>
- outra.php
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?
session_start();
$nome = $_POST['usuario'];
$password = $_POST ['senha'];
$conexao = mysql_connect ("localhost", "root", "projetoritz");
$base_ok = mysql_select_db("ritz",$conexao);
$consultar = "select cID from administrador where cLOGIN = '$nome' && cSENHA = '$password'";
$resultado = mysql_query ($consultar,$conexao);
$linhas = mysql_num_rows($resultado);
mysql_close($conexao);
if ($linhas == 1)
{
$_SESSION['usuario'] = $nome;
$_SESSION['senha'] = $password;
echo "<script>window.location='index1.php';</script>";
}else{
echo "<script>window.location='erro.php';</script>";
}
?>
</html>
- processausuario.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<BODY background="fundo.jpg" >
<br>
<br>
<br>
<br>
<font face="tahoma">
<center><b><h2>
<?
echo "Usuario " . $_GET['nome'];
$usuario = $_GET['nome'];
?> </h2>
<?
//conectando no servidor
$conexao = mysql_connect("localhost","root","projetoritz") or die ("erro de conexao");
//selecao da base de dados
$base_ok = mysql_select_db("radius",$conexao) or die ("erro no esquema");
//obtendo os registro da tabela contatos
$consulta = "select * from radcheck where username = '$usuario'";
$resultado = mysql_query($consulta,$conexao) or die ("erro no select");
$linha = mysql_fetch_row($resultado) or die ("erro no row");
//percorrendo a linhas obtidas pela consulta
echo "Identificacao: " . $linha[0] . "<br>";
echo "Usuário: " . $linha[1] . "<br>" ;
echo "<BR><HR><BR>";
//liberando a consulta
mysql_free_result($resultado);
//fechando a conexao
mysql_close($conexao);
echo "<u><a href=alterar.php?id$cod=$linha[0]>Alterar</u></a>" . "<br> <br>";
echo "<u><a href=excluir.php?id$cod=$linha[0]> Excluir</u></a>";
?>
</center></b>
</html>
<?
}else{
header("Location:index.php");
}
?>
- sair.php
<?
session_start();
if (isset($_SESSION['usuario'])){
session_destroy();
header("Location:administrador.php");
}else{
session_destroy();
header("Location:index.php");
}
?>
- sim.php
<?
session_start();
if (isset($_SESSION['usuario'])){
?>
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<BODY background="fundo.jpg" >
<font face="tahoma">
<br>
<?
$codigo = $_GET['id'];
$conexao = mysql_connect ("localhost", "root", "projetoritz");
$base_ok = mysql_select_db("radius",$conexao);
$inserir = "delete from radcheck where ID=$codigo"; mysql_query ($inserir,$conexao);
if ($base_ok) {
echo "<h2><center><b>Usuario excluido com sucesso!</h2></center></b>";
}else{
echo "<h2><center><b>Usuario nao excluido.</h2></center></b>";
}
mysql_close($conexao);
?>
</BODY>
</html>
<?
}else{
header("Location:index.php");
}
?>
- topo1.php
<?
session_start();
?>
<html>
<body background="logo4.jpg">
<div align="center">
</body>
</html>
Dia: 15/12/2010
Protocolos utilizados na camada de enlace
- PPPoE - Utilizado na comunicação entre a estação cliente e o DSLAN.
- IEEE 802.11 modo ad hoc - Utilizado na rede sem fio para fazer a comunicação entre os laboratórios. Rede ad hoc.
- Ethernet - Utilizado na rede do laboratório redes I.
MODEM D-LINK 500B
Computador semfio2 (preto) do Laboratório de Redes I
#!/bin/bash
# Script para configuração das interfaces das redes sem-fio no computador semfio2 (preto) do Laboratório de Redes I
# Lembrando: wlan0 = Equipe Celtics, wlan1 = Equipe Ritz, wlan2 = Equipe TechSpot (todas configuradas conjuntamente)
# 20101203 Ronaldo Lages [3 linhas] derruba as interfaces de rede sem-fio e mostra
ifconfig wlan0 down
ifconfig wlan1 down
ifconfig wlan2 down
ifconfig
# 20101203 Ronaldo Lages [3 linhas] coloca as interface em modo Ad-Hoc (conectividade direta sem APs) e mostra
iwconfig wlan0 mode ad-hoc
iwconfig wlan1 mode ad-hoc
iwconfig wlan2 mode ad-hoc
# 20101203 Ronaldo Lages [3 linhas] levanta as interfaces de rede sem-fio conforme /etc/network/interfaces e mostra
ifconfig wlan0 up
ifconfig wlan1 up
ifconfig wlan2 up
ifconfig
# 20101203 Ronaldo Lages [3 linhas] define identificação (ESSID) para cada rede sem-fio (conforme nomes das Equipes) e mostra
iwconfig wlan0 essid "Celtics"
iwconfig wlan1 essid "Ritz"
iwconfig wlan2 essid "TechSpot"
iwconfig
# 20101203 Ronaldo Lages [3 linhas] define canal/frequência para cada rede sem-fio (conforme http://atalho.to/IFSC_PI2010-2) e mostra
iwconfig wlan0 channel 1
iwconfig wlan1 channel 11
iwconfig wlan2 channel 6
iwconfig
# 20101203 Ronaldo Lages [3 linhas] define chave/senha para criptografia WEP para cada rede sem-fio (exatos 5 caracteres) e mostra
iwconfig wlan0 key s:wlan0
iwconfig wlan1 key s:wlan1
iwconfig wlan2 key s:wlan2
iwconfig
# 20101203 Ronaldo Lages [1 linha] mostra finalmente configuração das interfaces de rede
ifconfig -a
Computador semfio1 (branco) do Laboratório de Meios de Transmissão
#!/bin/bash
# Script para configuração das interfaces das redes sem-fio no computador semfio1 (branco) do Laboratório de Meios de Transmissão
# Lembrando: wlan0 = Equipe Celtics, wlan1 = Equipe Ritz, wlan2 = Equipe TechSpot (todas configuradas conjuntamente)
# 20101203 Ronaldo Lages [3 linhas] derruba as interfaces de rede sem-fio e mostra
ifconfig wlan0 down
ifconfig wlan1 down
ifconfig wlan2 down
ifconfig
# 20101203 Ronaldo Lages [3 linhas] coloca as interface em modo Ad-Hoc (conectividade direta sem APs) e mostra
iwconfig wlan0 mode ad-hoc
iwconfig wlan1 mode ad-hoc
iwconfig wlan2 mode ad-hoc
# 20101203 Ronaldo Lages [3 linhas] levanta as interfaces de rede sem-fio conforme /etc/network/interfaces e mostra
ifconfig wlan0 up
ifconfig wlan1 up
ifconfig wlan2 up
ifconfig
# 20101203 Ronaldo Lages [3 linhas] define identificação (ESSID) para cada rede sem-fio (conforme nomes das Equipes) e mostra
iwconfig wlan0 essid "Celtics"
iwconfig wlan1 essid "Ritz"
iwconfig wlan2 essid "TechSpot"
iwconfig
# 20101203 Ronaldo Lages [3 linhas] define canal/frequência para cada rede sem-fio (conforme http://atalho.to/IFSC_PI2010-2) e mostra
iwconfig wlan0 channel 1
iwconfig wlan1 channel 11
iwconfig wlan2 channel 6
iwconfig
# 20101203 Ronaldo Lages [3 linhas] define chave/senha para criptografia WEP para cada rede sem-fio (exatos 5 caracteres) e mostra
iwconfig wlan0 key s:wlan0
iwconfig wlan1 key s:wlan1
iwconfig wlan2 key s:wlan2
iwconfig
# 20101203 Ronaldo Lages [1 linha] mostra finalmente configuração das interfaces de rede
ifconfig -a