diff --git a/jc/parsers/sshd_conf.py b/jc/parsers/sshd_conf.py index a4f56b15..8813d4f8 100644 --- a/jc/parsers/sshd_conf.py +++ b/jc/parsers/sshd_conf.py @@ -79,6 +79,9 @@ Schema: ], "ignorerhosts": string, "ignoreuserknownhosts": string, + "include": [ + string + ], "ipqos": [ string ], @@ -528,6 +531,14 @@ def _process(proc_data: JSONDictType) -> JSONDictType: proc_data[key] = new_list continue + # this is a list value + if key == 'include': + new_list = [] + for item in val: # type: ignore + new_list.extend(item.split()) + proc_data[key] = new_list + continue + if key == 'maxstartups': maxstart_split = val.split(':', maxsplit=2) # type: ignore proc_data[key] = maxstart_split[0] @@ -596,7 +607,7 @@ def parse( raw_output: Dict = {} - multi_fields: Set[str] = {'acceptenv', 'hostkey', 'listenaddress', 'port'} + multi_fields: Set[str] = {'acceptenv', 'hostkey', 'include', 'listenaddress', 'port'} modified_fields: Set[str] = { 'casignaturealgorithms', 'ciphers', 'hostbasedacceptedalgorithms', diff --git a/tests/fixtures/generic/sshd_config b/tests/fixtures/generic/sshd_config index 8b5d729a..32e73fa9 100644 --- a/tests/fixtures/generic/sshd_config +++ b/tests/fixtures/generic/sshd_config @@ -1,3 +1,6 @@ +Include foo/bar foo/baz +Include foo/buz + # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $ # This is the sshd server system-wide configuration file. See diff --git a/tests/fixtures/generic/sshd_config.json b/tests/fixtures/generic/sshd_config.json index 21c1e832..29cad7d7 100644 --- a/tests/fixtures/generic/sshd_config.json +++ b/tests/fixtures/generic/sshd_config.json @@ -1 +1 @@ -{"port":[22],"addressfamily":"any","listenaddress":["0.0.0.0","::"],"hostkey":["/etc/ssh/ssh_host_rsa_key","/etc/ssh/ssh_host_ecdsa_key","/etc/ssh/ssh_host_ed25519_key"],"syslogfacility":"AUTHPRIV","authorizedkeysfile":[".ssh/authorized_keys"],"passwordauthentication":"yes","challengeresponseauthentication":"no","gssapiauthentication":"yes","gssapicleanupcredentials":"no","usepam":"yes","x11forwarding":"yes","acceptenv":["LANG","LC_CTYPE","LC_NUMERIC","LC_TIME","LC_COLLATE","LC_MONETARY","LC_MESSAGES","LC_PAPER","LC_NAME","LC_ADDRESS","LC_TELEPHONE","LC_MEASUREMENT","LC_IDENTIFICATION","LC_ALL","LANGUAGE","XMODIFIERS"],"subsystem":"sftp","subsystem_command":"/usr/libexec/openssh/sftp-server"} +{"include":["foo/bar","foo/baz","foo/buz"],"port":[22],"addressfamily":"any","listenaddress":["0.0.0.0","::"],"hostkey":["/etc/ssh/ssh_host_rsa_key","/etc/ssh/ssh_host_ecdsa_key","/etc/ssh/ssh_host_ed25519_key"],"syslogfacility":"AUTHPRIV","authorizedkeysfile":[".ssh/authorized_keys"],"passwordauthentication":"yes","challengeresponseauthentication":"no","gssapiauthentication":"yes","gssapicleanupcredentials":"no","usepam":"yes","x11forwarding":"yes","acceptenv":["LANG","LC_CTYPE","LC_NUMERIC","LC_TIME","LC_COLLATE","LC_MONETARY","LC_MESSAGES","LC_PAPER","LC_NAME","LC_ADDRESS","LC_TELEPHONE","LC_MEASUREMENT","LC_IDENTIFICATION","LC_ALL","LANGUAGE","XMODIFIERS"],"subsystem":"sftp","subsystem_command":"/usr/libexec/openssh/sftp-server"}