Modify

Ticket #1013 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

Bcfg2 server can't be bound to a specific network interface

Reported by: https://www.google.com/accounts/o8/id?id=AItOawlP6DRBvIJ7NLpLWILbgzURvGbMtGEyd8U Owned by: solj
Priority: minor Milestone: Bcfg2 1.2.0 Release
Component: bcfg2-server Version: 1.0
Keywords: Cc:

Description

The bcfg2.conf(5) man page says:

COMPONENT OPTIONS
       Specified in the [components] section.

       bcfg2  URL of the server.  On the server this specifies which interface
              and port the server listens on.  [...]

However, the server always listens on all available network interfaces, regardless of this setting.

Attachments

Change History

comment:1 Changed 10 years ago by solj

  • Owner changed from desai to solj
  • Status changed from new to accepted

Can you try this and see if it fixes the problem for you?

diff --git a/src/lib/SSLServer.py b/src/lib/SSLServer.py
index a89beab..871b502 100644
--- a/src/lib/SSLServer.py
+++ b/src/lib/SSLServer.py
@@ -97,9 +97,9 @@ class SSLServer (SocketServer.TCPServer, object):
 
         """
 
-        all_iface_address = ('', server_address[1])
+        listen_address = (server_address[0], server_address[1])
         try:
-            SocketServer.TCPServer.__init__(self, all_iface_address,
+            SocketServer.TCPServer.__init__(self, listen_address,
                                             RequestHandlerClass)
         except socket.error:
             self.logger.error("Failed to bind to socket")

comment:2 follow-up: ↓ 3 Changed 10 years ago by https://www.google.com/accounts/o8/id?id=AItOawlP6DRBvIJ7NLpLWILbgzURvGbMtGEyd8U

Thanks! This solves the reported problem, but if the interface to listen on is not specified, the server now listens only on the loopback interface. I guess that's not desired.

comment:3 in reply to: ↑ 2 Changed 10 years ago by solj

Replying to https://www.google.com/accounts/o8/id?id=AItOawlP6DRBvIJ7NLpLWILbgzURvGbMtGEyd8U:

Thanks! This solves the reported problem, but if the interface to listen on is not specified, the server now listens only on the loopback interface. I guess that's not desired.

Yeah, this will need to be a workaround until we can add an option for this. We may have cases where we want the server to listen on all available interfaces also so we need to add an option for that case.

comment:4 Changed 10 years ago by https://www.google.com/accounts/o8/id?id=AItOawlP6DRBvIJ7NLpLWILbgzURvGbMtGEyd8U

IMO, such an option isn't really needed, as the current behavior of listening on all available interfaces by default is perfectly fine. My suggestion would be to change the patch to listen on all interfaces unless the user explicitly specified a URL via the bcfg2 option in the [components] section (or via the -S flag on the command line).

comment:5 Changed 10 years ago by solj

  • Status changed from accepted to closed
  • Resolution set to fixed

Added this in 5a31e049ee342ec5874447796bc3978310306afb. The server can now listen either on a specific interface or all interfaces.

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.