Compare commits

...

2 Commits

Author SHA1 Message Date
1f5a371c38 add role to nsd.cadoles.com 2021-05-24 09:06:43 +02:00
c6aed1043d force config_file creation if not exists 2021-05-24 08:38:05 +02:00
2 changed files with 15 additions and 7 deletions

View File

@ -25,6 +25,10 @@ cucchiaiata-cli v1.user.role.create --user_login gnunux \
--role_name 'server_rw' \
--role_attribute 'Server.ServerName' \
--role_attribute_value dns.cadoles.com
cucchiaiata-cli v1.user.role.create --user_login gnunux \
--role_name 'server_rw' \
--role_attribute 'Server.ServerName' \
--role_attribute_value nsd.cadoles.com
# Zone
# +~~~~~~~~~~+

View File

@ -33,7 +33,7 @@ def setting_pki_openssh_client(dico, config):
add = new - current
modify = [key for key in new if key in current and current_data[key] != new_data[key]]
if add or modify:
print(f'\n\nModifications suggérées de la section "Host {hostname}"du fichier "{config_file}" :')
print(f'\n\nModifications suggérées de la section "Host {hostname}" du fichier "{config_file}" :')
for line in add:
value = new_data[line]
if isinstance(value, list):
@ -43,17 +43,21 @@ def setting_pki_openssh_client(dico, config):
value = new_data[line]
if isinstance(value, list):
value = ','.join(value)
print(f' - modifier "{line} {value}"')
print(f' - modifier "{line} {current_data[line]}" en "{line} {value}"')
print('\n')
else:
print(f'\n\nIl faudrait créer le fichier "{config_file}" :')
print(f'Host {hostname}')
if not isdir(config_dir):
makedirs(config_dir, 0o700)
fh = os_open(config_file, O_WRONLY | O_CREAT, 0o400)
truncate(fh, 0)
write(fh, f'Host {hostname}\n'.encode())
for key, value in new_data.items():
if key == 'hostname':
continue
print(f' {key} {value}')
if not isdir(config_dir):
makedirs(config_dir, 0o700)
if isinstance(value, list):
value = ','.join(value)
write(fh, f' {key} {value}\n'.encode())
close(fh)
fh = os_open(f'{identityfile}.pub', O_WRONLY | O_CREAT, 0o400)
truncate(fh, 0)
write(fh, dico['certificate'].encode())