Splitting lines in config files (OPEN)

Matthew Newton mcn at freeradius.org
Wed Aug 21 16:14:43 UTC 2024



On 21/08/2024 07:44, Per Weisteen wrote:
>          if ("%{TLS-Client-Cert-Issuer}" =~ /\/C=NO\/ST=Norway\/L=Oslo\/O=Telenor\ Norge\ AS\/OU=Internal\ Certificate\ Authority\/CN=Acme.*/) || ("%{TLS-Client-Cert-Issuer}" =~ /\/C=NO\/O=Telenor\ Norge\ AS\/CN=Telenor\ Norge\ Internal\ Issuing\ CA\ ECDSA\ TEST.*/) || ("%{TLS-Client-Cert-Issuer}" =~ /\/C=NO\/O=Telenor\ Norge\ AS\/OU=TEST\ ECDSA\/CN=TN\ Int\ 256\ Facilities\ CCTV\ ICA.*/) || ("%{TLS-Client-Cert-Issuer}" =~ /\/C=NO\/O=Telenor\ Norge\ AS\/CN=Telenor\ Norge\ Internal\ Issuing\ CA.*/) {
>                  update config {
>                          &Auth-Type := Accept
>                  }
> 
> I've tried to split the long if line into separate lines for each condition just to make it more readable but that doesn't seem to work.
> Is splitting this if statement over several lines supposed to work?

Yes, use backslash to continue, as is normal:

if (&User-Name == "alice" || \
     &User-Name == "bob" || \
     &User-Name == "charlie") {
         update reply {
                 &Reply-Message := "hello"
         }
}

-- 
Matthew


More information about the Freeradius-Users mailing list