mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add support for multiple include paths
This commit is contained in:
@ -79,6 +79,9 @@ Schema:
|
|||||||
],
|
],
|
||||||
"ignorerhosts": string,
|
"ignorerhosts": string,
|
||||||
"ignoreuserknownhosts": string,
|
"ignoreuserknownhosts": string,
|
||||||
|
"include": [
|
||||||
|
string
|
||||||
|
],
|
||||||
"ipqos": [
|
"ipqos": [
|
||||||
string
|
string
|
||||||
],
|
],
|
||||||
@ -528,6 +531,14 @@ def _process(proc_data: JSONDictType) -> JSONDictType:
|
|||||||
proc_data[key] = new_list
|
proc_data[key] = new_list
|
||||||
continue
|
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':
|
if key == 'maxstartups':
|
||||||
maxstart_split = val.split(':', maxsplit=2) # type: ignore
|
maxstart_split = val.split(':', maxsplit=2) # type: ignore
|
||||||
proc_data[key] = maxstart_split[0]
|
proc_data[key] = maxstart_split[0]
|
||||||
@ -596,7 +607,7 @@ def parse(
|
|||||||
|
|
||||||
raw_output: Dict = {}
|
raw_output: Dict = {}
|
||||||
|
|
||||||
multi_fields: Set[str] = {'acceptenv', 'hostkey', 'listenaddress', 'port'}
|
multi_fields: Set[str] = {'acceptenv', 'hostkey', 'include', 'listenaddress', 'port'}
|
||||||
|
|
||||||
modified_fields: Set[str] = {
|
modified_fields: Set[str] = {
|
||||||
'casignaturealgorithms', 'ciphers', 'hostbasedacceptedalgorithms',
|
'casignaturealgorithms', 'ciphers', 'hostbasedacceptedalgorithms',
|
||||||
|
3
tests/fixtures/generic/sshd_config
vendored
3
tests/fixtures/generic/sshd_config
vendored
@ -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 $
|
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $
|
||||||
|
|
||||||
# This is the sshd server system-wide configuration file. See
|
# This is the sshd server system-wide configuration file. See
|
||||||
|
2
tests/fixtures/generic/sshd_config.json
vendored
2
tests/fixtures/generic/sshd_config.json
vendored
@ -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"}
|
||||||
|
Reference in New Issue
Block a user