f082 [Solved] jailed http server - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Server & Networking > Networking

Networking Network related discussions (including general TCP/IP stuff, routing, etc).

Reply
 
Thread Tools Display Modes
  #1  
Old April 16th, 2012, 14:51
Beeblebrox's Avatar
Beeblebrox Beeblebrox is offline
Member
 
Join Date: Sep 2010
Posts: 713
Thanks: 39
Thanked 76 Times in 68 Posts
Default jailed http server

Using www/lighttpd and it has been installed in a jail with IP 192.168.2.100/32 (which is an alias)

When I try to start the service from inside jail, I get:
Code:
# lighttpd -D -f /usr/lo*/etc/lighttpd/lighttpd.conf
(network.c.379) can't bind to port: 192.168.2.100 80 Address already in use
sockstat in the jail:
Code:
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
root     cron       6562  4  dgram  -> /var/run/logpriv
root     syslogd    6520  4  dgram  /var/run/log
root     syslogd    6520  5  dgram  /var/run/logpriv
ifconfig from inside jail:
Code:
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE
	inet 192.168.2.100 netmask 0xffffffff broadcast 192.168.2.100
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
__________________
branch:head - root on zfs - amd64
BLUES, ELWOOD
ILLINOIS LICENSE : B263-1655-2187
CURRENTLY UNDER SUSPENSION
WARRANTS OUTSTANDING : PARKG. 116
MOVING VIOLATIONS : 56
ARREST DRIVER ... IMPOUND VEHICLE

Last edited by Beeblebrox; April 17th, 2012 at 07:09.
Reply With Quote
  #2  
Old April 16th, 2012, 14:54
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,725
Thanks: 47
Thanked 2,023 Times in 1,862 Posts
Default

Make sure there's nothing running on the host that also uses port 80. If there is you must make sure it's bound to the host's IP address instead of all.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
  #3  
Old April 16th, 2012, 14:56
Beeblebrox's Avatar
Beeblebrox Beeblebrox is offline
Member
 
Join Date: Sep 2010
Posts: 713
Thanks: 39
Thanked 76 Times in 68 Posts
Default

Nothing running on port 80 on host side. Stopping ntpd makes no difference. The "?" service is a mountd process for some reason...
Code:
# sockstat -4l
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
root     ntpd       78836 20 udp4   *:123                 *:*
root     ntpd       78836 21 udp4   192.168.1.10:123      *:*
root     ntpd       78836 22 udp4   192.168.2.1:123       *:*
root     ntpd       78836 23 udp4   192.168.2.100:123     *:*
root     ntpd       78836 24 udp4   192.168.2.101:123     *:*
root     ntpd       78836 25 udp4   127.0.0.1:123         *:*
root     inetd      78823 6  udp4   192.168.2.1:69        *:*
dhcpd    dhcpd      78589 7  udp4   192.168.2.1:67        *:*
dhcpd    dhcpd      78589 20 udp4   192.168.2.1:33002     *:*
root     nfsd       78353 5  tcp4   192.168.2.1:2049      *:*
root     mountd     78351 5  udp4   127.0.0.1:59          *:*
root     mountd     78351 6  udp4   192.168.2.1:59        *:*
root     mountd     78351 7  tcp4   127.0.0.1:59          *:*
root     mountd     78351 8  tcp4   192.168.2.1:59        *:*
root     rpcbind    78349 7  udp4   127.0.0.1:111         *:*
root     rpcbind    78349 8  udp4   192.168.2.1:111       *:*
root     rpcbind    78349 9  udp4   *:868                 *:*
root     rpcbind    78349 10 tcp4   127.0.0.1:111         *:*
root     rpcbind    78349 11 tcp4   192.168.2.1:111       *:*
mysql    mysqld     5589  10 tcp4   192.168.2.101:3306    *:*
root     perl       1644  6  tcp4   *:10101               *:*
root     perl       1644  7  udp4   *:10000               *:*
nobody   gdomap     824   3  udp4   *:538                 *:*
nobody   gdomap     824   4  tcp4   *:538                 *:*
root     syslogd    511   6  udp4   *:514                 *:*
?        ?          ?     ?  udp4   192.168.2.1:2049      *:*
__________________
branch:head - root on zfs - amd64
BLUES, ELWOOD
ILLINOIS LICENSE : B263-1655-2187
CURRENTLY UNDER SUSPENSION
WARRANTS OUTSTANDING : PARKG. 116
MOVING VIOLATIONS : 56
ARREST DRIVER ... IMPOUND VEHICLE
Reply With Quote
  #4  
