SSH bei AlliedWare Plus™

Um bei AlliedWare Plus™-Switchen eine SSH-Server zu erstellen sind folgende Schritte nötigt:
1. Den Hostkey generieren

awplus>en
awplus#configure t
awplus(config)#crypto key generate hostkey rsa 4096

2. Die Version des SSH-Server festlegen. (Empfohlen wird Version 2)

awplus(config)#ssh server v2only

3. Die entsprechenden Benutzer berechtigen.

awplus(config)#ssh server allow-users manager

4. Den Dienst aktivieren.

awplus(config)#service ssh 
awplus(config)# exit
awplus#wr

Nach dem diese Befehle ausgeführt sind, steh nun ein SSH-Server bereit und man kann sich auf den Switch verbinden.

Mit folgendem Vorgang kann eine SSH-Verbindung ohne Passwort durchführen. Als erstes muss der Public-Key auf dem Client generiert werden.

gregor@firmware:~$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gregor/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/gregor/.ssh/id_rsa.
Your public key has been saved in /home/gregor/.ssh/id_rsa.pub.
The key fingerprint is:
61:2d:3a:09:aa:6b:ea:0a:4b:70:7c:38:b5:ab:dd:1d gregor@firmware
The key's randomart image is:
+---[RSA 4096]----+
|            .E   |
|           ..    |
|      .   .+.    |
|     . o + o= ...|
|      . S.=o ..o.|
|       ....o ..  |
|        o.. . .  |
|         +.  .   |
|          +o     |
+-----------------+
Sie haben neue Post in /var/mail/gregor.
gregor@firmware:~$ su
Passwort: 
root@firmware:/home/gregor# cp /home/gregor/.ssh/id_rsa.pub /srv/tftp/
root@firmware:/home/gregor# exit
exit
gregor@firmware:~$

Als nächster Schritt muss dem Switch noch der Public-Key bekannt gegeben werden, hier für werden folgende Befehle benötigt:

gregor@firmware:~$ ssh 172.16.10.9
#########################################
###             WARNUNG               ###
###                                   ###
###            Benutzung              ###
###            auf eigene             ###
###             GEFAHR                ###
###                                   ###
###       jegendliche Haftung         ###
###              wird                 ###
###            ABGELEHNT              ###
###                                   ###
###        Heinger Kabel AG           ###
###         Saegestrasse 65           ###
###            3098 Koeniz            ###
##########################################
Password: 
Last login: Fri Jun  2 13:23:43 CET 2017 from 172.16.10.250
No entry for terminal type "xterm-256color";
using vt100 terminal settings.

AlliedWare Plus (TM) 5.4.6 03/18/16 02:03:18

awplus>en
awplus#copy tftp://172.16.10.250/id_rsa.pub flash 
Enter destination file name[id_rsa.pub]:
Copying...
Successful operation
awplus#con t
Enter configuration commands, one per line.  End with CNTL/Z.
awplus(config)#crypto key pubkey-chain userkey gregor id_rsa.pub
awplus(config)#exit
awplus#exit
Connection to 172.16.10.9 closed.
gregor@firmware:~$ ssh 172.16.10.9
#########################################
###             WARNUNG               ###
###                                   ###
###            Benutzung              ###
###            auf eigene             ###
###             GEFAHR                ###
###                                   ###
###       jegendliche Haftung         ###
###              wird                 ###
###            ABGELEHNT              ###
###                                   ###
###        Heinger Kabel AG           ###
###         Saegestrasse 65           ###
###            3098 Koeniz            ###
##########################################
Last login: Fri Jun  2 13:28:03 CET 2017 from 172.16.10.250
No entry for terminal type "xterm-256color";
using vt100 terminal settings.

AlliedWare Plus (TM) 5.4.6 03/18/16 02:03:18

awplus>en
awplus#delete id_rsa.pub
Delete flash:/id_rsa.pub?  (y/n)[n]:y
Deleting...
Successful operation
awplus#wr
awplus#exit
Connection to 172.16.10.9 closed.
gregor@firmware:~$ 

Für eine Public-Key vom Switch zu einen Client/Server sind folgende Befehle auf dem Switch notwendig:

awplus>en
awplus#con t
awplus(config)#crypto key pubkey-chain knownhosts ip 172.16.10.250 rsa
172.16.10.250 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDo/t8Kq9AQ8XelcHvnbmWWtaZqQDSvSikjgYBgfVx7PRmJYnepVEV3oP1FkhmqWW0JJSZSUXxeXLVIVWVrprHbCJuMqM2tWMf1EXXDoWv/syIMLHfdUz4xCkNVOFmc9mxBKQIOofcelf4pbsotoy+p+kktEm6JK7/ndQ6VQktwSeWVLL90zyr6ZPwQxLgI0tB6Q++U+tGaZCHHZgycLbJXOw5vI4EzcCU14NmnF+cYIXPOdwSqd1Oso0BAAJdbcxb+zH/bMzJVwjyTAGVft5pD7HYNtIHQXwbMgMrIeYaMQki1k0A/W7mDRkKa4aPgdfgRbiuD9eKfgEp+w91QLnZX
Are you sure you want to add this public key (yes/no)? yes
awplus(config)#crypto key generate userkey gregor rsa
awplus(config)#exit
awplus#sh crypto key userkey gregor rsa
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDirETB9zYSTaq4hqOoLJfXpgDOmjosAuRbFTs4lT66cwrHCpiBQg2ko21IPuAJ+TXIaEo57d1RllAioNR607/HLzv+ylNMSmYaEFGNvvFkIepsNi6+7iVz0hQj67CMuhTJXtd6CRh3yFhT5HzzvNYRNRR5JyyZAnZ2e5BG3Oz/Tw=
= 
awplus#sh crypto key userkey gregor rsa > gregor-rsa.pub
awplus#copy gregor-rsa.pub tftp://172.16.10.250

Auf dem Client/Server müssen nun folgende Befehle durchgeführt werden:

gregor@firmware:~$ cat /srv/tftp/gregor-rsa.pub >> ~/.ssh/authorized_keys
gregor@firmware:~$ chmod 700 ~/.ssh
gregor@firmware:~$ chmod 600 ~/.ssh/authorized_keys

Danach kann man sich ohne Passwort am Client/Server anmelden, hier ein Beispiel:

awplus>en
awplus#ssh 172.16.10.250

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Fri Jun  2 11:29:23 2017 from 172.16.10.9
gregor@firmware:~$ ls /srv/tftp/
test_2.txt  test.txt  zd1200_9.10.0.0.218.img  zd1200_9.12.2.0.101.img
gregor@firmware:~$ exit
Abgemeldet
Connection to 172.16.10.250 closed.
awplus#
Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
  • allied_telesis/cli/ssh.txt
  • Zuletzt geändert: vor 13 Monaten