Skip to content

Commit

Permalink
Merge pull request #12251 from vojtapolasek/sshd_lineinfile_variables
Browse files Browse the repository at this point in the history
Add support for XCCDF variables into sshd_lineinfile template
  • Loading branch information
jan-cerny authored Aug 9, 2024
2 parents 05e8617 + b7b820d commit 94ae023
Show file tree
Hide file tree
Showing 60 changed files with 240 additions and 274 deletions.
8 changes: 8 additions & 0 deletions docs/templates/template_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,14 @@ When the remediation is applied duplicate occurrences of `key` are removed.

- **value** - value of the SSH configuration option specified by
**parameter**, eg. `"no"`.
This cannot be specified together with the **xccdf_variable** parameter.

- **xccdf_variable** - specifies an XCCDF variable to use as a value for the specified **parameter**.
This parameter conflicts with the **value** parameter.

- **datatype** - specifies the datatype of the **value** or **xccdf_variable**.
Possible options are **int** or **string**.
The datatype is utilized for creation of correct templated test scenarios.

- **missing_parameter_pass** - effective only in OVAL checks, if
set to `"false"` and the parameter is not present in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ template:
name: sshd_lineinfile
vars:
parameter: HostbasedAuthentication
rule_id: disable_host_auth
value: 'no'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ template:
name: sshd_lineinfile
vars:
parameter: PermitEmptyPasswords
rule_id: sshd_disable_empty_passwords
value: 'no'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ template:
name: sshd_lineinfile
vars:
parameter: GSSAPIAuthentication
rule_id: sshd_disable_gssapi_auth
value: 'no'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ template:
name: sshd_lineinfile
vars:
parameter: KerberosAuthentication
rule_id: sshd_disable_kerb_auth
value: 'no'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ template:
name: sshd_lineinfile
vars:
parameter: PubkeyAuthentication
rule_id: sshd_disable_pubkey_auth
value: 'no'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ template:
name: sshd_lineinfile
vars:
parameter: IgnoreRhosts
rule_id: sshd_disable_rhosts
value: 'yes'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ template:
name: sshd_lineinfile
vars:
parameter: PermitRootLogin
rule_id: sshd_disable_root_login
value: 'no'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ template:
name: sshd_lineinfile
vars:
parameter: PermitRootLogin
rule_id: sshd_disable_root_password_login
value: 'prohibit-password'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ template:
name: sshd_lineinfile
vars:
parameter: AllowTcpForwarding
rule_id: sshd_disable_tcp_forwarding
value: 'no'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ template:
name: sshd_lineinfile
vars:
parameter: IgnoreUserKnownHosts
rule_id: sshd_disable_user_known_hosts
value: 'yes'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ template:
name: sshd_lineinfile
vars:
parameter: X11Forwarding
rule_id: sshd_disable_x11_forwarding
value: 'no'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ template:
name: sshd_lineinfile
vars:
parameter: PermitUserEnvironment
rule_id: sshd_do_not_permit_user_env
value: 'no'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ template:
name: sshd_lineinfile
vars:
parameter: GSSAPIAuthentication
rule_id: sshd_enable_gssapi_auth
value: 'yes'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ template:
name: sshd_lineinfile
vars:
parameter: UsePAM
rule_id: sshd_enable_pam
value: 'yes'
datatype: string

fixtext: |-
{{{ fixtext_sshd_lineinfile('UsePAM', 'yes') }}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ template:
name: sshd_lineinfile
vars:
parameter: PubkeyAuthentication
rule_id: sshd_enable_pubkey_auth
value: 'yes'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ template:
name: sshd_lineinfile
vars:
parameter: StrictModes
rule_id: sshd_enable_strictmodes
value: 'yes'
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ template:
name: sshd_lineinfile
vars:
parameter: Banner
rule_id: sshd_enable_warning_banner
value: /etc/issue
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ template:
name: sshd_lineinfile
vars:
parameter: Banner
rule_id: sshd_enable_warning_banner_net
value: /etc/issue.net
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ template:
name: sshd_lineinfile
vars:
parameter: X11Forwarding
rule_id: sshd_enable_x11_forwarding
value: 'yes'
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ template:
name: sshd_lineinfile
vars:
parameter: PrintLastLog
rule_id: sshd_print_last_log
value: 'yes'
datatype: string
is_default_value: 'true'

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,10 @@ ocil: |-
functionality completely.
If the option is set to a number greater than <tt>0</tt>, then the session will be disconnected after
<tt>ClientAliveInterval * ClientAliveCountMax</tt> seconds without receiving a keep alive message.
template:
name: sshd_lineinfile
vars:
parameter: ClientAliveCountMax
xccdf_variable: var_sshd_set_keepalive
datatype: int

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ template:
vars:
parameter: "ClientAliveCountMax"
value: "0"
datatype: int
backends:
kubernetes: "off"
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ template:
name: sshd_lineinfile
vars:
parameter: LogLevel
rule_id: sshd_set_loglevel_info
value: INFO
datatype: string
is_default_value: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ template:
name: sshd_lineinfile
vars:
parameter: LogLevel
rule_id: sshd_set_loglevel_verbose
value: VERBOSE
datatype: string
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ template:
path: '/etc/sysconfig/sshd'
parameter: 'SSH_USE_STRONG_RNG'
value: '32'
datatype: int
no_quotes: 'true'
Loading

0 comments on commit 94ae023

Please sign in to comment.