Junos management access
Rules for how people reach the device: SSH only, with strong settings, a warning before login, and idle sessions closed. They come from the junos-management-access policy template.
Every example on this page was checked with rConfig Pro's policy engine on Each of the 12 configs below was run through rConfig Pro’s evaluator with the rule above it, and gave the result shown. The configs are sanitised excerpts of the sample configs that come with the template. A card marked changed has one line edited to show a failure.
All the rules come from junos-management-access.policy in the policy templates (v1.5.0). Import the whole file with Import Templates (see importing a policy template), or copy one rule into your own definition. The Juniper Junos templates page lists the file’s known limitations. Run the rules against show configuration | display set.
| Rule | Method | Since |
|---|---|---|
| SSH on, version 1 off | evaluate_block |
8.3.0 |
| Strong SSH ciphers and MACs | evaluate_block |
8.3.0 |
| No Telnet | must_not_match_regex |
8.0.2 |
| Login banner | must_match_regex |
8.0.0 |
| Idle timeout | evaluate_block |
8.3.0 |
SSH on, version 1 off
SSH version 1 has known weaknesses. This rule needs a set system services ssh line, and fails if any protocol-version line still lists v1.
// SSH is enabled and SSH protocol version 1 is not (set system services ssh, no protocol-version v1)#[evaluate_block]all: - regex: '/^set system services ssh( |$)/m' - not: regex: '/^set system services ssh protocol-version .*\bv1\b/m'set system services ssh root-login denyset system services ssh protocol-version v2set system services ssh connection-limit 10set system services ssh rate-limit 5Why: SSH is on and only version 2 is allowed.
set system services ssh protocol-version [ v1 v2 ]set system services ssh connection-limit 10set system services ssh rate-limit 5Why: Version 1 is still allowed next to version 2.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| NIST SP 800-53 | AC-17 |
| HIPAA (45 CFR) | 164.312(a)(1) |
| ISO/IEC 27001:2022 Annex A | A.8.24 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.3.0 (evaluate_block). Editions: Pro, Vector, Enterprise.
Strong SSH ciphers and MACs
Old ciphers and hashes, such as CBC modes, 3DES, MD5 and SHA-1, can be broken. This rule needs a ciphers list and a macs list, and fails if either names a weak one.
// SSH ciphers and MACs are set, and none is CBC, 3DES, arcfour, blowfish, MD5, SHA-1 or RIPEMD-160 based#[evaluate_block]all: - regex: '/^set system services ssh ciphers /m' - regex: '/^set system services ssh macs /m' - not: regex: '/^set system services ssh ciphers .*(cbc|3des|arcfour|blowfish)/m' - not: regex: '/^set system services ssh macs .*\bhmac-(md5|sha1|ripemd160)\b/m'set system services ssh protocol-version v2set system services ssh ciphers [ aes256-ctr aes192-ctr aes128-ctr ]set system services ssh macs [ hmac-sha2-512 hmac-sha2-256 ]Why: Both lists name only strong options.
set system services ssh root-login denyset system services ssh protocol-version v2set system services ssh connection-limit 10set system services ssh rate-limit 5Why: There is no ciphers or macs list, so the device uses its defaults.
set system services ssh protocol-version v2set system services ssh ciphers [ aes256-ctr aes128-cbc ]set system services ssh macs [ hmac-sha2-512 hmac-sha2-256 ]Why: aes128-cbc is a CBC cipher.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config 1 | fail | FAIL |
| Failing config 2 | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| ISO/IEC 27001:2022 Annex A | A.8.24 |
Tested with: sample excerpts from Junos 23.2 (synthetic) and Junos 23.4 (synthetic). Minimum rConfig 8.3.0 (evaluate_block). Editions: Pro, Vector, Enterprise.
No Telnet
Telnet sends logins in clear text. This rule fails on a set system services telnet line.
// Telnet is not enabled (fails on set system services telnet)#[must_not_match_regex]/^set system services telnet( |$)/mset system services ssh root-login denyset system services ssh protocol-version v2set system services netconf sshWhy: Only SSH and NETCONF over SSH are on.
set system services ssh protocol-version [ v1 v2 ]set system services netconf sshset system services ftpset system services telnetWhy: Telnet is on.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| NIST SP 800-53 | AC-17 |
| HIPAA (45 CFR) | 164.312(a)(1) |
| ISO/IEC 27001:2022 Annex A | A.8.5 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.
Login banner
A login banner tells people the device is private and that use is monitored, before they log in. This rule only checks that a set system login message line is there, not what it says.
// A login banner is configured (set system login message)#[must_match_regex]/^set system login message .+/mset system login message "Authorised access only. All activity on this device is logged and monitored."set system login class noc-readonly idle-timeout 10Why: A login message is set.
set system login class noc-readonly permissions viewset system login class noc-readonly permissions view-configurationset system login user netops uid 2001set system login user netops class super-userWhy: There is no login message line.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| ISO/IEC 27001:2022 Annex A | A.8.5 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.
Idle timeout
A session left open is an open door. This rule needs at least one login class with an idle-timeout of 1 to 10 minutes, and fails if any class sets 0 or more than 10.
// A login class sets an idle-timeout of 1 to 10 minutes, and no class sets 0 or more than 10#[evaluate_block]all: - regex: '/^set system login class \S+ idle-timeout ([1-9]|10)$/m' - not: regex: '/^set system login class \S+ idle-timeout (0|1[1-9]|[2-9][0-9]|[0-9]{3,})$/m'set system login class noc-readonly idle-timeout 10set system login class noc-readonly permissions viewset system login class noc-readonly permissions view-configurationWhy: The noc-readonly class times out after 10 minutes.
set system login class noc-readonly permissions viewset system login class noc-readonly permissions view-configurationWhy: No login class sets an idle timeout.
set system login class noc-readonly idle-timeout 30set system login class noc-readonly permissions viewset system login class noc-readonly permissions view-configurationWhy: 30 minutes is longer than 10.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config 1 | fail | FAIL |
| Failing config 2 | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| ISO/IEC 27001:2022 Annex A | A.8.5 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.3.0 (evaluate_block). Editions: Pro, Vector, Enterprise.
Related reference
- Juniper Junos policy templates: every rule in
junos-management-access.policy, its references and known limitations. - Policy Definitions: the definition file format and every method.
- Policy Assignments: run a definition against your devices.
- Policy Compliance Results: read the pass and fail results.