[tacacs]: fix /etc/nsswitch.conf for buster image (#4303)
in buster image, default /etc/nsswitch.conf becomes ``` passwd: files ``` when tacacs is enable, this files changes to ``` passwd: tacplus files ```
This commit is contained in:
parent
1038182f3d
commit
3c6f23e7b7
@ -207,10 +207,10 @@ class AaaCfg(object):
|
||||
# Add tacplus in nsswitch.conf if TACACS+ enable
|
||||
if 'tacacs+' in auth['login']:
|
||||
if os.path.isfile(NSS_CONF):
|
||||
self.modify_single_file(NSS_CONF, [ "'/tacplus/b'", "'/^passwd/s/compat/tacplus &/'"])
|
||||
self.modify_single_file(NSS_CONF, [ "'/tacplus/b'", "'/^passwd/s/compat/tacplus &/'", "'/^passwd/s/files/tacplus &/'" ])
|
||||
else:
|
||||
if os.path.isfile(NSS_CONF):
|
||||
self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //'" ])
|
||||
self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //g'" ])
|
||||
|
||||
# Set tacacs+ server in nss-tacplus conf
|
||||
template_file = os.path.abspath(NSS_TACPLUS_CONF_TEMPLATE)
|
||||
|
Loading…
Reference in New Issue
Block a user