Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Running svnserve on port 22 as non-root?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
lamekain
Guru
Guru


Joined: 25 Nov 2003
Posts: 331
Location: Helsinki, Finland

PostPosted: Sat Oct 15, 2005 10:14 am    Post subject: Running svnserve on port 22 as non-root? Reply with quote

Hi!

I just installed subversion and got it working. I got it working with ssh+svn and with only svn. I'd prefer only svn, because it makes configuring the --root -cmd-variable easier (don't want to start messing with ssh public-keys, etc..). I have to use 22 because of the firewall restrictions.

The problem is that I have to start svnserve as root to get it to bind to the port 22. Is it possible to get svnserve to bind to the port 22 as root and then switch the user to someone more restricted?
_________________
"Only when the last tree has died, the last river been poisoned,
and the last fish been caught, will we realize we cannot eat money"

-Global Terrorism.org
Back to top
View user's profile Send private message
elestedt
Guru
Guru


Joined: 13 Mar 2005
Posts: 383

PostPosted: Sat Oct 15, 2005 11:05 am    Post subject: Re: Running svnserve on port 22 as non-root? Reply with quote

lamekain wrote:
Hi!

I just installed subversion and got it working. I got it working with ssh+svn and with only svn. I'd prefer only svn, because it makes configuring the --root -cmd-variable easier (don't want to start messing with ssh public-keys, etc..). I have to use 22 because of the firewall restrictions.

The problem is that I have to start svnserve as root to get it to bind to the port 22. Is it possible to get svnserve to bind to the port 22 as root and then switch the user to someone more restricted?

  • If you have SSHd running you can't get anything else to bind to that port.
  • If you have root access, then why not open a port in the FW?
Back to top
View user's profile Send private message
lamekain
Guru
Guru


Joined: 25 Nov 2003
Posts: 331
Location: Helsinki, Finland

PostPosted: Sat Oct 15, 2005 11:29 am    Post subject: Re: Running svnserve on port 22 as non-root? Reply with quote

Quote:
  • If you have SSHd running you can't get anything else to bind to that port.

Yep. Well aware of that. However SSHd wouldn't be running when I need svnserve to run.

Quote:
  • If you have root access, then why not open a port in the FW?

Well I don't have root access to the internet gateway and they've opened port 22 for me but not the others.
_________________
"Only when the last tree has died, the last river been poisoned,
and the last fish been caught, will we realize we cannot eat money"

-Global Terrorism.org
Back to top
View user's profile Send private message
elestedt
Guru
Guru


Joined: 13 Mar 2005
Posts: 383

PostPosted: Sat Oct 15, 2005 11:36 am    Post subject: Re: Running svnserve on port 22 as non-root? Reply with quote

lamekain wrote:
Quote:
  • If you have SSHd running you can't get anything else to bind to that port.

Yep. Well aware of that. However SSHd wouldn't be running when I need svnserve to run.

Well then, take a look at
Code:
# man 8 svnserve

lamekain wrote:
Quote:
  • If you have root access, then why not open a port in the FW?

Well I don't have root access to the internet gateway and they've opened port 22 for me but not the others.

Why not try to get them to open 3690 as well?
Back to top
View user's profile Send private message
lamekain
Guru
Guru


Joined: 25 Nov 2003
Posts: 331
Location: Helsinki, Finland

PostPosted: Sat Oct 15, 2005 11:46 am    Post subject: Re: Running svnserve on port 22 as non-root? Reply with quote

elestedt wrote:
Well then, take a look at
Code:
# man 8 svnserve

Why? Seen it already. How does it help?

elestedt wrote:
lamekain wrote:
Quote:
  • If you have root access, then why not open a port in the FW?

Well I don't have root access to the internet gateway and they've opened port 22 for me but not the others.

Why not try to get them to open 3690 as well?

Ok. I give up. I'll bug them. My point was to ask if there was an easy solution for making svnserve running on 22 more secure, but I guess there isn't or at least neither of us know it. The ideal solution would be the good old "start server and bind it to port 22 as root and then su to someone else" pattern which some people use with tomcat, etc..
_________________
"Only when the last tree has died, the last river been poisoned,
and the last fish been caught, will we realize we cannot eat money"

-Global Terrorism.org
Back to top
View user's profile Send private message
elestedt
Guru
Guru


Joined: 13 Mar 2005
Posts: 383

PostPosted: Sat Oct 15, 2005 11:50 am    Post subject: Re: Running svnserve on port 22 as non-root? Reply with quote

lamekain wrote:
elestedt wrote:
Well then, take a look at
Code:
# man 8 svnserve

Why? Seen it already. How does it help?

Code:
DESCRIPTION
       svnserve allows access to Subversion repositories using the svn network protocol.  It can both run as a standalone server process, or it can run out of inetd.  You must choose a mode of opera-
       tion when you start svnserve.  The following options are recognized:

       -d, --daemon
            Causes svnserve to run in daemon mode.  svnserve backgrounds itself and accepts and serves TCP/IP connections on the svn port (3690, by default).

       --listen-port=port
            Causes svnserve to listen on port when run in daemon mode.

All you need to do as root is
Code:
su - <user> -c svnserve -d --listen-port=22
and some more options.
Back to top
View user's profile Send private message
lamekain
Guru
Guru


Joined: 25 Nov 2003
Posts: 331
Location: Helsinki, Finland

PostPosted: Sat Oct 15, 2005 12:02 pm    Post subject: Reply with quote

Thanks. I guess it's working now. You have to put the command in "" though so the complete thing would be:
Code:
su -USERNAME -c "svnserve -d --listen-port=22"

_________________
"Only when the last tree has died, the last river been poisoned,
and the last fish been caught, will we realize we cannot eat money"

-Global Terrorism.org
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum