Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 532718

Summary: app-backup/backuppc: check if provided httpd.conf is compatible with apache-2.4
Product: Gentoo Linux Reporter: Pacho Ramos <pacho>
Component: Current packagesAssignee: App-Backup Team <app-backup>
Status: RESOLVED FIXED    
Severity: normal CC: mjo
Priority: Normal Keywords: NeedPatch
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 541312    
Bug Blocks: 468302    
Attachments: backuppc-3.3.1.ebuild
files/99_backuppc.conf

Description Pacho Ramos gentoo-dev 2014-12-16 16:16:50 UTC
I don't know if it's really compatible with 2.4, looks like other distributions are using really different configs :(
http://pkgs.fedoraproject.org/cgit/BackupPC.git/tree/BackupPC.htaccess
https://projects.archlinux.org/svntogit/community.git/tree/trunk/backuppc.httpd?h=packages/backuppc
Comment 1 Michael Orlitzky gentoo-dev 2014-12-26 16:26:57 UTC
It's not compatible.. there's probably a nicer way to do the config than running a separate instance of apache, too. I didn't look very hard, but I don't see why it couldn't install a conf file to /etc/apache2/modules.d like most other web apps.
Comment 2 Pacho Ramos gentoo-dev 2015-05-17 11:01:24 UTC
this is the last uncompatible package with 2.4 :(, but I haven't found what config should we use... :/
Comment 3 Michael Orlitzky gentoo-dev 2015-05-17 12:47:23 UTC
Maybe we should revbump and quickly stabilize a new version of backuppc that depends on <apache-2.4?

BackupPC depends on mod_perl, which also doesn't support apache-2.4 at the moment. However mod_perl has its dependency on <apache-2.4, so at least transitively, BackupPC depends on apache-2.2.

Because of the transitive dependency, this shouldn't block apache-2.4 stabilization, but I would feel a little bit better if BackupPC depended on <apache2.4 itself.
Comment 4 Pacho Ramos gentoo-dev 2015-05-17 12:53:12 UTC
latest mod_perl also supports apache-2.4... then, we should try to port this last one (as all the distributions made years ago) instead of needing to keep 2.2 forever
Comment 5 Zoltán Halassy 2015-09-24 12:09:15 UTC
I checked the links in Description. Both seem to be apache 2.4 compatible now. The first one even has comments for it, and the second one doesn't seem to have any compatible stuff. I didn't try it, I'm not using the software. Just for the heads up.
Comment 6 Zoltán Halassy 2015-09-24 12:10:08 UTC
Sorry, wanted to say "the second one doesn't seem to have any incompatible stuff"
Comment 7 Zoltán Halassy 2015-09-24 12:18:37 UTC
Oh, ignore me, totally misunderstood the whole thing :( I see the instance config in the files folder now which contains an apache 2.2 config.

Do we just need a 2.4 compatible httpd.conf and be done with it for now, or we need an overhaul for this one?
Comment 8 Zoltán Halassy 2015-09-24 12:37:17 UTC
We could provide a httpd.conf which works both with 2.2 and 2.4:

<IfModule mod_authz_core.c>
#2.4 directives
</IfModule>
<IfModule !mod_authz_core.c>
#2.2 directives
</IfModule>

The only difficulty comes from the LoadModule section at the top, where we cannot use that logic there. Maybe we could detect the apache version from the init script, and add an extra -D option like -D APACHE2_2 or -D APACHE2_4 , and do <IfDefine> directives in the config instead. Then it would become like:

<IfDefine APACHE2_2>
</IfDefine>
<IfDefine APACHE2_4>
</IfDefine>

The problematic sections would be the Order and Allow directives. Changes would look like this:

[...]
<Directory "HTDOCSDIR">
    [...]
    <IfDefine APACHE2_2>
        Order allow,deny
        Allow from all
    </IfDefine>
    #2.4 condition not needed, we have a require directive already
    [...]
    Require valid-user
</Directory>

<Directory "HTDOCSDIR/image">
    SetHandler None
    Options Indexes FollowSymlink
    <IfDefine APACHE2_2>
        Order allow,deny
        Allow from all
    </IfDefine>
    <IfDefine APACHE2_4>
        Require all granted
    </IfDefine>
</Directory>

[...]

The LoadModules section also needs to be tweaked like this. A good starting point would be for the APACHE2_4 branch a default 2.4 config.
Comment 9 Zoltán Halassy 2015-09-24 12:42:17 UTC
Detecting apache version from init script:

apache2 -V | sed -r 's@^.*Apache/([0-9]+)\.([0-9]+).*$@-D APACHE\1_\2@' | fgrep -- '-D APACHE'
Comment 10 Pacho Ramos gentoo-dev 2015-10-13 19:23:52 UTC
Maybe having one version supporting apache-2.2 and other for 2.4 would be easier :/
Comment 11 Pacho Ramos gentoo-dev 2015-10-13 19:24:23 UTC
Anyway, it looks like Fedora is able to make it work with both versions:
http://pkgs.fedoraproject.org/cgit/BackupPC.git/tree/BackupPC.htaccess
Comment 12 Michael Orlitzky gentoo-dev 2015-10-14 13:22:33 UTC
(In reply to Pacho Ramos from comment #11)
> Anyway, it looks like Fedora is able to make it work with both versions:
> http://pkgs.fedoraproject.org/cgit/BackupPC.git/tree/BackupPC.htaccess

Fedora gets to cheat, because they build Apache. So they know that mod_authz_core will be there for apache-2.4 in,

  <IfModule mod_authz_core.c>
    # Apache 2.4 stuff
  </IfModule>

Gentoo users can disable that module with a USE flag, although it's not advised.

There's no reason for BackupPC to have its own httpd.conf -- I think it will work just fine with a small vhost configuration like most of the other webapps. I just need to sit down and write one from scratch one day when I get time.
Comment 13 Pacho Ramos gentoo-dev 2015-10-14 19:25:44 UTC
OK, thanks for the explanation :)
Comment 14 Michael Orlitzky gentoo-dev 2015-10-15 00:53:18 UTC
Created attachment 414580 [details]
backuppc-3.3.1.ebuild
Comment 15 Michael Orlitzky gentoo-dev 2015-10-15 01:01:37 UTC
Created attachment 414582 [details]
files/99_backuppc.conf

OK, this is the best I could do. First, I dropped all of the webapp stuff. It's pointless -- you can only run one daemon on the system, so you can't really host separate websites to admin the one instance. I also added a few missing die statements.

Next, I figured out why this had its own httpd.conf: the web server needs to run as the "backuppc" user and not as "apache". I actually don't see how we were better off than if we had just used "apache" to run the daemon. Nevertheless, it's a bad solution (and upstream's fault for requiring it). But now, with apache-2.4, we have a better way. The mpm_itk module lets you run a virtual host as a separate user/group!

So, I undid most of the apache stuff in the ebuild, and made it install a tiny conf file (99_backuppc.conf) that can be enabled with "-D BACKUPPC" in APACHE2_OPTS. The new vhost runs as backuppc/backuppc, and only listens on 127.0.0.1:8080 so it won't interfere with any existing sites (hopefully).

There's some slight configuration needed now (mentioned in the elog), but I think the end result is a lot better. Caveat: none of this works without the new mod_perl.
Comment 16 Michael Orlitzky gentoo-dev 2015-10-15 01:04:20 UTC
This still needs some work, by the way, I'm just sick of working on it =)

Some of the deps could use updating, and I'm sure there are some more APACHE2_MODULES we need (like auth_basic).
Comment 17 Michael Orlitzky gentoo-dev 2015-12-17 21:17:37 UTC
The new mod_perl is done, so this is basically ready. @app-backup, can I commit this after a little cleanup so that we have something working with apache-2.4?
Comment 18 Pacho Ramos gentoo-dev 2015-12-19 09:25:27 UTC
I would go ahead directly as looks like @app-backup is not really taking care of this package :|
Comment 19 Thomas Beierlein gentoo-dev 2016-01-17 08:49:24 UTC
(In reply to Michael Orlitzky from comment #17)
> The new mod_perl is done, so this is basically ready. @app-backup, can I
> commit this after a little cleanup so that we have something working with
> apache-2.4?

Speaking as one of the few devs on the @app-backup alias Michael feel free to go ahead with it.
Comment 20 Michael Orlitzky gentoo-dev 2016-01-19 16:44:04 UTC
Ok, I committed this last night with a catch: I misinterpreted what happened with mod_perl, so the only version (mod_perl-2.0.10_pre201601) that will work with the new backuppc is masked. As a result, backuppc-3.3.1 is masked until we can get a newer version of mod_perl unmasked.

Dilfridge suggested to me that the newer revisions of mod_perl-2.0.8 should work, but I haven't been able to get them to work in my testing. So that might be fixable, or the masked version mod_perl-2.0.10* should get unmasked kinda soon for perl-5.22. Either way it will get taken care of eventually.

So, I'm going to mark this fixed -- we now have a version of backuppc whose config supports apache-2.4. I'll worry about the details in the remaining bugs.