Mudanças entre as edições de "CTIC:Servidores"
(→Backup) |
(→SSH) |
||
(40 revisões intermediárias por 2 usuários não estão sendo mostradas) | |||
Linha 305: | Linha 305: | ||
HostKey /etc/ssh/ssh_host_rsa_key | HostKey /etc/ssh/ssh_host_rsa_key | ||
HostKey /etc/ssh/ssh_host_dsa_key | HostKey /etc/ssh/ssh_host_dsa_key | ||
+ | HostKey /etc/ssh/ssh_host_ecdsa_key | ||
+ | HostKey /etc/ssh/ssh_host_ed25519_key | ||
# | # | ||
# Segurança interprocesso | # Segurança interprocesso | ||
− | UsePrivilegeSeparation | + | UsePrivilegeSeparation=sandbox |
StrictModes yes | StrictModes yes | ||
# | # | ||
Linha 507: | Linha 509: | ||
[[Imagem:Clarke - esxi_shell.png|400px|center]] | [[Imagem:Clarke - esxi_shell.png|400px|center]] | ||
− | ==vm- | + | ==vm-lan1== |
* Máquina virtual | * Máquina virtual | ||
* Este servidor foi instalado seguindo as configurações gerais definidas nos itens 2, 3 e 4 desta página. | * Este servidor foi instalado seguindo as configurações gerais definidas nos itens 2, 3 e 4 desta página. | ||
===Rede=== | ===Rede=== | ||
− | + | Configurando o arquivo interfaces | |
+ | Foram adicionados 5 interfaces virtuais nessa VM através do VSphere Client, sendo cada uma delas em uma Vlan diferente. | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
− | + | cd /etc | |
+ | git add network/interfaces | ||
+ | git commit -a -m "Configuração original das interfaces de rede." | ||
+ | vim network/interfaces | ||
+ | |||
+ | auto lo | ||
+ | iface lo inet loopback | ||
+ | |||
+ | auto eth0 | ||
+ | iface eth0 inet static | ||
+ | address 172.18.1.101 | ||
+ | netmask 255.255.192.0 | ||
+ | gateway 172.18.0.254 | ||
+ | dns-nameservers 200.135.37.72 200.135.37.65 | ||
+ | dns-search sj.ifsc.edu.br | ||
+ | |||
+ | auto eth1 | ||
+ | iface eth1 inet static | ||
+ | address 172.18.110.1 | ||
+ | netmask 255.255.255.0 | ||
+ | gateway 172.18.110.254 | ||
+ | dns-nameservers 200.135.37.72 200.135.37.65 | ||
+ | dns-search sj.ifsc.edu.br | ||
+ | |||
+ | auto eth2 | ||
+ | iface eth2 inet static | ||
+ | address 172.18.120.1 | ||
+ | netmask 255.255.254.0 | ||
+ | gateway 172.18.121.254 | ||
+ | dns-nameservers 200.135.37.72 200.135.37.65 | ||
+ | dns-search sj.ifsc.edu.br | ||
+ | |||
+ | auto eth3 | ||
+ | iface eth3 inet static | ||
+ | address 172.18.199.1 | ||
+ | netmask 255.255.255.0 | ||
+ | gateway 172.18.199.254 | ||
+ | dns-nameservers 200.135.37.72 200.135.37.65 | ||
+ | dns-search sj.ifsc.edu.br | ||
+ | |||
+ | auto eth4 | ||
+ | iface eth4 inet static | ||
+ | address 172.18.200.1 | ||
+ | netmask 255.255.255.0 | ||
+ | gateway 172.18.200.254 | ||
+ | dns-nameservers 200.135.37.72 200.135.37.65 | ||
+ | dns-search sj.ifsc.edu.br | ||
+ | |||
+ | auto eth5 | ||
+ | iface eth5 inet static | ||
+ | address 172.18.109.1 | ||
+ | netmask 255.255.255.0 | ||
+ | gateway 172.18.109.254 | ||
+ | dns-nameservers 200.135.37.72 200.135.37.65 | ||
+ | dns-search sj.ifsc.edu.br | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Salvando a configuração | |
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
− | + | cd /etc | |
+ | git add network/interfaces | ||
+ | git commit -a -m "Arquivo interface reconfigurado para usar as insterfaces virtuais do VMware." | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ===Serviços=== | |
+ | |||
+ | ====DHCP==== | ||
+ | |||
+ | Instalação do serviço DHCP | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | aptitude install isc-dhcp-server | ||
+ | cd /etc/ | ||
+ | git add dhcp/dhcpd.conf | ||
+ | git commit -a -m "Configuração original do serviço DHCP" | ||
+ | vim dhcp/dhcpd.conf | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Configuração do DHCP | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
+ | # | ||
+ | # The ddns-updates-style parameter controls whether or not the server will | ||
+ | # attempt to do a DNS update when a lease is confirmed. We default to the | ||
+ | # behavior of the version 2 packages ('none', since DHCP v2 didn't | ||
+ | # have support for DDNS.) | ||
+ | ddns-update-style none; | ||
+ | |||
+ | # option definitions common to all supported networks... | ||
+ | option domain-name "sj.ifsc.edu.br"; | ||
+ | option domain-name-servers 200.135.37.65, 200.135.37.72; | ||
+ | |||
+ | default-lease-time 7200; | ||
+ | max-lease-time 172800; | ||
− | + | # If this DHCP server is the official DHCP server for the local | |
− | + | # network, the authoritative directive should be uncommented. | |
+ | authoritative; | ||
− | + | # Use this to send dhcp log messages to a different log file (you also | |
− | + | # have to hack syslog.conf to complete the redirection). | |
+ | log-facility local7; | ||
+ | |||
+ | failover peer "failover" { | ||
+ | primary; | ||
+ | address 172.18.109.1; | ||
+ | port 648; | ||
+ | peer address 172.18.109.2; | ||
+ | peer port 647; | ||
+ | max-response-delay 30; | ||
+ | max-unacked-updates 10; | ||
+ | load balance max seconds 3; | ||
+ | } | ||
+ | |||
+ | subnet 172.18.0.0 netmask 255.255.192.0 { | ||
+ | option routers 172.18.0.254; | ||
+ | option subnet-mask 255.255.192.0; | ||
+ | option broadcast-address 172.18.63.255; | ||
+ | option netbios-name-servers 172.18.109.10; | ||
+ | pool{ | ||
+ | failover peer "failover"; | ||
+ | range 172.18.15.1 172.18.19.255; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | subnet 172.18.110.0 netmask 255.255.255.0 { | ||
+ | option routers 172.18.110.254; | ||
+ | option subnet-mask 255.255.255.0; | ||
+ | option broadcast-address 172.18.110.255; | ||
+ | option netbios-name-servers 172.18.109.10; | ||
+ | pool{ | ||
+ | failover peer "failover"; | ||
+ | range 172.18.110.3 172.18.110.240; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | subnet 172.18.120.0 netmask 255.255.254.0 { | ||
+ | option routers 172.18.121.254; | ||
+ | option subnet-mask 255.255.254.0; | ||
+ | option broadcast-address 172.18.121.255; | ||
+ | option netbios-name-servers 172.18.109.10; | ||
+ | pool{ | ||
+ | failover peer "failover"; | ||
+ | range 172.18.120.3 172.18.121.240; | ||
+ | default-lease-time 1800; | ||
+ | max-lease-time 3600; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | subnet 172.18.199.0 netmask 255.255.255.0 { | ||
+ | option routers 172.18.199.254; | ||
+ | option subnet-mask 255.255.255.0; | ||
+ | option broadcast-address 172.18.199.255; | ||
+ | option netbios-name-servers 172.18.109.10; | ||
+ | pool{ | ||
+ | failover peer "failover"; | ||
+ | range 172.18.199.3 172.18.199.240; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | subnet 172.18.200.0 netmask 255.255.255.0 { | ||
+ | option routers 172.18.200.254; | ||
+ | option subnet-mask 255.255.255.0; | ||
+ | option broadcast-address 172.18.200.255; | ||
+ | option netbios-name-servers 172.18.109.10; | ||
+ | pool{ | ||
+ | failover peer "failover"; | ||
+ | range 172.18.200.3 172.18.200.240; | ||
+ | } | ||
+ | } | ||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | Finalizando | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | service isc-dhcp-server restart | ||
+ | |||
+ | git commit -a -m "Configurado com failover, vm-lan2 primário e vm-lan1 secundário." | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====Backup==== | ||
+ | |||
+ | =====Cliente===== | ||
+ | |||
+ | Instalação do bacula-client | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | aptitude install bacula-client | ||
+ | cd /etc | ||
+ | git add bacula/bacula-fd.conf | ||
+ | git commit -a -m "Arquivo de configuração original bacula-fd." | ||
+ | vim bacula/bacula-fd.conf | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Configuração do bacula-client | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | # | ||
+ | # List Directors who are permitted to contact this File daemon | ||
+ | # | ||
+ | Director { | ||
+ | Name = monitoramento-dir | ||
+ | Password = "" | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # "Global" File daemon configuration specifications | ||
+ | # | ||
+ | FileDaemon { # this is me | ||
+ | Name = vm-lan2-fd | ||
+ | FDport = 9102 # where we listen for the director | ||
+ | WorkingDirectory = /var/lib/bacula | ||
+ | Pid Directory = /var/run/bacula | ||
+ | Maximum Concurrent Jobs = 20 | ||
+ | FDAddress = 172.18.109.1 | ||
+ | } | ||
+ | |||
+ | # Send all messages except skipped files back to Director | ||
+ | Messages { | ||
+ | Name = Standard | ||
+ | director = monitoramento-dir = all, !skipped, !restored | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Finalizando | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | service bacula-fd restart | ||
+ | |||
+ | git commit -a -m "Bacula fd configurado para receber acesso do monitoramento-dir." | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | =====Servidor===== | ||
+ | |||
+ | O servidor bacula atualmente é o monitoramento. Segue abaixo o que foi adicionado nos arquivos de configuração do servidor | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | bacula-dir.conf: | ||
+ | |||
+ | FileSet { | ||
+ | Name = "vm-basico" | ||
+ | Include { | ||
+ | Options { | ||
+ | Signature = MD5 | ||
+ | compression = gzip | ||
+ | } | ||
+ | File = /etc | ||
+ | File = /root | ||
+ | File = /var/lib | ||
+ | File = /var/log | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Client { | ||
+ | Name = vm-lan1-fd | ||
+ | Address = 172.18.109.1 | ||
+ | FDPort = 9102 | ||
+ | Catalog = MyCatalog | ||
+ | Password = "" | ||
+ | File Retention = 30 days | ||
+ | Job Retention = 2 months | ||
+ | AutoPrune = yes | ||
+ | } | ||
+ | |||
+ | Job { | ||
+ | Name = "vm-lan1-job" | ||
+ | JobDefs = "DefaultJob" | ||
+ | Client = vm-lan1-fd | ||
+ | FileSet = "vm-basico" | ||
+ | Write Bootstrap = "/var/lib/bacula/vm-lan1.bsr" | ||
+ | Priority = 12 | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | E reiniciando o bacula-director | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | service bacula-director restart | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==== Zabbix ==== | ||
+ | |||
+ | ===== Cliente ===== | ||
+ | |||
+ | Instalação do Zabbix Agent: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | apt-get install zabbix-agent | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Configuração do Zabbix Agent | ||
+ | |||
+ | O arquivo de configuração: | ||
+ | <syntaxhighlight lang=bash> | ||
+ | /etc/zabbix/zabbix_agentd.conf | ||
+ | </syntaxhighlight> | ||
+ | O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado). O hostname configurado deve ser o mesmo que o campo "Nome do host" no formulário de criação de novo host no Zabbix Server. | ||
+ | |||
+ | ==vm-lan2== | ||
+ | * Máquina virtual | ||
+ | * Este servidor foi instalado seguindo as configurações gerais definidas nos itens 2, 3 e 4 desta página. | ||
+ | |||
+ | ===Rede=== | ||
Configurando o arquivo interfaces | Configurando o arquivo interfaces | ||
+ | |||
+ | Foram adicionados 5 interfaces virtuais nessa VM através do VSphere Client, sendo cada uma delas em uma Vlan diferente. | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
Linha 560: | Linha 859: | ||
auto eth0 | auto eth0 | ||
iface eth0 inet static | iface eth0 inet static | ||
− | + | address 172.18.1.102 | |
− | + | netmask 255.255.192.0 | |
− | + | gateway 172.18.0.254 | |
− | + | dns-nameservers 200.135.37.72 200.135.37.65 | |
− | + | dns-search sj.ifsc.edu.br | |
− | auto | + | auto eth1 |
− | iface | + | iface eth1 inet static |
− | + | address 172.18.110.2 | |
− | + | netmask 255.255.255.0 | |
− | + | gateway 172.18.110.254 | |
− | + | dns-nameservers 200.135.37.72 200.135.37.65 | |
− | + | dns-search sj.ifsc.edu.br | |
− | |||
− | auto | + | auto eth2 |
− | iface | + | iface eth2 inet static |
− | + | address 172.18.120.2 | |
− | + | netmask 255.255.254.0 | |
− | + | gateway 172.18.121.254 | |
− | + | dns-nameservers 200.135.37.72 200.135.37.65 | |
− | + | dns-search sj.ifsc.edu.br | |
− | |||
− | auto | + | auto eth3 |
− | iface | + | iface eth3 inet static |
− | + | address 172.18.199.2 | |
− | + | netmask 255.255.255.0 | |
− | + | gateway 172.18.199.254 | |
− | + | dns-nameservers 200.135.37.72 200.135.37.65 | |
− | + | dns-search sj.ifsc.edu.br | |
− | |||
− | auto | + | auto eth4 |
− | iface | + | iface eth4 inet static |
− | + | address 172.18.200.2 | |
− | + | netmask 255.255.255.0 | |
− | + | gateway 172.18.200.254 | |
− | + | dns-nameservers 200.135.37.72 200.135.37.65 | |
− | + | dns-search sj.ifsc.edu.br | |
− | + | ||
+ | auto eth5 | ||
+ | iface eth5 inet static | ||
+ | address 172.18.109.2 | ||
+ | netmask 255.255.255.0 | ||
+ | gateway 172.18.109.254 | ||
+ | dns-nameservers 200.135.37.72 200.135.37.65 | ||
+ | dns-search sj.ifsc.edu.br | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Linha 610: | Linha 913: | ||
cd /etc | cd /etc | ||
git add network/interfaces | git add network/interfaces | ||
− | git commit -a -m " | + | git commit -a -m "Arquivo interface reconfigurado para usar as insterfaces virtuais do VMware." |
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
===Serviços=== | ===Serviços=== | ||
+ | |||
+ | ====DHCP==== | ||
Instalação do serviço DHCP | Instalação do serviço DHCP | ||
Linha 628: | Linha 932: | ||
Configuração do DHCP | Configuração do DHCP | ||
+ | |||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
# | # | ||
Linha 640: | Linha 945: | ||
option domain-name-servers 200.135.37.65, 200.135.37.72; | option domain-name-servers 200.135.37.65, 200.135.37.72; | ||
− | + | default-lease-time 7200; | |
− | default-lease-time | + | max-lease-time 172800; |
− | max-lease-time | ||
# If this DHCP server is the official DHCP server for the local | # If this DHCP server is the official DHCP server for the local | ||
Linha 652: | Linha 956: | ||
log-facility local7; | log-facility local7; | ||
− | + | failover peer "failover" { | |
− | subnet 172.18.0.0 netmask 255.255. | + | primary; |
− | + | address 172.18.109.2; | |
− | + | port 647; | |
− | + | peer address 172.18.109.1; | |
− | + | peer port 648; | |
− | + | max-response-delay 30; | |
− | + | max-unacked-updates 10; | |
+ | load balance max seconds 3; | ||
+ | mclt 3600; | ||
+ | split 128; | ||
+ | } | ||
+ | |||
+ | subnet 172.18.0.0 netmask 255.255.192.0 { | ||
+ | option routers 172.18.0.254; | ||
+ | option subnet-mask 255.255.192.0; | ||
+ | option broadcast-address 172.18.63.255; | ||
+ | option netbios-name-servers 172.18.109.10; | ||
+ | pool{ | ||
+ | failover peer "failover"; | ||
+ | range 172.18.15.1 172.18.19.255; | ||
+ | } | ||
} | } | ||
− | |||
subnet 172.18.110.0 netmask 255.255.255.0 { | subnet 172.18.110.0 netmask 255.255.255.0 { | ||
option routers 172.18.110.254; | option routers 172.18.110.254; | ||
Linha 668: | Linha 985: | ||
option broadcast-address 172.18.110.255; | option broadcast-address 172.18.110.255; | ||
option netbios-name-servers 172.18.109.10; | option netbios-name-servers 172.18.109.10; | ||
− | + | pool{ | |
− | + | failover peer "failover"; | |
+ | range 172.18.110.3 172.18.110.240; | ||
+ | } | ||
} | } | ||
− | + | subnet 172.18.120.0 netmask 255.255.254.0 { | |
− | subnet 172.18.120.0 netmask 255.255. | + | option routers 172.18.121.254; |
− | option routers 172.18. | + | option subnet-mask 255.255.254.0; |
− | option subnet-mask 255.255. | + | option broadcast-address 172.18.121.255; |
− | option broadcast-address 172.18. | ||
option netbios-name-servers 172.18.109.10; | option netbios-name-servers 172.18.109.10; | ||
− | + | pool{ | |
− | + | failover peer "failover"; | |
+ | range 172.18.120.3 172.18.121.240; | ||
+ | default-lease-time 1800; | ||
+ | max-lease-time 3600; | ||
+ | } | ||
} | } | ||
− | |||
subnet 172.18.199.0 netmask 255.255.255.0 { | subnet 172.18.199.0 netmask 255.255.255.0 { | ||
option routers 172.18.199.254; | option routers 172.18.199.254; | ||
Linha 688: | Linha 1 009: | ||
option broadcast-address 172.18.199.255; | option broadcast-address 172.18.199.255; | ||
option netbios-name-servers 172.18.109.10; | option netbios-name-servers 172.18.109.10; | ||
− | + | pool{ | |
− | + | failover peer "failover"; | |
+ | range 172.18.199.3 172.18.199.240; | ||
+ | } | ||
} | } | ||
− | |||
subnet 172.18.200.0 netmask 255.255.255.0 { | subnet 172.18.200.0 netmask 255.255.255.0 { | ||
option routers 172.18.200.254; | option routers 172.18.200.254; | ||
Linha 698: | Linha 1 020: | ||
option broadcast-address 172.18.200.255; | option broadcast-address 172.18.200.255; | ||
option netbios-name-servers 172.18.109.10; | option netbios-name-servers 172.18.109.10; | ||
− | + | pool{ | |
− | + | failover peer "failover"; | |
+ | range 172.18.200.3 172.18.200.240; | ||
+ | } | ||
} | } | ||
+ | |||
+ | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Linha 710: | Linha 1 036: | ||
service isc-dhcp-server restart | service isc-dhcp-server restart | ||
− | git commit -a -m " | + | git commit -a -m "Configurado com failover, vm-lan2 primário e vm-lan1 secundário." |
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | ====Backup==== | ||
+ | |||
+ | =====Cliente===== | ||
+ | |||
+ | Instalação do bacula-client | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | aptitude install bacula-client | ||
+ | cd /etc | ||
+ | git add bacula/bacula-fd.conf | ||
+ | git commit -a -m "Arquivo de configuração original bacula-fd." | ||
+ | vim bacula/bacula-fd.conf | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Configuração do bacula-client | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | # | ||
+ | # List Directors who are permitted to contact this File daemon | ||
+ | # | ||
+ | Director { | ||
+ | Name = monitoramento-dir | ||
+ | Password = "" | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # "Global" File daemon configuration specifications | ||
+ | # | ||
+ | FileDaemon { # this is me | ||
+ | Name = vm-lan3-fd | ||
+ | FDport = 9102 # where we listen for the director | ||
+ | WorkingDirectory = /var/lib/bacula | ||
+ | Pid Directory = /var/run/bacula | ||
+ | Maximum Concurrent Jobs = 20 | ||
+ | FDAddress = 172.18.109.7 | ||
+ | } | ||
+ | |||
+ | # Send all messages except skipped files back to Director | ||
+ | Messages { | ||
+ | Name = Standard | ||
+ | director = monitoramento-dir = all, !skipped, !restored | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Finalizando | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | service bacula-fd restart | ||
+ | |||
+ | git commit -a -m "Bacula fd configurado para receber acesso do monitoramento-dir." | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | =====Servidor===== | ||
+ | |||
+ | O servidor bacula atualmente é o monitoramento. Segue abaixo o que foi adicionado nos arquivos de configuração do servidor | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | bacula-dir.conf: | ||
+ | |||
+ | FileSet { | ||
+ | Name = "vm-basico" | ||
+ | Include { | ||
+ | Options { | ||
+ | Signature = MD5 | ||
+ | compression = gzip | ||
+ | } | ||
+ | File = /etc | ||
+ | File = /root | ||
+ | File = /var/lib | ||
+ | File = /var/log | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Client { | ||
+ | Name = vm-lan2-fd | ||
+ | Address = 172.18.109.2 | ||
+ | FDPort = 9102 | ||
+ | Catalog = MyCatalog | ||
+ | Password = "" | ||
+ | File Retention = 30 days | ||
+ | Job Retention = 2 months | ||
+ | AutoPrune = yes | ||
+ | } | ||
+ | |||
+ | Job { | ||
+ | Name = "vm-lan2-job" | ||
+ | JobDefs = "DefaultJob" | ||
+ | Client = vm-lan2-fd | ||
+ | FileSet = "vm-basico" | ||
+ | Write Bootstrap = "/var/lib/bacula/vm-lan2.bsr" | ||
+ | Priority = 12 | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | E reiniciando o bacula-director | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | service bacula-director restart | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==== Zabbix ==== | ||
+ | |||
+ | ===== Cliente ===== | ||
+ | |||
+ | Instalação do Zabbix Agent: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | apt-get install zabbix-agent | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Configuração do Zabbix Agent | ||
+ | O arquivo de configuração: | ||
+ | <syntaxhighlight lang=bash> | ||
+ | /etc/zabbix/zabbix_agentd.conf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado). O hostname configurado deve ser o mesmo que o campo "Nome do host" no formulário de criação de novo host no Zabbix Server. | ||
+ | |||
+ | == Zabbix == | ||
+ | |||
+ | ==== Cliente ==== | ||
+ | |||
+ | Instalação do Zabbix Agent: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | apt-get install zabbix-agent | ||
− | ===Backup=== | + | </syntaxhighlight> |
+ | |||
+ | Configuração do Zabbix Agent | ||
+ | |||
+ | O arquivo de configuração: | ||
+ | <syntaxhighlight lang=bash> | ||
+ | /etc/zabbix/zabbix_agentd.conf | ||
+ | </syntaxhighlight> | ||
+ | O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado). O hostname configurado deve ser o mesmo que o campo "Nome do host" no formulário de criação de novo host no Zabbix Server. | ||
+ | |||
+ | ==vm-lan3== | ||
+ | * Máquina virtual | ||
+ | * Este servidor foi instalado seguindo as configurações gerais definidas nos itens 2, 3 e 4 desta página. | ||
+ | |||
+ | ===Rede=== | ||
+ | |||
+ | Este servidor foi configurado com uma interface de rede simples pertencente a Vlan Servidores. | ||
+ | |||
+ | ===Serviços=== | ||
+ | |||
+ | ====Backup==== | ||
+ | |||
+ | =====Servidor===== | ||
+ | |||
+ | O servidor bacula atualmente é o monitoramento. Segue abaixo o que foi adicionado nos arquivos de configuração do servidor | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | bacula-dir.conf: | ||
+ | |||
+ | FileSet { | ||
+ | Name = "vm-basico-mysql" | ||
+ | Include { | ||
+ | Options { | ||
+ | Signature = MD5 | ||
+ | compression = gzip | ||
+ | } | ||
+ | File = /etc | ||
+ | File = /root | ||
+ | File = /var/lib | ||
+ | File = /var/log | ||
+ | File = /backup | ||
+ | } | ||
+ | Exclude { | ||
+ | File = /var/lib/mysql | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Client { | ||
+ | Name = vm-lan3-fd | ||
+ | Address = 172.18.109.7 | ||
+ | FDPort = 9102 | ||
+ | Catalog = MyCatalog | ||
+ | Password = "" | ||
+ | File Retention = 30 days | ||
+ | Job Retention = 2 months | ||
+ | AutoPrune = yes | ||
+ | } | ||
+ | |||
+ | Job { | ||
+ | Name = "vm-lan3-job" | ||
+ | JobDefs = "DefaultJob" | ||
+ | Client = vm-lan3-fd | ||
+ | FileSet = "vm-basico-mysql" | ||
+ | ClientRunBeforeJob = "/etc/bacula/scripts/mysqldump.sh" | ||
+ | Write Bootstrap = "/var/lib/bacula/vm-lan3.bsr" | ||
+ | Priority = 12 | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
====Cliente==== | ====Cliente==== | ||
Linha 726: | Linha 1 260: | ||
cd /etc | cd /etc | ||
git add bacula/bacula-fd.conf | git add bacula/bacula-fd.conf | ||
− | commit -a -m "Arquivo de configuração original bacula-fd." | + | git commit -a -m "Arquivo de configuração original bacula-fd." |
vim bacula/bacula-fd.conf | vim bacula/bacula-fd.conf | ||
Linha 747: | Linha 1 281: | ||
# | # | ||
FileDaemon { # this is me | FileDaemon { # this is me | ||
− | Name = vm- | + | Name = vm-lan3-fd |
FDport = 9102 # where we listen for the director | FDport = 9102 # where we listen for the director | ||
WorkingDirectory = /var/lib/bacula | WorkingDirectory = /var/lib/bacula | ||
Linha 760: | Linha 1 294: | ||
director = monitoramento-dir = all, !skipped, !restored | director = monitoramento-dir = all, !skipped, !restored | ||
} | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | =====Script===== | ||
+ | |||
+ | Na configuração do servidor foi adicionado a linha "ClientRunBeforeJob = "/etc/bacula/scripts/mysqldump.sh"" na definição do Client. Este script vai ser executado antes de iniciar o Job definido. A função desse script é fazer um dump de toda a base de dados Mysql que está no servidor. O script é o seguinte: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | #!/bin/bash | ||
+ | |||
+ | #Apaga o dump anterior | ||
+ | rm -f /backup/mysqldump-vm-lan3*.tar.gz | ||
+ | #Faz o dump do todas as bases | ||
+ | mysqldump -uroot -p<senha do banco> --all-databases > /backup/mysqldump-vm-lan3-$(date +%d-%m-%y).sql | ||
+ | #Compacta o arquivo SQL do dump | ||
+ | tar -czf /backup/mysqldump-vm-lan3-$(date +%d-%m-%y).tar.gz /backup/mysqldump-vm-lan3*.sql | ||
+ | #Exclui o arquivo SQL sem compactação | ||
+ | rm -f /backup/mysqldump-vm-lan3*.sql | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Linha 766: | Linha 1 318: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
+ | |||
+ | service bacula-fd restart | ||
git commit -a -m "Bacula fd configurado para receber acesso do monitoramento-dir." | git commit -a -m "Bacula fd configurado para receber acesso do monitoramento-dir." | ||
Linha 771: | Linha 1 325: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ====Servidor==== | + | ==== Instalação do Zabbix ==== |
+ | |||
+ | Processo de instalação segundo a documentação oficial: https://www.zabbix.com/documentation/2.0/manual/installation/install_from_packages | ||
+ | |||
+ | ===== Servidor ===== | ||
+ | |||
+ | Configurando o repositório do Zabbix no Debian 7: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | wget http://repo.zabbix.com/zabbix/2.0/debian/pool/main/z/zabbix-release/zabbix-release_2.0-1wheezy_all.deb | ||
+ | dpkg -i zabbix-release_2.0-1wheezy_all.deb | ||
+ | apt-get update | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Instalação do Mysql: | ||
+ | |||
+ | Eu optei por instalar um servidor Mysql separado para o Zabbix. | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | apt-get install mysql-server | ||
+ | |||
+ | service mysql start | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Instalação do Zabbix Server: | ||
+ | |||
+ | Durante o processo de instalação dos pacotes abaixo será necessário informar a senha de root do mysql. Com isso no próprio processo de instalação será criado um usuário zabbix e todo a base de dados para o Zabbix Server. | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | apt-get install zabbix-server-mysql zabbix-frontend-php | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===== Cliente ===== | ||
+ | |||
+ | Instalação do Zabbix Agent: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | |||
+ | apt-get install zabbix-agent | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | Configuração do Zabbix Agent | ||
+ | |||
+ | O arquivo de configuração: | ||
+ | <syntaxhighlight lang=bash> | ||
+ | /etc/zabbix/zabbix_agentd.conf | ||
+ | </syntaxhighlight> | ||
+ | O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado e que deve ser o mesmo nome adicionado no Zabbix Server). | ||
+ | |||
+ | Template App MySQL | ||
+ | |||
+ | Esse template monitora o banco de dados. Foi necessário adicionar um arquivo adicional com a seguinte configuração: | ||
+ | |||
+ | <syntaxhighlight lang=bash> | ||
+ | /etc/my.cnf | ||
− | + | [client] | |
+ | user = zabbix | ||
+ | password = <password> | ||
+ | port = 3306 | ||
+ | |||
+ | [mysqld] | ||
+ | bind-address = 127.0.0.1 | ||
+ | port = 3306 | ||
+ | socket = /var/run/mysqld/mysqld.sock | ||
+ | datadir = /var/lib/mysql | ||
+ | tmpdir = /tmp | ||
+ | user = mysql | ||
+ | symbolic-links = 0 | ||
+ | |||
+ | [mysqld_safe] | ||
+ | socket = /var/run/mysqld/mysqld.sock | ||
+ | pid-file = /var/run/mysqld/mysqld.pid | ||
+ | log-error = /var/log/mysqld.log | ||
+ | |||
+ | |||
+ | </syntaxhighlight> | ||
=Referências= | =Referências= |
Edição atual tal como às 11h43min de 23 de novembro de 2015
Definições
Início (boot)
- Seja por hardware particular ou ambiente virtualizado, todo servidor deve iniciar após falha de energia. No ambiente virtualizado, deve-se estabelecer uma sequência de início (boot) dos servidores baseada na precedência dos serviços em rede:
digraph Boot {
"Sistemas de arquivos" [shape=Mrecord] "Diretórios e autenticação" [shape=Mrecord] "Compartilhamento e publicação de arquivos" [shape=Mrecord] "Comunicação por texto, voz e vídeo" [shape=Mrecord]
"Sistemas de arquivos" -> "Diretórios e autenticação" -> "Compartilhamento e publicação de arquivos" -> "Comunicação por texto, voz e vídeo"
}
</graphviz>Backup
A política adotada é de backup do sistema operacional com periodicidade mensal e arquivos pessoas com periodicidade diária, com prazo máximo de recuperação de 28 dias. Haverá cópias em mídia local e remota.
Pré-Instalação
- Configuração de hardware: ajustes de periféricos.
- Atualização de firmware para todo o hardware, quando disponível.
Instalação
- Sistema adotado: Debian stable para instalação em rede, preferencialmente a versão 64 bits.
Particionamento
- Partição primária para a raiz (/) com 20GB e formato EXT4.
- Partição primária para LVM, com adequação para cada necessidade/cenário, mas no mínimo:
- Partição lógica /var com 20GB e formato EXT4.
- Partição lógica /tmp com 5GB e formato EXT4.
Pós-Instalação
Área de troca (swap)
Swap como arquivo regular (/swap com permissões 0400), com tamanho de 2GB (ou RAM + swap = 4GB):
touch /swap
chown root:root /swap
chmod 000 /swap
dd if=/dev/zero of=/swap count=20 bs=100M
mkswap /swap
echo "/swap none swap sw 0 0" >> /etc/fstab
swapon /swap
Configuração da Rede
- Arquivo /etc/network/interfaces:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 172.18.1.1[..] netmask 255.255.0.0 gateway 172.18.0.254 dns-nameservers 200.135.37.72 200.135.37.65 dns-search sj.ifsc.edu.br
Atualização dos Pacotes
Como os discos de instalação do sistema podem estar desatualizados em relação aos pacotes que o compõem, o primeiro passo após a instalação é atualizar o sistema.
- Configuração do arquivo /etc/apt/sources.list:
deb http://debian.pop-sc.rnp.br/debian/ stable main contrib non-free deb http://security.debian.org/ stable/updates main contrib non-free
- Atualização do sistema:
aptitude update
aptitude safe-upgrade
aptitude full-upgrade
Sistema de Arquivos
De acordo com a política mínima estabelecida, é recomendado utilizar LVM.
- Instalação:
aptitude install lvm2
- Criação do volume físico (physical volume) na segunda partição:
pvcreate /dev/sda2
- Criação do agrupamento de volumes (volume group) com o nome lvm01:
vgcreate lvm01 /dev/sda2
- Criação dos volumes lógicos (logical volume) /var e /tmp e seus respectivos sistemas de arquivos (EXT4):
lvcreate -L 20G -n var lvm01
lvcreate -L 5G -n tmp lvm01
- Criação dos respectivos sistemas de arquivos do item anterior:
mkfs.ext4 /dev/lvm01/var
mkfs.ext4 /dev/lvm01/tmp
- Ativação dos sistemas de arquivos. Para isso, é preciso mover os arquivos já residentes nesses diretórios, porém no sistema de arquivos /, para o seu novo endereço:
mount /dev/lvm01/var /mnt
cd /mnt
(cd /var; tar cf - .) | tar xf -
cd /
rm -rf /var/*
umount /mnt
mount /dev/lvm01/var /var
cd /
rm -rf /tmp/*
mount /dev/lvm01/tmp /tmp
- E, por fim, a adição dos pontos de montagem no arquivo de configuração, /etc/fstab:
cat >> /etc/fstab << EOF
/dev/lvm01/var /var ext4 defaults 0 2
/dev/lvm01/tmp /tmp ext4 defaults 0 2
EOF
VMWare Tools
NOTA: Aplicação dependente do kernel instalado; ou seja, a atualização de kernel requer a recompilação dos módulos.
- No vSphere Client, é preciso mapear a imagem ISO do VMWare Tools em: Guest -> Install/Upgrade VMWare Tools.
- Antes de instalar propriamente a ferramenta, é necessário instalar alguns pacotes:
aptitude install linux-headers-$(uname -r) build-essential make
- E, por fim:
mount -oro /dev/scd0 /media/cdrom
cd /usr/src/
tar xzf /media/cdrom/VMWare*
cd vmware-tools-distrib
./vmware-install.pl
NOTE: Convém reiniciar o sistema para ativá-lo junto ao sistema virtualizador - e testar as partições do item anterior...
Ambiente do usuário Root
Aplicativos
- Programas para CLI:
aptitude install less vim bash-completion git keychain
Bash
- /root/.bash_logout:
clear
- /root/.bashrc:
export PS1='\h:\w#'
export PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
umask 077
alias ls='ls --color=auto'
alias l='ls -l'
alias ll='l -a'
alias rm='rm -ri'
alias cp='cp -ri'
alias mv='mv -i'
alias grep='grep --color=auto'
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
[ -f /etc/bash_completion ] && . /etc/bash_completion
if [ -x /usr/bin/keychain -a -f $HOME/.ssh/id_rsa ]
then
keychain id_rsa
[ -z "$HOSTNAME" ] && HOSTNAME=‘uname -n‘
[ -f $HOME/.keychain/$HOSTNAME-sh ] && . $HOME/.keychain/$HOSTNAME-sh
[ -f $HOME/.keychain/$HOSTNAME-sh-gpg ] && . $HOME/.keychain/$HOSTNAME-sh-gpg
fi
Git
- Configuração para o usuário root no arquivo /root/.gitconfig:
[user] name = Administrador do Sistema email = coinf.sj@ifsc.edu.br
VIm
- /root/.vimrc
set ic set noai set ts=4 set magic syntax on set hlsearch
Controle de Versão
Uma vez que o sistema já está atualizado e o usuário root tem um ambiente de trabalho mais rico em funcionalidades, pode-se partir para a configuração do sistema de fato. Antes disso, é importante marcar um ponto de partida dos arquivos: uma primeira versão. Foi adotada a ferramenta Git para controle de versão e como política somente os arquivos modificados por um administrador humano serão controlados (sob demanda).
- Criação do repositório no diretório /etc para controle da configuração do sistema:
cd /etc
git init
chmod 700 .git
NTP
NOTA:Se o VMWare Tools estiver instalado, este passo deve ser IGNORADO.
Após isso, pode-se iniciar o "versionamento" do diretório de configuração do sistema, o diretório /etc/. Porém, antes, é boa prática manter o relógio do sistema alinhado com a hora legal:
aptitude install ntp
Em seguida, faz-se um registro do original para, depois, atribuir como servidor (server) o do NIC.br: pool.ntp.br.
cd /etc
git add ntp.conf
git commit -a -m "Configuração original do serviço NTP."
vi /etc/ntp.conf
service ntp restart
git commit -a -m "NTP configurado para sincronizar com relógio do NIC.br: pool.ntp.br."
Usuários
Com a primeira versão catalogada, pode-se iniciar a configuração do sistema. Por questão de proteção, o usuário root deve ser o único usuário local com senha e interpretador de comandos (shell) válidos. Demais com interpretador /bin/false (sistema) ou /usr/sbin/nologin (regulares, como LDAP). Depois de modificado o arquivo, é essencial registrar a modificação:
cd /etc
git add passwd
git commit -a -m "Configuração original da lista de usuários e senhas."
sed -i 's/\/sh$/\/false/g' passwd
git commit -a -m "Somente usuário root com shell válido."
Serviços
Após o sistema, parte-se para a instalação, via pacotes, dos serviços:
aptitude install snmp snmpd ssh
SNMP
No caso do SNMP, será utilizada a versão 2c sem autenticação - considerando que esse serviço poderá ser aproveitado em disciplinas de Telecomunicações, como por exemplo Gerência de Redes.
- Serão monitoradas as conexões TCP dos serviços usando script próprio (/usr/local/sbin/conexoes_tcp).
touch /usr/local/sbin/conexoes_tcp
chmod 755 /usr/local/sbin/conexoes_tcp
cat > /usr/local/sbin/conexoes_tcp << EOF
#!/bin/sh
if [ "${1}" -gt 0 -a "${1}" -lt 65536 ]
then
/bin/netstat -ant|grep ":${1} "| grep STAB | wc -l
else
echo "Use: ${0} (porta)"
exit 255
fi
exit 0
EOF
- Esse script comporá a configuração do serviço. Antes, o registro do original, modificação para a política do campus (somente consulta pelo servidor Asimov) e reinício do serviço:
cd /etc/
git add snmp/snmpd.conf
git commit -a -m "Configuração original do serviço SNMP."
cat > snmp/snmpd.conf << EOF
rocommunity ifsc 172.18.1.1
sysLocation <sala>
sysContact coinf.sj@ifsc.edu.br
sysServices 72
exec conn_ssh /usr/local/sbin/conexoes_tcp 22
exec conn_http /usr/local/sbin/conexoes_tcp 80
EOF
onde <sala> identifica a localização física do equipamento, como por exemplo "RNP" ou "Laboratorio de Desenvolvimento".
Finalizando o processo:
service snmpd restart
git commit -a -m "SNMP somente leitura: versão 2, comunidade ifsc."
SSH
Em relação ao servidor SSH (/etc/ssh/sshd_config), será permitida apenas a conexão utilizando par de chaves pública/privada. Além disso, estará desativado o subsistema SFTP.
cd /etc
git add ssh/sshd_config
git commit -a -m "Configuração original do serviço SSH."
cat > ssh/sshd_config << EOF
# Rede
Port 22
Protocol 2
#
# Certificados do servidor
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#
# Segurança interprocesso
UsePrivilegeSeparation=sandbox
StrictModes yes
#
# Sessão
KeyRegenerationInterval 3600
ServerKeyBits 768
AcceptEnv LANG LC_*
PrintLastLog yes
#
# Manutenção da sessão
TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 4
#
# Log
SyslogFacility AUTH
LogLevel INFO
#
# Autenticação
LoginGraceTime 120
PermitRootLogin yes
Allowusers root
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no
#
# Autorização
UsePAM yes
EOF
Por fim, o registro do novo arquivo e reinício do serviço:
service ssh restart
git commit -a -m "Serviço SSH apenas com autenticação via certificado."
Para isso, deve-se ter o arquivo da chave pública para o acesso remoto:
mkdir -p /root/.ssh/
cat > /root/.ssh/authorized_keys << EOF
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEArgRS9p4JBq6CGuugYkf8PW7lejJpcJzDdjntND8wKhGUibkZRXcrxI40ClDEp7xLPzIzx6YSyV77AA16ers6AZs83FVSQY/sVO/qTXReyjHKJ1UhB3NQWsMI6XO+mcHFef50WLJ4rHd6b3A8swwF4XK4UtF8K6cDtJnJ1w4DmGwf3uAec0dUWF7UF4nP9VkTbH4bWETHPO7VXy5AcXx3rkzFF6+krtvrUHvC6QlzcUT0ofqb3mLBbWstaznE/lqXRFqHVwkkSLTy476qYM5286+UOTfTcwjsVCiohpoihPGWp4UE8ROKSmP8wLdYGHEJrB9k5FJGkZ5RjLhQ9ZIW9Dn/cgqFjOpvICe+26Zc7qaKTDp9vTCVkrZ94RV1e8gWlwbWcdNavuvpKcIxaNVmsxZ3RUiI5yewdGR3PCEbRkBiKq49E9cmitgbYWnn1jTQz9XXFSXL2MxRA4df6khmPZtKukvdjljt4jfbR40CZ5Q6VtJLO4yN7oYUWE+z3+YJtalT2VYO+L12phVAwjLlwn7JXijzXckBt6mCtTmQFCLBek/Y3EGdYpKnGLCfwvenpebxUOrhZFX8RJiHH8RQqUVv9LYtCdt88RdzAG15FlHufYQQHC+t2nZDrtW+XHpLBPgLFmbfDf03OIfIg/hxPwCDSPKqWgnpWJukdmuVze8= root@monitoramento
EOF
chmod 500 /root/.ssh/
chmod 0400 /root/.ssh/authorized_keys
Descrição Específica por Máquina
Asimov
- Fabricante: IBM
- Modelo: x3200 M2, 4368
Hardware
- Inserida a interface dual-port Intel Pro-1000T PCI-Express.
Firmware
- Atualizado o firmware de acordo com o pacote UpdateXpress System Pack obtido no site do fabricante.
Disco
- Configuração de RAID 1 (IM Volume) usando 2 discos SATA hot-swap de 250GB:
Resultando em 250GB de espaço disponível em disco:
BIOS
- Configuração na BIOS para iniciar o sistema via CD-ROM ou RAID 1:
- Configuração para sempre (re)iniciar o sistema após recuperação de energia:
Rede
- Todas as interfaces de rede em uma única agregação de enlace[1] (LAG) combinada a interfaces virtuais para acesso às VLANs do empilhamento RNP em modo trunking com LACP[2].
Instalação dos pacotes necessários:
aptitude install ifenslave vlan
cd /etc
git add network/interfaces
git commit -a -m "Configuração original das interfaces de rede."
vi network/interfaces
E configuração de VLAN sobre interface trunking:
auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto eth1 iface eth1 inet manual auto eth2 iface eth2 inet manual auto bond1 iface bond1 inet manual bond-slaves eth0 eth1 eth2 bond_mode 4 bond_miimon 100 bond_lacp_rate 1 bond_xmit_hash_policy layer2+3 auto vlan1 iface vlan1 inet static address 172.18.1.1 netmask 255.255.255.0 vlan-raw-device bond1 auto vlan110 iface vlan110 inet static address 172.18.110.1 netmask 255.255.255.0 vlan-raw-device bond1 auto vlan120 iface vlan120 inet static address 172.18.120.1 netmask 255.255.255.0 vlan-raw-device bond1 auto vlan200 iface vlan200 inet static address 172.18.200.1 netmask 255.255.255.0 vlan-raw-device bond1
e finalizando:
service networking restart
git commit -a -m "Interfaces Ethernet em LAG 1 e VLANs: 001 (default), 110 (lan_admin), 120 (lan_educ) e 200 (lan_midia)."
Serviços
- SSH: apenas via esquema de chaves públicas e privadas.
- TFTP: controle de versão dos arquivos de configuração dos switches e roteadores.
Clarke
- Fabricante: HP
- Modelo: Proliant DL360 G6
Firmware
- Atualizado o firmware de acordo com o pacote Smart Update Firmware DVD obtido no site do fabricante.
Disco
- Configuração de RAID 1+0 usando 2 discos SATA hot-swap de 250GB:
Resultando em 250GB de espaço disponível em disco.
BIOS
- Desativado o início (boot) pelas interfaces de rede:
- Configuração para sempre (re)iniciar o sistema após recuperação de energia:
Rede
- Configuração inicial para acessar via vSphere Client (IP e VLAN 1):
- Já no vSphere Cliente: confirmação da configuração anterior:
- Todas as interfaces de rede em uma única agregação de enlace (LAG) estática:
- Balanceamento de carga entre as interfaces da LAG estática baseada em IP (ao fundo, as interfaces do tipo Virtual Machine port group nomedadas e associadas a cada uma das VLANs):
NTP
- Ativação do cliente NTP:
- Automatização do serviço:
- Configuração do pool do NTP.br:
DNS
- Configuração do cliente DNS:
SSH + ESXi Shell
- Ativação do serviço SSH:
- No arquivo /etc/ssh/sshd_config, foram modificadas as seguintes linhas do modelo original:
UsePrivilegeSeparation no AuthorizedKeysFile /etc/ssh/keys-%u/authorized_keys
Como indicado acima, o arquivo com a chave pública está em /etc/ssh/keys-root/authorized_keys ao invés de /root/.ssh/authorized_keys.
- E, posteriormente, as funções do ESXi Shell:
vm-lan1
- Máquina virtual
- Este servidor foi instalado seguindo as configurações gerais definidas nos itens 2, 3 e 4 desta página.
Rede
Configurando o arquivo interfaces
Foram adicionados 5 interfaces virtuais nessa VM através do VSphere Client, sendo cada uma delas em uma Vlan diferente.
cd /etc
git add network/interfaces
git commit -a -m "Configuração original das interfaces de rede."
vim network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.18.1.101
netmask 255.255.192.0
gateway 172.18.0.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth1
iface eth1 inet static
address 172.18.110.1
netmask 255.255.255.0
gateway 172.18.110.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth2
iface eth2 inet static
address 172.18.120.1
netmask 255.255.254.0
gateway 172.18.121.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth3
iface eth3 inet static
address 172.18.199.1
netmask 255.255.255.0
gateway 172.18.199.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth4
iface eth4 inet static
address 172.18.200.1
netmask 255.255.255.0
gateway 172.18.200.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth5
iface eth5 inet static
address 172.18.109.1
netmask 255.255.255.0
gateway 172.18.109.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
Salvando a configuração
cd /etc
git add network/interfaces
git commit -a -m "Arquivo interface reconfigurado para usar as insterfaces virtuais do VMware."
Serviços
DHCP
Instalação do serviço DHCP
aptitude install isc-dhcp-server
cd /etc/
git add dhcp/dhcpd.conf
git commit -a -m "Configuração original do serviço DHCP"
vim dhcp/dhcpd.conf
Configuração do DHCP
#
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "sj.ifsc.edu.br";
option domain-name-servers 200.135.37.65, 200.135.37.72;
default-lease-time 7200;
max-lease-time 172800;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
failover peer "failover" {
primary;
address 172.18.109.1;
port 648;
peer address 172.18.109.2;
peer port 647;
max-response-delay 30;
max-unacked-updates 10;
load balance max seconds 3;
}
subnet 172.18.0.0 netmask 255.255.192.0 {
option routers 172.18.0.254;
option subnet-mask 255.255.192.0;
option broadcast-address 172.18.63.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.15.1 172.18.19.255;
}
}
subnet 172.18.110.0 netmask 255.255.255.0 {
option routers 172.18.110.254;
option subnet-mask 255.255.255.0;
option broadcast-address 172.18.110.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.110.3 172.18.110.240;
}
}
subnet 172.18.120.0 netmask 255.255.254.0 {
option routers 172.18.121.254;
option subnet-mask 255.255.254.0;
option broadcast-address 172.18.121.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.120.3 172.18.121.240;
default-lease-time 1800;
max-lease-time 3600;
}
}
subnet 172.18.199.0 netmask 255.255.255.0 {
option routers 172.18.199.254;
option subnet-mask 255.255.255.0;
option broadcast-address 172.18.199.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.199.3 172.18.199.240;
}
}
subnet 172.18.200.0 netmask 255.255.255.0 {
option routers 172.18.200.254;
option subnet-mask 255.255.255.0;
option broadcast-address 172.18.200.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.200.3 172.18.200.240;
}
}
Finalizando
service isc-dhcp-server restart
git commit -a -m "Configurado com failover, vm-lan2 primário e vm-lan1 secundário."
Backup
Cliente
Instalação do bacula-client
aptitude install bacula-client
cd /etc
git add bacula/bacula-fd.conf
git commit -a -m "Arquivo de configuração original bacula-fd."
vim bacula/bacula-fd.conf
Configuração do bacula-client
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = monitoramento-dir
Password = ""
}
#
# "Global" File daemon configuration specifications
#
FileDaemon { # this is me
Name = vm-lan2-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run/bacula
Maximum Concurrent Jobs = 20
FDAddress = 172.18.109.1
}
# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = monitoramento-dir = all, !skipped, !restored
}
Finalizando
service bacula-fd restart
git commit -a -m "Bacula fd configurado para receber acesso do monitoramento-dir."
Servidor
O servidor bacula atualmente é o monitoramento. Segue abaixo o que foi adicionado nos arquivos de configuração do servidor
bacula-dir.conf:
FileSet {
Name = "vm-basico"
Include {
Options {
Signature = MD5
compression = gzip
}
File = /etc
File = /root
File = /var/lib
File = /var/log
}
}
Client {
Name = vm-lan1-fd
Address = 172.18.109.1
FDPort = 9102
Catalog = MyCatalog
Password = ""
File Retention = 30 days
Job Retention = 2 months
AutoPrune = yes
}
Job {
Name = "vm-lan1-job"
JobDefs = "DefaultJob"
Client = vm-lan1-fd
FileSet = "vm-basico"
Write Bootstrap = "/var/lib/bacula/vm-lan1.bsr"
Priority = 12
}
E reiniciando o bacula-director
service bacula-director restart
Zabbix
Cliente
Instalação do Zabbix Agent:
apt-get install zabbix-agent
Configuração do Zabbix Agent
O arquivo de configuração:
/etc/zabbix/zabbix_agentd.conf
O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado). O hostname configurado deve ser o mesmo que o campo "Nome do host" no formulário de criação de novo host no Zabbix Server.
vm-lan2
- Máquina virtual
- Este servidor foi instalado seguindo as configurações gerais definidas nos itens 2, 3 e 4 desta página.
Rede
Configurando o arquivo interfaces
Foram adicionados 5 interfaces virtuais nessa VM através do VSphere Client, sendo cada uma delas em uma Vlan diferente.
cd /etc
git add network/interfaces
git commit -a -m "Configuração original das interfaces de rede."
vim network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.18.1.102
netmask 255.255.192.0
gateway 172.18.0.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth1
iface eth1 inet static
address 172.18.110.2
netmask 255.255.255.0
gateway 172.18.110.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth2
iface eth2 inet static
address 172.18.120.2
netmask 255.255.254.0
gateway 172.18.121.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth3
iface eth3 inet static
address 172.18.199.2
netmask 255.255.255.0
gateway 172.18.199.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth4
iface eth4 inet static
address 172.18.200.2
netmask 255.255.255.0
gateway 172.18.200.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
auto eth5
iface eth5 inet static
address 172.18.109.2
netmask 255.255.255.0
gateway 172.18.109.254
dns-nameservers 200.135.37.72 200.135.37.65
dns-search sj.ifsc.edu.br
Salvando a configuração
cd /etc
git add network/interfaces
git commit -a -m "Arquivo interface reconfigurado para usar as insterfaces virtuais do VMware."
Serviços
DHCP
Instalação do serviço DHCP
aptitude install isc-dhcp-server
cd /etc/
git add dhcp/dhcpd.conf
git commit -a -m "Configuração original do serviço DHCP"
vim dhcp/dhcpd.conf
Configuração do DHCP
#
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "sj.ifsc.edu.br";
option domain-name-servers 200.135.37.65, 200.135.37.72;
default-lease-time 7200;
max-lease-time 172800;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
failover peer "failover" {
primary;
address 172.18.109.2;
port 647;
peer address 172.18.109.1;
peer port 648;
max-response-delay 30;
max-unacked-updates 10;
load balance max seconds 3;
mclt 3600;
split 128;
}
subnet 172.18.0.0 netmask 255.255.192.0 {
option routers 172.18.0.254;
option subnet-mask 255.255.192.0;
option broadcast-address 172.18.63.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.15.1 172.18.19.255;
}
}
subnet 172.18.110.0 netmask 255.255.255.0 {
option routers 172.18.110.254;
option subnet-mask 255.255.255.0;
option broadcast-address 172.18.110.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.110.3 172.18.110.240;
}
}
subnet 172.18.120.0 netmask 255.255.254.0 {
option routers 172.18.121.254;
option subnet-mask 255.255.254.0;
option broadcast-address 172.18.121.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.120.3 172.18.121.240;
default-lease-time 1800;
max-lease-time 3600;
}
}
subnet 172.18.199.0 netmask 255.255.255.0 {
option routers 172.18.199.254;
option subnet-mask 255.255.255.0;
option broadcast-address 172.18.199.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.199.3 172.18.199.240;
}
}
subnet 172.18.200.0 netmask 255.255.255.0 {
option routers 172.18.200.254;
option subnet-mask 255.255.255.0;
option broadcast-address 172.18.200.255;
option netbios-name-servers 172.18.109.10;
pool{
failover peer "failover";
range 172.18.200.3 172.18.200.240;
}
}
Finalizando
service isc-dhcp-server restart
git commit -a -m "Configurado com failover, vm-lan2 primário e vm-lan1 secundário."
Backup
Cliente
Instalação do bacula-client
aptitude install bacula-client
cd /etc
git add bacula/bacula-fd.conf
git commit -a -m "Arquivo de configuração original bacula-fd."
vim bacula/bacula-fd.conf
Configuração do bacula-client
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = monitoramento-dir
Password = ""
}
#
# "Global" File daemon configuration specifications
#
FileDaemon { # this is me
Name = vm-lan3-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run/bacula
Maximum Concurrent Jobs = 20
FDAddress = 172.18.109.7
}
# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = monitoramento-dir = all, !skipped, !restored
}
Finalizando
service bacula-fd restart
git commit -a -m "Bacula fd configurado para receber acesso do monitoramento-dir."
Servidor
O servidor bacula atualmente é o monitoramento. Segue abaixo o que foi adicionado nos arquivos de configuração do servidor
bacula-dir.conf:
FileSet {
Name = "vm-basico"
Include {
Options {
Signature = MD5
compression = gzip
}
File = /etc
File = /root
File = /var/lib
File = /var/log
}
}
Client {
Name = vm-lan2-fd
Address = 172.18.109.2
FDPort = 9102
Catalog = MyCatalog
Password = ""
File Retention = 30 days
Job Retention = 2 months
AutoPrune = yes
}
Job {
Name = "vm-lan2-job"
JobDefs = "DefaultJob"
Client = vm-lan2-fd
FileSet = "vm-basico"
Write Bootstrap = "/var/lib/bacula/vm-lan2.bsr"
Priority = 12
}
E reiniciando o bacula-director
service bacula-director restart
Zabbix
Cliente
Instalação do Zabbix Agent:
apt-get install zabbix-agent
Configuração do Zabbix Agent
O arquivo de configuração:
/etc/zabbix/zabbix_agentd.conf
O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado). O hostname configurado deve ser o mesmo que o campo "Nome do host" no formulário de criação de novo host no Zabbix Server.
Zabbix
Cliente
Instalação do Zabbix Agent:
apt-get install zabbix-agent
Configuração do Zabbix Agent
O arquivo de configuração:
/etc/zabbix/zabbix_agentd.conf
O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado). O hostname configurado deve ser o mesmo que o campo "Nome do host" no formulário de criação de novo host no Zabbix Server.
vm-lan3
- Máquina virtual
- Este servidor foi instalado seguindo as configurações gerais definidas nos itens 2, 3 e 4 desta página.
Rede
Este servidor foi configurado com uma interface de rede simples pertencente a Vlan Servidores.
Serviços
Backup
Servidor
O servidor bacula atualmente é o monitoramento. Segue abaixo o que foi adicionado nos arquivos de configuração do servidor
bacula-dir.conf:
FileSet {
Name = "vm-basico-mysql"
Include {
Options {
Signature = MD5
compression = gzip
}
File = /etc
File = /root
File = /var/lib
File = /var/log
File = /backup
}
Exclude {
File = /var/lib/mysql
}
}
Client {
Name = vm-lan3-fd
Address = 172.18.109.7
FDPort = 9102
Catalog = MyCatalog
Password = ""
File Retention = 30 days
Job Retention = 2 months
AutoPrune = yes
}
Job {
Name = "vm-lan3-job"
JobDefs = "DefaultJob"
Client = vm-lan3-fd
FileSet = "vm-basico-mysql"
ClientRunBeforeJob = "/etc/bacula/scripts/mysqldump.sh"
Write Bootstrap = "/var/lib/bacula/vm-lan3.bsr"
Priority = 12
}
Cliente
Instalação do bacula-client
aptitude install bacula-client
cd /etc
git add bacula/bacula-fd.conf
git commit -a -m "Arquivo de configuração original bacula-fd."
vim bacula/bacula-fd.conf
Configuração do bacula-client
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = monitoramento-dir
Password = ""
}
#
# "Global" File daemon configuration specifications
#
FileDaemon { # this is me
Name = vm-lan3-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run/bacula
Maximum Concurrent Jobs = 20
FDAddress = 172.18.109.2
}
# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = monitoramento-dir = all, !skipped, !restored
}
Script
Na configuração do servidor foi adicionado a linha "ClientRunBeforeJob = "/etc/bacula/scripts/mysqldump.sh"" na definição do Client. Este script vai ser executado antes de iniciar o Job definido. A função desse script é fazer um dump de toda a base de dados Mysql que está no servidor. O script é o seguinte:
#!/bin/bash
#Apaga o dump anterior
rm -f /backup/mysqldump-vm-lan3*.tar.gz
#Faz o dump do todas as bases
mysqldump -uroot -p<senha do banco> --all-databases > /backup/mysqldump-vm-lan3-$(date +%d-%m-%y).sql
#Compacta o arquivo SQL do dump
tar -czf /backup/mysqldump-vm-lan3-$(date +%d-%m-%y).tar.gz /backup/mysqldump-vm-lan3*.sql
#Exclui o arquivo SQL sem compactação
rm -f /backup/mysqldump-vm-lan3*.sql
Finalizando
service bacula-fd restart
git commit -a -m "Bacula fd configurado para receber acesso do monitoramento-dir."
Instalação do Zabbix
Processo de instalação segundo a documentação oficial: https://www.zabbix.com/documentation/2.0/manual/installation/install_from_packages
Servidor
Configurando o repositório do Zabbix no Debian 7:
wget http://repo.zabbix.com/zabbix/2.0/debian/pool/main/z/zabbix-release/zabbix-release_2.0-1wheezy_all.deb
dpkg -i zabbix-release_2.0-1wheezy_all.deb
apt-get update
Instalação do Mysql:
Eu optei por instalar um servidor Mysql separado para o Zabbix.
apt-get install mysql-server
service mysql start
Instalação do Zabbix Server:
Durante o processo de instalação dos pacotes abaixo será necessário informar a senha de root do mysql. Com isso no próprio processo de instalação será criado um usuário zabbix e todo a base de dados para o Zabbix Server.
apt-get install zabbix-server-mysql zabbix-frontend-php
Cliente
Instalação do Zabbix Agent:
apt-get install zabbix-agent
Configuração do Zabbix Agent
O arquivo de configuração:
/etc/zabbix/zabbix_agentd.conf
O principal parâmetro para configurar é o "Server" (nome ou IP do Servidor Zabbix) e "Hostname" (nome do host que vai ser monitorado e que deve ser o mesmo nome adicionado no Zabbix Server).
Template App MySQL
Esse template monitora o banco de dados. Foi necessário adicionar um arquivo adicional com a seguinte configuração:
/etc/my.cnf
[client]
user = zabbix
password = <password>
port = 3306
[mysqld]
bind-address = 127.0.0.1
port = 3306
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
tmpdir = /tmp
user = mysql
symbolic-links = 0
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
pid-file = /var/run/mysqld/mysqld.pid
log-error = /var/log/mysqld.log
Referências