You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
radvd can be even simpler and just ask for something else to create the raw socket and pass it in. No need for capabilities or root as far as opening an ICMP socket is concerned.
Example of how to use new parameter, this program would have the raw capabilities bit set on its program. This would bypass the need for radvd to run as root or drop capabilities. Ideally of course the path to radvd should be hard code but definitely out of scope.
Do note - we still would get complaints about not being able to write to proc file system. My thoughts are either turn that off in this situation or provide some sort of way to out source the action to an external program or script sort of like how dhclient can invoke an external script.
#include "../../includes.h"
int main(int argc, char** args) {
if (argc < 2) {
fprintf(stderr, "expects at least one argument, path to radvd\r\n");
fflush(stderr);
return -1;
}
int sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
char** radvd_args = malloc(sizeof(char**) * argc + 1);
for (int i = 0; i < argc - 1; i++) {
radvd_args[i] = args[i + 1];
}
fflush(stdout);
char* fd_str = malloc(255 * sizeof(char));
radvd_args[argc - 1] = fd_str;
radvd_args[argc] = NULL;
sprintf(fd_str, "--fd=%d", sock);
execv(args[1], radvd_args);
fprintf(stderr, "failed to start program\r\n");
fflush(stderr);
return 1;
}
Followup to #165 where the users want to start radvd as non-root, and still have it further drop capabilities.
The text was updated successfully, but these errors were encountered: