Junos services
Rules that turn off services a router or switch does not need. Every service that is on is something that can be attacked. They come from the junos-services policy template.
Every example on this page was checked with rConfig Pro's policy engine on Each of the 4 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.
All the rules come from junos-services.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 |
|---|---|---|
| No legacy services | must_not_match_regex |
8.0.2 |
| ICMP redirects off | must_match_single_string |
8.0.0 |
No legacy services
Finger, FTP, rlogin, rsh and rexec are old services that send data in clear text or leak information. This rule fails if any of them is turned on under set system services.
// No legacy service is enabled (fails on set system services finger, ftp, rlogin, rsh or rexec)#[must_not_match_regex]/^set system services (finger|ftp|rexec|rlogin|rsh)( |$)/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: FTP 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 | CM-7 |
| HIPAA (45 CFR) | 164.312(c)(1) |
| ISO/IEC 27001:2022 Annex A | A.8.9 |
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.
ICMP redirects off
An ICMP redirect tells a host to use a different gateway. An attacker can fake one to send traffic through their own machine. This rule needs the exact line set system no-redirects.
// ICMP redirects are disabled (set system no-redirects)#[must_match_single_string]set system no-redirectsset system host-name br-gwy-sw01set system domain-name example.netset system time-zone UTCset system no-redirectsWhy: Redirects are turned off.
set system host-name br-gwy-sw02set system domain-name example.netset system time-zone Europe/DublinWhy: There is no no-redirects line, so the device sends redirects.
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.20 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.0 (must_match_single_string). Editions: Pro, Vector, Enterprise.
Related reference
- Juniper Junos policy templates: every rule in
junos-services.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.