Commit 056a1342 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge branch 'trac213-incremental-families' into trac213-incremental

parents 1db4e8af 6d2960ff
......@@ -270,8 +270,15 @@ During the startup process, a number of messages are exchanged between the
Boss process and the processes it starts. This error is output when a
message received by the Boss process is not recognised.
% BIND10_START_AS_NON_ROOT starting %1 as a user, not root. This might fail.
The given module is being started or restarted without root privileges.
% BIND10_START_AS_NON_ROOT_AUTH starting b10-auth as a user, not root. This might fail.
The authoritative server is being started or restarted without root privileges.
If the module needs these privileges, it may have problems starting.
Note that this issue should be resolved by the pending 'socket-creator'
process; once that has been implemented, modules should not need root
privileges anymore. See tickets #800 and #801 for more information.
% BIND10_START_AS_NON_ROOT_RESOLVER starting b10-resolver as a user, not root. This might fail.
The resolver is being started or restarted without root privileges.
If the module needs these privileges, it may have problems starting.
Note that this issue should be resolved by the pending 'socket-creator'
process; once that has been implemented, modules should not need root
......
......@@ -246,8 +246,6 @@ class BoB:
self.cfg_start_resolver = False
self.cfg_start_dhcp6 = False
self.cfg_start_dhcp4 = False
self.started_auth_family = False
self.started_resolver_family = False
self.curproc = None
self.dead_processes = {}
self.msgq_socket_file = msgq_socket_file
......@@ -313,28 +311,20 @@ class BoB:
# Now we declare few functions used only internally here. Besides the
# benefit of not polluting the name space, they are closures, so we
# don't need to pass some variables
def start_stop(name, started, start, stop):
if not'start_' + name in new_config:
return
if new_config['start_' + name]:
if not started:
if self.uid is not None:
logger.info(BIND10_START_AS_NON_ROOT, name)
def start_stop(name, start, stop):
if 'start_' + name in new_config:
if new_config['start_' + name]:
start()
else:
stop()
else:
stop()
# These four functions are passed to start_stop (smells like functional
# programming little bit)
def resolver_on():
self.component_config['b10-resolver'] = { 'kind': 'needed',
'special': 'resolver' }
self.__propagate_component_config(self.component_config)
self.started_resolver_family = True
def resolver_off():
if 'b10-resolver' in self.component_config:
del self.component_config['b10-resolver']
self.__propagate_component_config(self.component_config)
self.started_resolver_family = False
def auth_on():
self.component_config['b10-auth'] = { 'kind': 'needed',
'special': 'auth' }
......@@ -344,8 +334,6 @@ class BoB:
'special': 'xfrin' }
self.component_config['b10-zonemgr'] = { 'kind': 'dispensable',
'address': 'Zonemgr' }
self.__propagate_component_config(self.component_config)
self.started_auth_family = True
def auth_off():
if 'b10-zonemgr' in self.component_config:
del self.component_config['b10-zonemgr']
......@@ -355,15 +343,13 @@ class BoB:
del self.component_config['b10-xfrout']
if 'b10-auth' in self.component_config:
del self.component_config['b10-auth']
self.__propagate_component_config(self.component_config)
self.started_auth_family = False
# The real code of the config handler function follows here
logger.debug(DBG_COMMANDS, BIND10_RECEIVED_NEW_CONFIGURATION,
new_config)
start_stop('resolver', self.started_resolver_family, resolver_on,
resolver_off)
start_stop('auth', self.started_auth_family, auth_on, auth_off)
start_stop('resolver', resolver_on, resolver_off)
start_stop('auth', auth_on, auth_off)
self.__propagate_component_config(self.component_config)
answer = isc.config.ccsession.create_answer(0)
return answer
......@@ -658,6 +644,8 @@ class BoB:
"""
Start the Authoritative server
"""
if self.uid is not None and self.__started:
logger.warn(BIND10_START_AS_NON_ROOT_AUTH)
authargs = ['b10-auth']
if self.nocache:
authargs += ['-n']
......@@ -675,6 +663,8 @@ class BoB:
are pure speculation. As with the auth daemon, they should be
read from the configuration database.
"""
if self.uid is not None and self.__started:
logger.warn(BIND10_START_AS_NON_ROOT_RESOLVER)
self.curproc = "b10-resolver"
# XXX: this must be read from the configuration manager in the future
resargs = ['b10-resolver']
......@@ -757,7 +747,6 @@ class BoB:
if self.cfg_start_resolver:
component_config['b10-resolver'] = { 'kind': 'needed',
'special': 'resolver' }
self.started_resolver_family = True
self.__propagate_component_config(component_config)
# Everything after the main components can run as non-root.
......@@ -776,7 +765,6 @@ class BoB:
component_config['b10-zonemgr'] = { 'kind': 'dispensable',
'address': 'Zonemgr' }
self.__propagate_component_config(component_config)
self.started_auth_family = True
# ... and finally start the remaining processes
component_config['b10-stats'] = { 'kind': 'dispensable',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment