#7490 installutils.set_directive doesn't handle debian ssl.conf properly
Closed: fixed 5 years ago Opened 6 years ago by tjaalton.

The debian site config for ssl has this snippet:

            #   A self-signed (snakeoil) certificate can be created by installing
            #   the ssl-cert package. See
            #   /usr/share/doc/apache2/README.Debian.gz for more info.
            #   If both key and certificate are stored in the same file, only the
            #   SSLCertificateFile directive is needed.
            SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
            SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

set_directive makes it into this:

            #   If both key and certificate are stored in the same file, only the
            SSLCertificateFile /var/lib/ipa/certs/httpd.crt
            SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
            SSLCertificateKeyFile /var/lib/ipa/private/httpd.key

which breaks the config.


Metadata Update from @rcritten:
- Issue assigned to rcritten

6 years ago

I haven't been able to replicate this with a simple unit test:

from ipaserver.install import installutils

installutils.set_directive('test.conf',
                           'SSLCertificateFile',
                           '/somewhere/kewl', False)

It produces the expected output with just one SSLCertificateFile

I can duplicate it using the whole file and not just a small snippet.

The problem is that the line matcher looks for directive + separator. separator in this case is space.

This file uses tabs as separator in some places so it doesn't find a match.

IIRC the reason for adding the separator to the mix is to be able to match an entire directive and not just the prefix of one.

Metadata Update from @stlaz:
- Issue set to the milestone: FreeIPA 4.7

6 years ago

Metadata Update from @stlaz:
- Issue priority set to: important

6 years ago

master:

  • ae6c8d2 Handle whitespace, add separator to regex in set_directive_lines
  • e16e5cd Use a regex in installutils.get_directive instead of line splitting

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

5 years ago

Login to comment on this ticket.

Metadata
Attachments 1
Attached 6 years ago View Comment