Bug 54905 - univention-add-vhost apache configuration causes syntax error
univention-add-vhost apache configuration causes syntax error
Status: NEW
Product: UCS
Classification: Unclassified
Component: Apache
UCS 4.4
Other All
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-06-28 09:20 CEST by Ingo Jürgensmann
Modified: 2022-06-28 13:00 CEST (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Jürgensmann univentionstaff 2022-06-28 09:20:22 CEST
When creating a vhost with univetion-add-vhost --conffile /path/to/config.conf the config is written with IncludeOptional /path/to/config.con[f]. 

Example: 

univention-add-vhost --conffile /etc/apache2/conf-enabled/letsencrypt-proxy.conf sso.elearning.domain.de 80

Which results in this configfile (/etc/apache2/sites-enabled/univention-vhost.conf): 

<VirtualHost *:80>
        ServerName sso.elearning.domain.de
        IncludeOptional /etc/apache2/conf-enabled/letsencrypt-proxy.con[f]

</VirtualHost>

Most likely the cause is a wrong regex in /etc/univention/templates/files/etc/apache2/sites-available/univention-vhosts.conf

    print(" IncludeOptional %s" % re.sub(r'^(.*)(.)$', r'\1[\2]', file))

The '[\2]' seems to be the only occurence where the *.con[f] can come from. 

https://httpd.apache.org/docs/2.4/en/mod/core.html#includeoptional states that IncludeOptional only takes one argument, so the regex seems to be wrong in the above line as there shouldn't be a second result set.