quinta-feira, novembro 18, 2010

Configuração SSH Firewall H3C SECPATH F1000-S

Introdução


A firewall SECPATH funciona como um servidor SSH 1.5 e 2.0 e como um cliente SSH 2.0. Por motivos de segurança exige-se utilizar, tanto para o servidor como para o cliente, a versão 2.0.

Existem duas formas de autenticação:
  • Autenticação por senha.
  • Autenticação por chave RSA.

Por padrão, o IP de origem de cada pacote enviado pelo Servidor SSH é o IP da interface por onde o pacote saiu (ou foi originado).

Configurações do Servidor SSH


1) Criar as chaves públicas e privadas da firewall.

[H3C] rsa local-key-pair-create

2) Habilitar o protocolo SSH nas interfaces VTY

[H3C] user-interface vty 0 4
[H3C-ui-vty0-4] authentication-mode scheme
[H3C-ui-vty0-4] protocol inbound ssh
[H3C-ui-vty0-4] quit

3) Habilitar o SSH como serviço de login de um usuário

[H3C] local-user joao
[H3C-luser-joao] password simple <my-secret>
[H3C-luser-joao] service-type ssh
[H3C-luser-joao] quit
[H3C] ssh user joao authentication-type password

4) A forma padrão de autenticação será password

[H3C] ssh authentication-type default password

5) O tempo de espera durante a autenticação será de 40 segundos

[H3C] ssh server timeout 40

6) O número de tentativas de login será de 2 vezes.

[H3C] ssh server authentication-retries 2

7) O tempo de renovação da chave do servidor (utilizada na negociação) é de 1 hora

[H3C] ssh server rekey-interval 1

8) Desabilitar a compatibilidade com clientes versão 1.5

[H3C] undo ssh server compatible-ssh1x

Utilizando o Cliente SSH


Antes de utilizar o cliente SSH é necessário estabelecer o parâmetro:

[H3C] ssh client first-time enable

Este parâmetro permite que o cliente procure ter acesso ao servidor e obter a chave pública através de negociação. Essa chave será armazenada na firewall para utilização em outros acessos SSH.

Para conectar-se em um servidor SSH ativo no IP 200.14.64.24 e na porta 4788 é necessário utilizar o comando:

[H3C] ssh2 200.14.64.24 4788

No arquivo de configuração aparecerá a chave pública do servidor contactado pelo cliente.

Modelo de configurações


#
 rsa peer-public-key 200.14.64.14
  public-key-code begin                   
      [ ... chave omitida ... ]               
  public-key-code end                     
 peer-public-key end                      
#
 rsa peer-public-key 200.14.64.24
  public-key-code begin
      [ ... chave omitida ... ]
  public-key-code end
 peer-public-key end
#                                
local-user joao                       
 password cipher <a-secret> 
 service-type ssh                         
 level 3                                            
#
 ssh authentication-type default password
 ssh server timeout 40                    
 ssh server authentication-retries 2
 ssh server rekey-interval 1
 undo ssh server compatible-ssh1x
 ssh client 200.14.64.14 assign rsa-key 200.14.64.14
 ssh client 200.14.64.24 assign rsa-key 200.14.64.24
#
user-interface con 0
user-interface aux 0
user-interface vty 0 4
 authentication-mode scheme
 protocol inbound ssh
#

segunda-feira, novembro 15, 2010

Configurações e Comandos Cisco

Comandos para diagnóstico geral
Switch# show running-config
Switch# show startup-config
Switch# show version
Switch# dir flash:
Switch# show flash

Comandos para diagnóstico de interface

Switch# show interface fastethernet 0/4

Comandos para diagnóstico de VLANs

Switch# show interface vlan 1
Switch# show ip interface vlan 1
Switch# show vlan
Switch# show vlan id 2
Switch# show vlan name VLAN2

Comandos para diagnóstico de tabela CAM (mac-address)

Switch# show mac-address-table

Comandos para diagnóstico de características da interface

Switch# show port-security

Comandos para diagnóstico de STP

Switch# show spanning-tree brief

Comandos para configurações gerais de um switch

Switch# copy running-config startup-config
Switch# hostname Meu-Cisco
Switch# clear mac-address-table dynamic

Tarefa - Excluir todas as configurações de um switch e colocá-lo nos padrões de fábrica

Switch# erase startup-config
Switch# delete flash:vlan.dat
Switch# reload

Tarefa - Configurar Usuário e Senha na Console e para Acesso Telnet

Switch(config)# line console 0
Switch(config-line)# password cisco
Switch(config-line)# login

Switch(config)# line vty 0 15
Switch(config-line)# password cisco
Switch(config-line)# login

Tarefa - Configurar senhas para acesso ao modo privilegiado

Switch(config)# enable password cisco
Switch(config)# enable secret cisco

Tarefa - Configurar parâmetros de uma porta ethernet de swich

Switch(config)# interface gigabitethernet 0/5
Switch(config-if)# speed 100
Switch(config-if)# duplex full

Tarefa - Configurar Acesso Camada 3 do Switch através da VLAN 1

Switch(config)# interface vlan 1
Switch(config-if)# ip address 192.168.1.2 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# ip default-gateway 192.168.1.1

Tarefa - Configurar um endereço MAC estático

Switch(config)# mac-address-table static 00e0.2917.1884 vlan 1 interface fastethernet 0/4

Tarefa - Configurar aprendizagem fixa de endereços MAC (sticky)

Switch# configure terminal
Switch(config)# interface fastethernet 0/4
Switch(config-if)# switchport mode access
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security mac-address sticky
Switch(config-if)# switchport port-security maximum 1
Switch(config-if)# switchport port-security violation shutdown
Switch(config-if)# exit

Tarefa - Criar vlans em um Switch

Switch# vlan database
Switch(vlan)# vlan 2 name VLAN2
Switch(vlan)# vlan 3 name VLAN3
Switch(vlan)# exit

Tarefa - Excluir VLANs configuradas em um switch

Switch# vlan database
Switch(vlan)# no vlan 2
Switch(vlan)# exit

Atenção: a VLAN 1 (default) não pode ser excluída.

Tarefa - Alocar portas de um switch em uma determinada VLAN

Switch# configure terminal
Switch(config)# interface fastethernet 0/2
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 2
Switch(config-if)# end

Tarefa - Configurar um enlace trunk entre dois switches 2960 (encapsulamento 802.1Q padrão)

Switch_A# configure terminal
Switch_A(config)# interface fastethernet 0/1
Switch_A(config-if)# switchport mode trunk
Switch_A(config-if)# exit

Switch_B# configure terminal
Switch_B(config)# interface fastethernet 0/1
Switch_B(config-if)# switchport mode trunk
Switch_B(config-if)# exit

Caso seja necessário configurar o tipo de encapsulamento utilizar o comando:

Switch(config-if)# switchport trunk encapsulation dot1q

Tarefa - Configurar um switch no modo VTP SERVER

Switch# vlan database
Switch(vlan)# vtp server
Switch(vlan)# vtp domain group1
Switch(vlan)# exit

Tarefa - Configurar um switch no modo VTP CLIENT

Switch# vlan database
Switch(vlan)# vtp client
Switch(vlan)# vtp domain group1
Switch(vlan)# exit

Tarefa - Redefinindo o root bridge

Switch# configure terminal
Switch(config)# spanning-tree priority 1
ou
Switch(config)# spanning-tree vlan 1 priority 4096