You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Bruce Wilson <b-...@toomuchblue.com> on 2007/04/12 03:14:50 UTC
Apache + SVN
Hi, all.
I've been using Subversion locally for over a year now (both as a
Windows install, and then through Apache in a VMware Server image), and
I'm ready to push it out to my team. I have a FreeBSD server running
Apache 2.2 and Subversion 1.4.3, both from the ports collection, but
with careful option selections. I've chosen to use WebDAV access, and
for the repository to be only available via SSL. (Yes, each site has
its own IP, and I'm running IP-based vhosts.)
The challenge: this server hosts two bugzilla installs as well (IP-based
vhosts on one instance of Apache). I want to keep Subversion segregated
from the other sites in the following ways:
* WebDAV should not be available to the bugzilla sites. Subversion
instance should not have access to modules specific to Bugzilla.
* Subversion running at the root of the new site.
* The Bugzilla sites should not have file permissions to the
Subversion repository.
* Configurations should not "bleed over" from one site to the
other. That is, if I grant/deny a permission on a path in the
bugzilla site, and that same path exists in Subversion, the
permissions should not carry over.
I've looked into running two instances of Apache using the "profiles"
feature. Documentation on how this works is scarce, and most of the
pages Google could find talked about why you should use vhosts instead
of multiple instances of Apache. In my scenario, I think separate
instances are warranted, since I want modules and file access to be
different per instance of Apache.
Can anybody point me to a good reference for the scenario I described?
For that matter, the Apache docs explain vhosts well and SSL well, but
not vhosts with SSL. The .conf files seem to be overlapping in purpose,
yet settings for each site may appear in multiple files. I haven't
figured out how best to merge the information into one configuration per
virtual site.
The other possible scenario is to run Subversion as yet another vhost,
so long as I can lock down module capabilities by site. The Apache
examples focus on single-site configurations (as I suppose they should),
which means all path references start with /, so I'm not terribly
confident that a setting won't apply in more places than it should.
I realize these questions are pretty Apache-specific. I looked at both
the Apache lists and this list, and it seemed like topics like mine
(WebDAV + SSL + vhosts) come up more frequently here than at Apache. My
apologies if I've posted to the wrong place.
I'm going to snuggle up with my O'Reilly "Apache, the definitive guide"
again tonight to see if I missed something, but I'd love to hear from
anyone who has already tackled a scenario like mine.
Thanks bunches,
-- Bruce
Re: Apache + SVN
Posted by Bruce Wilson <b-...@toomuchblue.com>.
Ryan Schmidt wrote:
> I do see what you mean. But since you can configure DAV to be enabled
> or not on a per-vhost basis, the only protection the above seems to
> afford you is protection against bugs in the WebDAV module itself that
> would manifest themselves on the server as a whole regardless of its
> configuration. Granted, that may be a reasonable precaution. But if it
> were my server, I probably wouldn't be very concerned about it,
> especially if I kept my software up to date. I have a high degree of
> confidence in the security of Apache and its included modules, and the
> responsibility of its developers to release timely security updates as
> needs arise.
I guess I may be venturing from Due Caution into the realm of Borderline
Paranoia here.
>> Subversion requires Apache to have write access to the repository
>> directory. Bugzilla requires write access to several of its own
>> directories. Since the two Bugzilla sites are public-facing, linked
>> from multiple places and potentially turning up in search engines,
>> I'm uncomfortable having those sites running under a user who
>> potentially has access to the Subversion repository, holding private
>> and proprietary data. The only way I've seen to control this is to
>> run one instance of Apache as one user (perhaps "www-bugzilla") and
>> another instance as another user ("www-svn"), so I can assign
>> different permissions to each user.
>
> I think you have a point here. I can think of no way to restrict the
> Bugzilla installation so that it cannot access the files of your
> Subversion repository, short of running two Apaches under two
> different users as you suggest.
>
> You'd be protecting against theoretical bugs in Bugzilla that would
> enable an attacker to read any file the web server can read. But bugs
> like that certainly have surfaced in other popular web-based projects,
> so this concern is certainly not unfounded.
I saw a suggestion in the O'Reilly "Apache Cookbook" suggesting this
arrangement to protect one site from the WebDAV enabled on another.
Perhaps this solution is less warranted if all users with access to the
system are trusted? (E.G. me plus one guy who only writes reports, at
the moment).
> If you place that directive outside of any <VirtualHost> directives,
> it will apply to all virtual hosts. If you place the directive inside
> a <VirtualHost> directive, it applies only to that virtual host. This
> is at least an easy question to answer. :) Um... well, except that any
> modules you need for a particular vhost will have to be activated for
> all vhosts. So as you noticed above, mod_dav and mod_dav_svn will be
> loaded in memory, even for those workers that are only serving
> Bugzilla requests.
>
> Note too though that granting access to specific paths of a virtual
> host (for a normal web site like Bugzilla, with <Location> directives)
> is a different beast from allowing access to specific paths of a
> Subversion repository (which is usually handled with Subversion access
> files).
That's helpful. What about if Subversion is unavailable for some
reason? Might DAV kick in and allow general WebDAV operations? Or
would using the svn DAV module guarantee the site does nothing unless
Subversion is available?
> I've managed several multi-purpose Apache servers for a web hosting
> shop. It's not that bad. As long as you keep directives inside
> <VirtualHost> containers, they will apply only to that vhost.
>
> Originally I had all vhosts in a single vhosts.conf file which was
> included from the main httpd.conf file. Then later I found that you
> could have Apache automatically include all files in a given
> directory, and I split each site into its own include file in a vhosts
> directory. For sites that used both http and https (even where the
> http site just redirected all URLs to the https site), I kept both the
> http and https vhosts in the same configuration file because I found
> that more intuitive.
This is very helpful, and exactly part of the help I was looking for:
some guidance on good ways to arrange and organize the .conf files so I
can clearly see what applies to which site.
> As long as your questions are "how do I configure Apache to host my
> Subversion repository," this is a good place to ask. Things like
> starting multiple Apache instances and mod_rewrite rules start to go
> beyond what usually gets discussed here and you might have more luck
> on an Apache-oriented forum or list.
I will do that. Thanks for replying and pointing me in the right
directions.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Apache + SVN
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 12, 2007, at 16:46, Bruce Wilson wrote:
> Thanks for the speedy reply, Ryan. I think maybe I skimmed too
> quick over some of my points.
My apologies for my too-speedy reply; now I see what you mean:
> Ryan Schmidt wrote:
>
>> On Apr 11, 2007, at 22:14, Bruce Wilson wrote:
>>
>>> * WebDAV should not be available to the bugzilla sites.
>>> Subversion instance should not have access to modules specific to
>>> Bugzilla.
>
> By this I mean that I would prefer the Bugzilla sites be using an
> instance of Apache which does not even have the WebDAV module
> loaded. I know I can enable WebDAV on a site-by-site basis, but
> I'd rather not have it accessible to Bugzilla at all. I'm going
> for the "less is more" configuration for each instance, to make
> each site's config as simple as possible, to minimize the attack
> surface of each site, and to make sure that (for example) dav can't
> be leveraged against Bugzilla to get to my Postgresql server and
> parlay that into full control of my box.
I do see what you mean. But since you can configure DAV to be enabled
or not on a per-vhost basis, the only protection the above seems to
afford you is protection against bugs in the WebDAV module itself
that would manifest themselves on the server as a whole regardless of
its configuration. Granted, that may be a reasonable precaution. But
if it were my server, I probably wouldn't be very concerned about it,
especially if I kept my software up to date. I have a high degree of
confidence in the security of Apache and its included modules, and
the responsibility of its developers to release timely security
updates as needs arise.
>>> * The Bugzilla sites should not have file permissions to the
>>> Subversion repository.
>
> Subversion requires Apache to have write access to the repository
> directory. Bugzilla requires write access to several of its own
> directories. Since the two Bugzilla sites are public-facing,
> linked from multiple places and potentially turning up in search
> engines, I'm uncomfortable having those sites running under a user
> who potentially has access to the Subversion repository, holding
> private and proprietary data. The only way I've seen to control
> this is to run one instance of Apache as one user (perhaps "www-
> bugzilla") and another instance as another user ("www-svn"), so I
> can assign different permissions to each user.
I think you have a point here. I can think of no way to restrict the
Bugzilla installation so that it cannot access the files of your
Subversion repository, short of running two Apaches under two
different users as you suggest.
You'd be protecting against theoretical bugs in Bugzilla that would
enable an attacker to read any file the web server can read. But bugs
like that certainly have surfaced in other popular web-based
projects, so this concern is certainly not unfounded.
>>> * Configurations should not "bleed over" from one site to the
>>> other. That is, if I grant/deny a permission on a path in the
>>> bugzilla site, and that same path exists in Subversion, the
>>> permissions should not carry over.
>
> This may be more a case of my discomfort with Apache
> configurations. Reading all the Apache examples and config files,
> it's not at all clear to me how I can be sure that...
> <Location />
> Dav svn
> </Location>
> ...would not enable Dav for the root of all sites at once.
If you place that directive outside of any <VirtualHost> directives,
it will apply to all virtual hosts. If you place the directive inside
a <VirtualHost> directive, it applies only to that virtual host. This
is at least an easy question to answer. :) Um... well, except that
any modules you need for a particular vhost will have to be activated
for all vhosts. So as you noticed above, mod_dav and mod_dav_svn will
be loaded in memory, even for those workers that are only serving
Bugzilla requests.
Note too though that granting access to specific paths of a virtual
host (for a normal web site like Bugzilla, with <Location>
directives) is a different beast from allowing access to specific
paths of a Subversion repository (which is usually handled with
Subversion access files).
> From your reply, I guess I just need to get more familiar with
> nesting directives. Overall, I'm just having trouble putting it
> all together. Between my O'Reilly books on Apache and Subversion,
> reading the Apache .conf file examples, and the httpd docs on the
> web, I have seen lots of examples of how to do any specific X
> within either package - in isolation. I'm looking for a more
> detailed explanation of how to use certain features together.
>
> As you've probably seen, there's a bajillion websites (and forum
> posts and blog entries and columns...) that tell you how to switch
> Apache from single-site to vhost, but that's about as far as they
> go. They don't take it to the next step to show what a complex
> multi-vhost config looks like, with SSL, with DAV on limited
> directories, with mod-rewrites to force SSL, with custom access
> rules in specific paths, and so on and so forth.
>
> Of the places I've looked, the Subversion and Bugzilla install
> guides seem to have the most comprehensive explanations. Apache
> docs are often too general because they assume you'll know what
> options you'll need for your site.
I've managed several multi-purpose Apache servers for a web hosting
shop. It's not that bad. As long as you keep directives inside
<VirtualHost> containers, they will apply only to that vhost.
Originally I had all vhosts in a single vhosts.conf file which was
included from the main httpd.conf file. Then later I found that you
could have Apache automatically include all files in a given
directory, and I split each site into its own include file in a
vhosts directory. For sites that used both http and https (even where
the http site just redirected all URLs to the https site), I kept
both the http and https vhosts in the same configuration file because
I found that more intuitive.
Redirecting http traffic to https should be an isolated topic for
which you can find a guide somewhere. But... it should just be this:
<VirtualHost 192.168.0.2:80>
ServerName secure.example.com
RedirectMatch permanent ^/(.*)$ https://secure.example.com/$1
# that's all you need in the redirect vhost
</VirtualHost>
<VirtualHost 192.168.0.2:443>
ServerName secure.example.com
DocumentRoot /path/to/docroot
# whatever other directives you want for the ssl vhost
</VirtualHost>
Note that Subversion doesn't like redirects. If the secure vhost here
hosts a Subversion repository and you try to check out over http on
port 80, it will not work; you'll get a cryptic error message.
>> I've never heard of Apache's "profiles" feature. I don't see any
>> reason for you to run a second copy of Apache. Just use another
>> vhost for your Subversion repository(ies).
>
> Hmm, I guess this is a feature of the FreeBSD port of Apache. It
> permits such things as "apachectl start profile1" to start an
> instance with a specific set of configurations. "apachectl start"
> launches all known profiles. I've seen references in other
> projects to using an "apache-profile-like" configuration method, so
> I figured it was a pretty widely known feature.
>
> I'll follow up with the port maintainer to see if there's any help
> on this feature.
>
> As I explained above, I'm pretty sure I can't prevent the Bugzilla
> sites from having write access to Subversion under a single
> instance of Apache. If I have to run all the sites under one
> instance I will, but what I know of this feature seems like a
> perfect fit for the configuration I'm after.
That does sound useful. It may be part of standard Apache, I don't
know. I've just never looked for such functionality.
>> If all your vhosts use SSL, then you need a separate IP address
>> for each vhost. (More specifically, you need one IP for each SSL
>> vhost. If you have additional non-SSL vhosts, they can be name-
>> based and can share an SSL vhost's IP, or use their own IP, as you
>> wish.)
>
> Yeah, I understand how name-based vhosts work. All three sites use
> SSL, so I am forced to IP-based vhosts.
>
> I'm sure someone must have written something with a bit more depth
> than "You can host two sites! With the same IP! Without changing
> ports! Here's how!", I just haven't found it yet.
>
> If you think I'm better off asking on an Apache list, please let me
> know - I don't want to be an annoyance if this isn't the right
> place for this.
As long as your questions are "how do I configure Apache to host my
Subversion repository," this is a good place to ask. Things like
starting multiple Apache instances and mod_rewrite rules start to go
beyond what usually gets discussed here and you might have more luck
on an Apache-oriented forum or list.
--
To reply to the mailing list, please use your mailer's Reply To All
function
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Apache + SVN
Posted by Bruce Wilson <b-...@toomuchblue.com>.
Thanks for the speedy reply, Ryan. I think maybe I skimmed too quick
over some of my points.
Ryan Schmidt wrote:
> On Apr 11, 2007, at 22:14, Bruce Wilson wrote:
>> * WebDAV should not be available to the bugzilla sites. Subversion
>> instance should not have access to modules specific to Bugzilla.
By this I mean that I would prefer the Bugzilla sites be using an
instance of Apache which does not even have the WebDAV module loaded. I
know I can enable WebDAV on a site-by-site basis, but I'd rather not
have it accessible to Bugzilla at all. I'm going for the "less is more"
configuration for each instance, to make each site's config as simple as
possible, to minimize the attack surface of each site, and to make sure
that (for example) dav can't be leveraged against Bugzilla to get to my
Postgresql server and parlay that into full control of my box.
>> * The Bugzilla sites should not have file permissions to the
>> Subversion repository.
Subversion requires Apache to have write access to the repository
directory. Bugzilla requires write access to several of its own
directories. Since the two Bugzilla sites are public-facing, linked
from multiple places and potentially turning up in search engines, I'm
uncomfortable having those sites running under a user who potentially
has access to the Subversion repository, holding private and proprietary
data. The only way I've seen to control this is to run one instance of
Apache as one user (perhaps "www-bugzilla") and another instance as
another user ("www-svn"), so I can assign different permissions to each
user.
>> * Configurations should not "bleed over" from one site to the other.
>> That is, if I grant/deny a permission on a path in the bugzilla site,
>> and that same path exists in Subversion, the permissions should not
>> carry over.
This may be more a case of my discomfort with Apache configurations.
Reading all the Apache examples and config files, it's not at all clear
to me how I can be sure that...
<Location />
Dav svn
</Location>
...would not enable Dav for the root of all sites at once.
From your reply, I guess I just need to get more familiar with nesting
directives. Overall, I'm just having trouble putting it all together.
Between my O'Reilly books on Apache and Subversion, reading the Apache
.conf file examples, and the httpd docs on the web, I have seen lots of
examples of how to do any specific X within either package - in
isolation. I'm looking for a more detailed explanation of how to use
certain features together.
As you've probably seen, there's a bajillion websites (and forum posts
and blog entries and columns...) that tell you how to switch Apache from
single-site to vhost, but that's about as far as they go. They don't
take it to the next step to show what a complex multi-vhost config looks
like, with SSL, with DAV on limited directories, with mod-rewrites to
force SSL, with custom access rules in specific paths, and so on and so
forth.
Of the places I've looked, the Subversion and Bugzilla install guides
seem to have the most comprehensive explanations. Apache docs are often
too general because they assume you'll know what options you'll need for
your site.
> I've never heard of Apache's "profiles" feature. I don't see any
> reason for you to run a second copy of Apache. Just use another vhost
> for your Subversion repository(ies).
Hmm, I guess this is a feature of the FreeBSD port of Apache. It
permits such things as "apachectl start profile1" to start an instance
with a specific set of configurations. "apachectl start" launches all
known profiles. I've seen references in other projects to using an
"apache-profile-like" configuration method, so I figured it was a pretty
widely known feature.
I'll follow up with the port maintainer to see if there's any help on
this feature.
As I explained above, I'm pretty sure I can't prevent the Bugzilla sites
from having write access to Subversion under a single instance of
Apache. If I have to run all the sites under one instance I will, but
what I know of this feature seems like a perfect fit for the
configuration I'm after.
> If all your vhosts use SSL, then you need a separate IP address for
> each vhost. (More specifically, you need one IP for each SSL vhost. If
> you have additional non-SSL vhosts, they can be name-based and can
> share an SSL vhost's IP, or use their own IP, as you wish.)
Yeah, I understand how name-based vhosts work. All three sites use SSL,
so I am forced to IP-based vhosts.
I'm sure someone must have written something with a bit more depth than
"You can host two sites! With the same IP! Without changing ports!
Here's how!", I just haven't found it yet.
If you think I'm better off asking on an Apache list, please let me know
- I don't want to be an annoyance if this isn't the right place for this.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Apache + SVN
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 11, 2007, at 22:14, Bruce Wilson wrote:
> I've been using Subversion locally for over a year now (both as a
> Windows install, and then through Apache in a VMware Server image),
> and I'm ready to push it out to my team. I have a FreeBSD server
> running Apache 2.2 and Subversion 1.4.3, both from the ports
> collection, but with careful option selections. I've chosen to use
> WebDAV access, and for the repository to be only available via
> SSL. (Yes, each site has its own IP, and I'm running IP-based
> vhosts.)
>
> The challenge: this server hosts two bugzilla installs as well (IP-
> based vhosts on one instance of Apache). I want to keep Subversion
> segregated from the other sites in the following ways:
> WebDAV should not be available to the bugzilla sites. Subversion
> instance should not have access to modules specific to Bugzilla.
> Subversion running at the root of the new site.
> The Bugzilla sites should not have file permissions to the
> Subversion repository.
> Configurations should not "bleed over" from one site to the other.
> That is, if I grant/deny a permission on a path in the bugzilla
> site, and that same path exists in Subversion, the permissions
> should not carry over.
> I've looked into running two instances of Apache using the
> "profiles" feature. Documentation on how this works is scarce, and
> most of the pages Google could find talked about why you should use
> vhosts instead of multiple instances of Apache. In my scenario, I
> think separate instances are warranted, since I want modules and
> file access to be different per instance of Apache.
>
> Can anybody point me to a good reference for the scenario I described?
>
> For that matter, the Apache docs explain vhosts well and SSL well,
> but not vhosts with SSL. The .conf files seem to be overlapping in
> purpose, yet settings for each site may appear in multiple files.
> I haven't figured out how best to merge the information into one
> configuration per virtual site.
>
> The other possible scenario is to run Subversion as yet another
> vhost, so long as I can lock down module capabilities by site. The
> Apache examples focus on single-site configurations (as I suppose
> they should), which means all path references start with /, so I'm
> not terribly confident that a setting won't apply in more places
> than it should.
>
> I realize these questions are pretty Apache-specific. I looked at
> both the Apache lists and this list, and it seemed like topics like
> mine (WebDAV + SSL + vhosts) come up more frequently here than at
> Apache. My apologies if I've posted to the wrong place.
>
> I'm going to snuggle up with my O'Reilly "Apache, the definitive
> guide" again tonight to see if I missed something, but I'd love to
> hear from anyone who has already tackled a scenario like mine.
I've never heard of Apache's "profiles" feature. I don't see any
reason for you to run a second copy of Apache. Just use another vhost
for your Subversion repository(ies).
If all your vhosts use SSL, then you need a separate IP address for
each vhost. (More specifically, you need one IP for each SSL vhost.
If you have additional non-SSL vhosts, they can be name-based and can
share an SSL vhost's IP, or use their own IP, as you wish.)
Certainly you can define rules based on paths, and have those rules
apply only to a particular vhost. Just nest the directives.
<VirtualHost *:443>
ServerName svn.example.com
<Location /svn/>
...
</Location>
</VirtualHost>
--
To reply to the mailing list, please use your mailer's Reply To All
function
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org