Skip to content

fix macos drop privs #231

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

Merged
merged 1 commit into from
Mar 7, 2022
Merged

Conversation

phillyqueso
Copy link
Contributor

fixes #205

references:

@Noah-Kennedy
Copy link
Collaborator

@phillyqueso run cargo fmt

@Noah-Kennedy
Copy link
Collaborator

@phillyqueso so I have good news and bad news. The good news is that we fixed the CI issues on the master branch, and all you need to do here is merge in those changes. The bad news is that there are some mean merge conflicts here, as we just split the crate into a workspace, which should have been done long ago.

@phillyqueso
Copy link
Contributor Author

@phillyqueso so I have good news and bad news. The good news is that we fixed the CI issues on the master branch, and all you need to do here is merge in those changes. The bad news is that there are some mean merge conflicts here, as we just split the crate into a workspace, which should have been done long ago.

No problem @Noah-Kennedy! I'll rebase and push the fix soon.

Copy link
Collaborator

@Noah-Kennedy Noah-Kennedy left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@Noah-Kennedy Noah-Kennedy merged commit 8116a15 into cloudflare:master Mar 7, 2022
return Err(Error::DropPrivileges("NULL from getlogin".to_owned()));
#[cfg(target_os = "macos")]
{
let uname: &'static str = env!("USER");
Copy link

Choose a reason for hiding this comment

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

env!() retrieves the environment variable at compile time, is it expected? If I compile the code in one user, and use the binary in another user(or machine), the behavior is incorrect.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ahh crap, thanks for catching this.

Copy link
Collaborator

@Noah-Kennedy Noah-Kennedy Jul 19, 2022

Choose a reason for hiding this comment

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

I'll open up a PR after I eat breakfast.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, next time, it's much easier to track this if you create an issue to track the problem.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed

Noah-Kennedy added a commit that referenced this pull request Jul 19, 2022
…to get user

In #231 we accidentally started using a compile-time environment environment variable instead of a runtime one for dropping privileges on macos. This causes privilege drops to fail when the user who is running the program does not have the same username as the user who compiled the program.

The solution here is to use the runtime variable instead.
Noah-Kennedy added a commit that referenced this pull request Jul 19, 2022
… drop privileges (#297)

In #231 we accidentally started using a compile-time environment environment variable instead of a runtime one for dropping privileges on macos. This causes privilege drops to fail when the user who is running the program does not have the same username as the user who compiled the program.

The solution here is to use the runtime variable instead.
arvydasv pushed a commit to NordSecurity/boringtun that referenced this pull request Aug 1, 2023
arvydasv pushed a commit to NordSecurity/boringtun that referenced this pull request Aug 1, 2023
… drop privileges (cloudflare#297)

In cloudflare#231 we accidentally started using a compile-time environment environment variable instead of a runtime one for dropping privileges on macos. This causes privilege drops to fail when the user who is running the program does not have the same username as the user who compiled the program.

The solution here is to use the runtime variable instead.
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.

Not dropping root privileges running on macOS 11.6.1
3 participants