Add support for admin/admin to manage Infix as group 'wheel'

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-05-15 12:53:32 +02:00
parent 304e65e298
commit f5866ee3d4
3 changed files with 32 additions and 2 deletions
-1
View File
@@ -1,2 +1 @@
admin -1 wheel -1 =admin /home/admin /bin/bash - Administrator
factory -1 wheel -1 =reset - /sbin/factory - Reset to factory defaults
+17 -1
View File
@@ -595,13 +595,29 @@ static int sys_del_user(char *user)
return SR_ERR_OK;
}
/*
* XXX: drop superuser/wheel exception as soon as we have clish-ng in place.
* It is supposed to connect to the netopeer server via 127.0.0.1 so
* that the full NACM applies to the user instead of the file system
* permissions that apply to the current klish.
*/
static int sys_add_new_user(char *name)
{
char *args[] = {
char *sargs[] = {
"adduser", "-D", "-S", "-G", "wheel", name, NULL
};
char *uargs[] = {
"adduser", "-D", name, NULL
};
char **args;
int err;
/* XXX: group mapping to wheel should be done using nacm ACLs instead. */
if (!strcmp(name, "admin"))
args = sargs; /* superuser */
else
args = uargs; /* user */
/**
* The Busybox implementation of adduser -D sets the password to "!",
* which should prevent the new user from logging in until Augeas has
+15
View File
@@ -51,6 +51,21 @@ sr_error_t srx_require_module(sr_conn_ctx_t *conn,
}
}
/*
* XXX: allow admin users access to the same modules as 'root'
*/
if (!err) {
int i;
for (i = 0; i < SR_MOD_DS_PLUGIN_COUNT; i++) {
err = sr_set_module_ds_access(conn, mr->name, i, "root", "wheel", 0660);
if (err) {
ERROR("Failed setting group 'wheel' permissions on %s", mr->name);
err = 0;
}
}
}
return err;
}