Old April 16th, 2012, 15:27
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,725
Thanks: 47
Thanked 2,023 Times in 1,862 Posts
Default

Not related but you can stop running ntp in your jails. It won't work anyway, jails get their time from the host.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
  #5  
Old April 16th, 2012, 15:35
Beeblebrox's Avatar
Beeblebrox Beeblebrox is offline
Member
 
Join Date: Sep 2010
Posts: 713
Thanks: 39
Thanked 76 Times in 68 Posts
Default

ntp is for the diskless clients so that they can sync their clocks to host before distributed compile / compute starts. ntpd is running from host side (together with nfsd & rpcbind). I would prefer to run ntpd from the jail serving pxe but it does not start when placed in jail/etc/rc.conf. If I jexec into jail, stop dhcpd, I can then manually start ntpd then I just re-start dhcpd. This is too much of a hassle however.

NFS runs on host as well because as yet, it's impossible to jail.

EDIT: Of course, under normal jail circumstances one would not want ntpd running from inside a jail since it is unable to bind to a single IP but listens on all IP's instead - thereby causing a process leak to other jails and host its self.
__________________
branch:head - root on zfs - amd64
BLUES, ELWOOD
ILLINOIS LICENSE : B263-1655-2187
CURRENTLY UNDER SUSPENSION
WARRANTS OUTSTANDING : PARKG. 116
MOVING VIOLATIONS : 56
ARREST DRIVER ... IMPOUND VEHICLE

Last edited by Beeblebrox; April 16th, 2012 at 16:02.
Reply With Quote
  #6  
Old April 16th, 2012, 17:24
Beeblebrox's Avatar
Beeblebrox Beeblebrox is offline
Member
 
Join Date: Sep 2010
Posts: 713
Thanks: 39
Thanked 76 Times in 68 Posts
Default

The annoying part is, the jailed www/thttpd starts nicely with no errors, but shows nothing but a 404 page (jail-or-host, can't get it to work).
I suppose this makes the initial post a lighttpd specific error?

EDIT: Yes, the error was in my lighttpd.conf. I had copied it from host environment to the jail and had not changed
Code:
server.port = 80
server.bind = "localhost"
Should have been:
Code:
server.port = 80
server.bind = "192.168.2.100"
__________________
branch:head - root on zfs - amd64
BLUES, ELWOOD
ILLINOIS LICENSE : B263-1655-2187
CURRENTLY UNDER SUSPENSION
WARRANTS OUTSTANDING : PARKG. 116
MOVING VIOLATIONS : 56
ARREST DRIVER ... IMPOUND VEHICLE

Last edited by Beeblebrox; April 17th, 2012 at 07:12.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] Jailed DHCP server and TFTP handoff Beeblebrox Web & Network Services 7 February 21st, 2012 12:06
Jailed PXE server r00t Installing & Upgrading 1 December 7th, 2011 02:50
[Solved] How to add a jailed server to OpenVPN? ghostcorps Networking 10 June 3rd, 2011 08:56
Mail Server using Postfix, Courier-IMAP, and MySQL jailed together. peep96 Web & Network Services 0 October 25th, 2010 02:08
Enable HTTP-Compression on http server of this forum zuborg Feedback 1 January 27th, 2009 18:53


All times are GMT +1. The time now is 21:01.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0