Switches

From Hobbynet Admin Wiki
Revision as of 10:53, 30 October 2020 by 2a05:f080:0:300:c832:5b8a:9bb3:a4ae (talk) (→‎basis switch configuratie)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

basis switch configuratie

uitschakelen macro's

Marco's zij heel irritant die wille je helpen de switch automatische te configuren, en jouw config dan overullen ik dacht het niet. met volgende commando in config mode:

  macro auto disabled

uitschakelen green ethernet

  no eee enable

schakel bojour uit

  no bonjour enable
  no bonjour interface range vlan

activeer ssh

ip ssh server ip ssh password-auth ip ssh pubkey-auth auto-login

inlezen ssh-key's

snmp

  snmp-server server
  snmp-server location "Rack 14.3 BIT-2a"
  snmp-server contact beheer@hobby.nl
  snmp-server community hobbynet-ro ro 172.31.1.6 view Default
  snmp-server community hobbynet-ro ro 2a02:968:ffff:999:172:31:1:6 view Default

certificaten

Dit is de juiste procedure om certificaten aan maken

aanmaken met openssl

san.cnf

Om te zorgen dat je het cerificaat goed kan aanmaken, moet je zorgen dat je alt subjects goed hebt staan, daar voor config file nodig ie er zo uit ziet:

  [ req ]
  default_bits       = 2048
  distinguished_name = req_distinguished_name
  req_extensions     = req_ext
  [ req_distinguished_name ]
  countryName                 = NL
  stateOrProvinceName         = Noord-Holland
  localityName               = Haarlem
  organizationName           = HCC
  commonName                 = Common Name (e.g. server FQDN or YOUR name)
  [ req_ext ]
  subjectAltName = @alt_names
  [alt_names]
  DNS.1   = cisco-sw-st-02.hobby.nl
  DNS.2   = cisco-sw-st-02.network.hobby.nl
  IP.1    = 172.31.1.114
  IP.2    = 2a02:968:ffff:999:172:31:1:114
  IP.3    = 192.168.200.156
  IP.4    = 192.168.200.157

Bij dns naam vul nog keer de aanvraag dns naam in, en je vult eventuele aliassen in, ook voeg je ip addressen toe, hier staan 2 192.168.200.* adressen in omdat ze bij mijn thuis geconfigureerd zijn en zo had ik geen last van foutmeldingen. Vergeet het IPv6 adres niet!

maak het certificaat request

De key mag maximaal 2048 zijn

  bas@pc-bas:/mnt/c/Users/bas/certs$ openssl req -out cisco-sw-st-02.csr -new -newkey rsa:2048 -sha256 -nodes -keyout cisco-sw-st-02.key -config ./san.cnf
  Generating a RSA private key
  ......................................................++++
  ..........................................................................................................................................++++
  writing new private key to 'cisco-sw-st-02.key'
  -----
  You are about to be asked to enter information that will be incorporated
  into your certificate request.
  What you are about to enter is what is called a Distinguished Name or a DN.
  There are quite a few fields but you can leave some blank
  For some fields there will be a default value,
  If you enter '.', the field will be left blank.
  -----
  NL []:
  Noord-Holland []:
  Haarlem []:
  HCC []:
  Common Name (e.g. server FQDN or YOUR name) []:cisco-sw-st-02.network.hobby.nl

Voltooi de aanvraag via windows ad http://ad1.ad.hobby.nl/certsrv (ja http)
Request a certificate --> advanced certificate request
kies bij template webserver
paste de inhoud van csr file (certificate request)
klik op submint
zet rondje op Base 64 encoded
en klik op download certficate
zet gedownload bestand bij de andere cerificate files bij voorkeur met zelfde naam en extentie cer

zet de private key om naar RSA private key

  openssl rsa -in cisco-sw-st-02.key -outform pem >cisco-sw-st-02.rsakey

zet het certificaat om in public RSA keys

  openssl x509 -pubkey -noout -in ./cisco-sw-st-02.cer  >./cisco-sw-st-02.pubkey

Nu moeten we nog wat gaan versleutelen aan de public key hier moet de eerste 32 tekens weg meestal is dat:

  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A

Daarnaast de opening header worden aangepast
van:

  -----BEGIN PUBLIC KEY-----

naar:

  -----BEGIN RSA PUBLIC KEY-----

en van:

  -----END PUBLIC KEY-----

naar:

  -----END RSA PUBLIC KEY-----

bestanden samen voegen en importeren

met het volgende cat commando krijg je alle bestanden in goede volgorde als output op je scherm:

  cat cisco-sw-st-02.rsakey cisco-sw-st-02.pubkey cisco-sw-st-02.cer

Deze output moet later pasten in de switch Je kan certificaat op postie 1 of 2 opslaan je kan bestaande niet overschrijven, default is in 1 in gebruik bij switch met fact defaults.
login op de switch en ga naar config prompt en geef volgende commando:

  cisco-sw-st-02#conf t
  cisco-sw-st-02(config)#crypto certificate 2 import

plak nu de inhoud van de cat
als goed is gegaan krijg je hier na het volgende resultaat:

.
Certificate imported successfully
 Issued by : DC=nl, DC=hobby, DC=ad, CN=ad-AD1-CA
 Valid From: Oct 26 18:00:45 2020 GMT
 Valid to: Oct 26 18:00:45 2022 GMT
 Subject: CN=cisco-sw-st-02.network.hobby.nl
 SHA Fingerprint: AC12A474 585D6E34 AB1576B4 69A4EBDD 4FF01089

activeer certificaat

  • login op webinterface nu nog met http
  • zet rechts boven in display mode op advanced
  • ga naar security --> ssl server --> SSL Server Authentication Settings
  • Selecteer het goede certificaat en klik op apply (nr dat je bij import hebt gebruikt