Currently when certbot modifies or creates an apache configuration file for a vhost it doesn’t seem to do any kind of indenting for newly added lines. e.g.:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/html/
<Directory /var/www/html/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example/privkey.pem
</VirtualHost>
</IfModule>
While there’s nothing technically wrong with this, it would be prettier and more readable to use the conventional method of indenting some arbitrary amount for each level of xml:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/html/
<Directory /var/www/html/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example/privkey.pem
</VirtualHost>
</IfModule>
The only ambiguous factor here would be what kind of whitespace to use. This could be a setting in cli.ini
that falls back no whitespace if not set (which would preserve the current behavior). Additionally, it might be easy enough to create an indentation = auto
type setting where certbot autodetects the type of indentation being used in the current configuration file that it’s replicating. Obviously this may not always be perfect but with a couple simple regexes, my bet is it would be fairly easy to make guesses that would work in a majority of cases.
It’s a bit trivial I know but I find it unpleasant to look at xml with messy, inconsistent or non-existent indentation.