
"Ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQBfkD3juKaLXqNKJfhUMIwt4Ro / aF38WDi7XlALiSYDYY8GZuhcAMJHL0FKJRTI07QcrAttention! It is important not to make a mistake, otherwise Juniper will not accept the key! The key must be completely enclosed in quotes. At the end there should be a “=” sign, followed by a space, and then - root @ your_name_Juniper. I mean, exactly like the command line prompt of your device! Juniper's name, I remind you, is
Kfev4nFm2HbeSFkaI96l4TSKlqS90goemrbTkNTes / 2F9VBzRjogYcEfr57bgUQ + DVmnSMWiLeWwFwT79pctJR1dJZbSuQf2jgmrqPpTfJ235u + 8 + V4O2KPmIbrjHaWg9MZQcu2pdDfLBFaLgkgh9wPlToKtaCk0577DN6OImhOpL + xoyIOzg3JFlCwTNIYSvGX8sdnJaJkt0IOWf + KJrGQSXfc68Zw0hhakBojfotyFklGO390KxO
wVecS35kMuHjSRmhaGqf03yG1sQWt = root @ juniper "
set system host-name by the command set system host-name in configuration mode. If you later change this name, you will have to correct the key itself.root@juniper# set system root-authentication ssh-rsa _ ( -)If everything is done correctly, Juniper will write our key to his config.root@juniper# set system services ssh root-login deny-passwordWell, by itself:Now, to log in via SSH, we need to pre-specify our private key file in Putti in the section “Connection - SSH - Authentication”. At the entrance we will see something like this:root@juniper# commit checkroot@juniper# commit

host-inbound-traffic directive in the edit security zones section. Example: root @ juniper # show security zones security-zone untrust
screen untrust-screen;
interfaces {
fe-0/0 / 0.0 {
host-inbound-traffic {
system-services {
ping;
ssh;
}
}
} This directive regulates which protocols Juniper himself will be available for this zone / interface. For example, ssh, ping, https, https, dhcp, tftp, etc. If we specify the ssh protocol in the host-inbound-traffic system-services section, Juniper will listen for ssh requests on this zone / interface.root@juniper# edit firewall filter deny-ssh(entered filter edit mode)root@juniper# set term 1 from source-address 0/0(we indicate a match with any source address ...)root@juniper# set term 1 from source-address 192.168.10.10 except(... except for the one we need)(we prohibit access via ssh. Discard - means silently killing the package. You can write reject - this is also a ban, but with icmp port unreachable sent. Log - means logging unsuccessful attempts to bang on ssh. In principle, you can not write).root@juniper# set term 1 from destination-port sshroot@juniper# set term 1 then log discard
root@juniper# set term 2 then accept(Do not forget to allow everything else, otherwise it will be very bad for both us and the router)root@juniper# set interfaces lo0 unit 0 family inet filter input deny-sshThe above method is quite tough and requires careful use , because regulates access via ssh to Juniper from ANY INTERFACES. If we do not need such a serious security level, then the same filter can be applied to the local network interface in the same way. Only in this case it is necessary to take into account that the lokalki interface is transit by definition, and therefore you need to add Juniper's destination-address filter to the rules, otherwise the ssh protocol on the network will not work as a whole in a magical way. For a loopback interface, you do not need to specify destination-address , since it is not transit.source-address . You can specify some specific subnets and even interfaces. In other words, you can configure access very flexibly.Source: https://habr.com/ru/post/173031/
All Articles