Skip to content
Guides & References

Junos management access

Worked examples for the Juniper Junos management access template: SSH without version 1, strong ciphers and MACs, no Telnet, a login banner and idle timeouts.

Policy LibraryUpdated
Platform
juniper-junos
Minimum version
rConfig 8.3.0
Editions
Pro, Vector, Enterprise
On this page

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.

Definition
// 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'
passPassing config: Hardened EX2300 sample (Junos 23.2, synthetic)
set system services ssh root-login deny
set system services ssh protocol-version v2
set system services ssh connection-limit 10
set system services ssh rate-limit 5

Why: SSH is on and only version 2 is allowed.

failFailing config: Unhardened EX2300 sample (Junos 15.1, synthetic)
set system services ssh protocol-version [ v1 v2 ]
set system services ssh connection-limit 10
set system services ssh rate-limit 5

Why: Version 1 is still allowed next to version 2.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

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.

Definition
// 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'
passPassing config: Hardened EX2300 sample (Junos 23.2, synthetic)
set system services ssh protocol-version v2
set 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.

failFailing config: MX204 sample (Junos 23.4, synthetic)
set system services ssh root-login deny
set system services ssh protocol-version v2
set system services ssh connection-limit 10
set system services ssh rate-limit 5

Why: There is no ciphers or macs list, so the device uses its defaults.

failFailing config: Hardened EX2300 sample (Junos 23.2, synthetic), changed: aes128-cbc added to the cipher list
set system services ssh protocol-version v2
set 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:

ConfigRule resultOverall result
Passing configpassPASS
Failing config 1failFAIL
Failing config 2failFAIL

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.

Definition
// Telnet is not enabled (fails on set system services telnet)
#[must_not_match_regex]
/^set system services telnet( |$)/m
passPassing config: Hardened EX2300 sample (Junos 23.2, synthetic)
set system services ssh root-login deny
set system services ssh protocol-version v2
set system services netconf ssh

Why: Only SSH and NETCONF over SSH are on.

failFailing config: Unhardened EX2300 sample (Junos 15.1, synthetic)
set system services ssh protocol-version [ v1 v2 ]
set system services netconf ssh
set system services ftp
set system services telnet

Why: Telnet is on.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

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.

Definition
// A login banner is configured (set system login message)
#[must_match_regex]
/^set system login message .+/m
passPassing config: Hardened EX2300 sample (Junos 23.2, synthetic)
set system login message "Authorised access only. All activity on this device is logged and monitored."
set system login class noc-readonly idle-timeout 10

Why: A login message is set.

failFailing config: Unhardened EX2300 sample (Junos 15.1, synthetic)
set system login class noc-readonly permissions view
set system login class noc-readonly permissions view-configuration
set system login user netops uid 2001
set system login user netops class super-user

Why: There is no login message line.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

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.

Definition
// 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'
passPassing config: Hardened EX2300 sample (Junos 23.2, synthetic)
set system login class noc-readonly idle-timeout 10
set system login class noc-readonly permissions view
set system login class noc-readonly permissions view-configuration

Why: The noc-readonly class times out after 10 minutes.

failFailing config: Unhardened EX2300 sample (Junos 15.1, synthetic)
set system login class noc-readonly permissions view
set system login class noc-readonly permissions view-configuration

Why: No login class sets an idle timeout.

failFailing config: Hardened EX2300 sample (Junos 23.2, synthetic), changed: idle-timeout 30 instead of 10
set system login class noc-readonly idle-timeout 30
set system login class noc-readonly permissions view
set system login class noc-readonly permissions view-configuration

Why: 30 minutes is longer than 10.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing config 1failFAIL
Failing config 2failFAIL

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.


Type to search.