Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcb_(un)convert: Check for UID and EUID to be 0 before proceeding. #32

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2024-12-22 Björn Esser <besser82 at fedoraproject.org>

tcb_(un)convert: Check for UID and EUID to be 0 before proceeding.
Ensuring the program is run with root privileges on startup is the
safer approach instead on relying that mode 0700 may prevent the
tool being run by a regular system user.
* progs/tcb_convert.c (main): Check for UID and EUID to be 0 before
proceeding.
* progs/tcb_unconvert.c (main): Likewise.

2024-12-20 Björn Esser <besser82 at fedoraproject.org>

libnss_tcb: Disallow potentially-malicious user names in getspnam(3).
Expand Down
5 changes: 5 additions & 0 deletions progs/tcb_convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ int main(void)
{
int status;

if (getuid() || geteuid()) {
fprintf(stderr, "Only root can do this!\n");
return 1;
}

if (lckpwdf()) {
perror("lckpwdf");
return 1;
Expand Down
5 changes: 5 additions & 0 deletions progs/tcb_unconvert.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ int main(void)
gid_t sysgid;
int status;

if (getuid() || geteuid()) {
fprintf(stderr, "Only root can do this!\n");
return 1;
}

gr = getgrnam("sys");
if (!gr) {
fprintf(stderr, "\"sys\" group not found.\n");
Expand Down
Loading