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

Add root/admin user warning #693

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

NoahvdAa
Copy link
Member

@NoahvdAa NoahvdAa commented Sep 30, 2021

This PR ports the root detection introduced in PaperMC/Paper#2432 (and re-added in PaperMC/Paper#6593) to Waterfall. The implementation used in PaperMC/Paper#6593 doesn't seem to work on Java 8, so I've used a slightly different check.

Tested on macOS and Windows 10.

@NoahvdAa NoahvdAa changed the title Feature/root detection Add root/admin user detection Sep 30, 2021
@NoahvdAa NoahvdAa marked this pull request as draft October 2, 2021 15:41
@NoahvdAa NoahvdAa marked this pull request as ready for review October 2, 2021 18:28
+ private static final boolean RUNNING_AS_ROOT_OR_ADMIN;
+
+ static {
+ boolean isWindows = System.getProperty("os.name").startsWith("Windows");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs 😢

Does this implement the fixed check from the new PR?

Copy link
Member Author

@NoahvdAa NoahvdAa Oct 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java 8 (or at least in Waterfall's setup) doesn't seem to like the NTSystem/UnixSystem classes, so I used the "running a command" method from the start, so this isn't affected by the OpenJDK bug.

@NoahvdAa NoahvdAa requested a review from Chew October 9, 2021 10:26
@NoahvdAa NoahvdAa changed the title Add root/admin user detection Add root/admin user warning Feb 11, 2022
@xism4
Copy link
Contributor

xism4 commented Feb 1, 2023

This PR ports the root detection introduced in PaperMC/Paper#2432 (and re-added in PaperMC/Paper#6593) to Waterfall. The implementation used in PaperMC/Paper#6593 doesn't seem to work on Java 8, so I've used a slightly different check.

Tested on macOS and Windows 10.

I think this is useless, since most people don't have access to SSH, and those who do have access already have some experience, it seems to me that adding a warning for that is redundant.

@Janmm14
Copy link
Contributor

Janmm14 commented Feb 2, 2023

This PR ports the root detection introduced in PaperMC/Paper#2432 (and re-added in PaperMC/Paper#6593) to Waterfall. The implementation used in PaperMC/Paper#6593 doesn't seem to work on Java 8, so I've used a slightly different check.
Tested on macOS and Windows 10.

I think this is useless, since most people don't have access to SSH, and those who do have access already have some experience, it seems to me that adding a warning for that is redundant.

It is not redundant. I believe many people running a server network do have a vserver/vps or root server rented, because they're often cheaper compared to multiple single mc servers.

@Outfluencer
Copy link

Outfluencer commented Feb 23, 2024

I dont like the way you doing it i would use io.netty.util.internal.PlatformDependent#maybeSuperUser() instead if your reg check and creating processes, this should be enought

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants