@@ -12,18 +12,26 @@ variable SSH_SCHEMA_VERSION ?= '5.3';
1212
1313include ' components/ssh/schema-' + SSH_SCHEMA_VERSION;
1414
15- type ssh_preferred_authentication = string with match (SELF, ' ^(gssapi-with-mic|hostbased|publickey' +
16- ' |keyboard-interactive|password)$' );
17-
15+ type ssh_preferred_authentication = choice(
16+ ' gssapi-with-mic' ,
17+ ' hostbased' ,
18+ ' keyboard-interactive' ,
19+ ' password' ,
20+ ' publickey'
21+ );
1822
1923type ssh_ciphers = string with is_valid_ssh_cipher(SELF);
20- type ssh_hostkeyalgorithms = string with match (SELF, " ^(ssh-(rsa|dss|ed25519)|ecdsa-sha2-nistp(256|384|521)" +
21- " (ssh-rsa-cert-v01|ssh-dss-cert-v01|ecdsa-sha2-nistp256-cert-v01|ecdsa-sha2-nistp384-cert-v01|" +
22- " |ecdsa-sha2-nistp521-cert-v01|ssh-rsa-cert-v00|ssh-dss-cert-v00|ssh-ed25519-cert-v01)@openssh.com)$" );
23- type ssh_kbdinteractivedevices = string with match (SELF, " ^(bsdauth|pam|skey)$" );
24- type ssh_kexalgorithms = string with match (SELF, " ^(diffie-hellman-group-exchange-sha256|" +
25- " ecdh-sha2-nistp(256|384|521)|[email protected] )$" )
; 24+
25+ type ssh_kexalgorithms = choice(
26+ ' diffie-hellman-group-exchange-sha256' ,
27+ ' ecdh-sha2-nistp256' ,
28+ ' ecdh-sha2-nistp384' ,
29+ ' ecdh-sha2-nistp521' ,
30+ 31+ );
32+
2633type ssh_MACs = string with is_valid_ssh_MAC(SELF);
34+
2735type ssh_gssapikexalgorithms = choice(
2836 ' gss-gex-sha1-' ,
2937 ' gss-group1-sha1-' ,
@@ -35,17 +43,32 @@ type ssh_gssapikexalgorithms = choice(
3543);
3644
3745function is_valid_ssh_MAC = {
38- match (ARGV[0], " ^(hmac-(sha2-256|sha2-512|ripemd160)|(hmac-ripemd160|umac-64|umac-128|hmac-sha2-256-etm" +
39- " |hmac-sha2-512-etm|hmac-ripemd160-etm|umac-64-etm|umac-128-etm)@openssh.com)$" );
46+ valid_options = list (
47+ ' hmac-ripemd160' ,
48+ 49+ 50+ ' hmac-sha2-256' ,
51+ 52+ ' hmac-sha2-512' ,
53+ 54+ 55+ 56+ 57+ 58+ );
59+ index (ARGV[0], valid_options) > = 0;
4060};
4161
4262function is_valid_ssh_cipher = {
43- match (ARGV[0], " ^((aes128|aes192|aes256)-ctr|(aes128-gcm|aes256-gcm|chacha20-poly1305)@openssh.com)$" );
44- };
45-
46- function is_valid_ssh_kexalgorithm = {
47- match (ARGV[0], " ^(diffie-hellman-group-exchange-sha256|ecdh-sha2-nistp(256|384|521)|" +
48- 63+ valid_options = list (
64+ ' aes128-ctr' ,
65+ ' aes192-ctr' ,
66+ ' aes256-ctr' ,
67+ 68+ 69+ 70+ );
71+ index (ARGV[0], valid_options) > = 0;
4972};
5073
5174type legacy_ssh_MACs = string with {
@@ -76,17 +99,17 @@ type legacy_ssh_kexalgorithm = string with {
7699};
77100
78101type ssh_core_options_type = {
79- " AddressFamily" ? string with match (SELF , ' ^(any| inet6?)$ ' )
102+ " AddressFamily" ? choice( ' any ' , ' inet ' , ' inet6' )
80103 " ChallengeResponseAuthentication" ? legacy_binary_affirmation_string
81104 " Ciphers" ? legacy_ssh_ciphers
82- " Compression" ? string with match (SELF , ' ^(yes| delayed|no)$ ' )
105+ " Compression" ? choice( ' yes ' , ' delayed' , ' no ' )
83106 " GSSAPIAuthentication" ? legacy_binary_affirmation_string
84107 " GSSAPICleanupCredentials" ? legacy_binary_affirmation_string
85108 " GSSAPIKexAlgorithms" ? ssh_gssapikexalgorithms[1..]
86109 " GSSAPIKeyExchange" ? legacy_binary_affirmation_string
87110 " GatewayPorts" ? legacy_binary_affirmation_string
88111 " HostbasedAuthentication" ? legacy_binary_affirmation_string
89- " LogLevel" ? string with match (SELF , ' ^(QUIET| FATAL| ERROR| INFO| VERBOSE|DEBUG[123]?)$ ' )
112+ " LogLevel" ? choice( ' QUIET ' , ' FATAL' , ' ERROR' , ' INFO' , ' VERBOSE' , ' DEBUG1 ' , ' DEBUG2 ' , ' DEBUG3 ' )
90113 " MACs" ? legacy_ssh_MACs
91114 " PasswordAuthentication" ? legacy_binary_affirmation_string
92115 " Protocol" ? string
@@ -150,7 +173,7 @@ type ssh_daemon_options_type = {
150173 };
151174 true;
152175 }
153- " PermitTunnel" ? string with match (SELF , ' ^(yes| point-to-point| ethernet|no)$ ' )
176+ " PermitTunnel" ? choice( ' yes ' , ' point-to-point' , ' ethernet' , ' no ' )
154177 " PermitUserEnvironment" ? legacy_binary_affirmation_string
155178 " PidFile" ? string
156179 " Port" ? long
@@ -168,7 +191,8 @@ type ssh_daemon_options_type = {
168191 " StrictModes" ? legacy_binary_affirmation_string
169192 " Subsystem" ? string
170193 " SyslogFacility" ? string with match (SELF,
171- ' ^(AUTH(PRIV)?|DAEMON|USER|KERN|UUCP|NEWS|MAIL|SYSLOG|LPR|FTP|CRON|LOCAL[0-7])$' )
194+ ' ^(AUTH(PRIV)?|DAEMON|USER|KERN|UUCP|NEWS|MAIL|SYSLOG|LPR|FTP|CRON|LOCAL[0-7])$'
195+ )
172196 " TcpRcvBuf" ? long
173197 " TcpRcvBufPoll" ? legacy_binary_affirmation_string
174198 " UseDNS" ? legacy_binary_affirmation_string
0 commit comments