-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[master] Prevent "_pygit2.GitError: error loading known_hosts" in some libgit2 versions. #64510
[master] Prevent "_pygit2.GitError: error loading known_hosts" in some libgit2 versions. #64510
Conversation
ad10be0
to
5ba38b8
Compare
85bc0c9
to
0cd6edc
Compare
@@ -1939,6 +1940,10 @@ def _fetch(self): | |||
# pruning only available in pygit2 >= 0.26.2 | |||
pass | |||
try: | |||
# Make sure $HOME env variable is set to prevent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're modifying the environment anyway can we do it higher up in the stack? Maybe when we run verify_user
?
Hey @Ch3LL, sorry for the delay here. We have noticed that, bringing the user switching that early on the stack is actually causing "Authentication denied" errors when you have configured So still a bit more time needs to be invested here to fix this other problem. Let see if we find some time in the following days. In any case, the initial patch to fix the "pygit2" problem that motivated this PR seems to be working fine: 46e6ba3 |
K thanks for the update. We are trying to tag the first 3007 RC next week sometime, so keep me updated on what you where able to find about the authentication denied error. |
@dwoz @Ch3LL it seems switching the user for "salt-master" that early on the stack is actually causing problems with "publisher_acl". In a nutshell, "salt-master" needs to run as "root" during startup, and then it will switch to the configured user at some point during the startup. We cannot set "salt-master" systemd unit with The initial fix that motivated this PR was about setting So, in order to fix the situation that is currently breaking the "gitfs" integration, maybe I would suggest to just introduce the initial fix, without doing the switch of the user and just setting the What is your take here? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot assume 'salt' as the user in the systemd service files
@@ -8,6 +8,7 @@ LimitNOFILE=100000 | |||
Type=notify | |||
NotifyAccess=all | |||
ExecStart=/usr/bin/salt-master | |||
User=salt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this accomodate users which don't use 'salt' as the user, I know of one large customer who uses a different name for the user.
Assuming salt is incorrect and have already had to fix that assumption for log rotation.
Question then is when will the value for 'User' get set, since have to read the configuration file etc. to know what user is set to, and then update the systemd service file, which is part of the install process, so installed before configuration read. Implies a need to update service file and restart with the new value, and additional checks in case the user changes the configuration value for 'user' too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will cause issues with people using the 'root' user for pam auth funtionality
@@ -7,6 +7,7 @@ LimitNOFILE=16384 | |||
Type=notify | |||
NotifyAccess=all | |||
ExecStart=/usr/bin/salt-master | |||
User=salt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above
@@ -8,6 +8,7 @@ LimitNOFILE=100000 | |||
Type=simple | |||
ExecStart=/usr/bin/salt-master | |||
TasksMax=infinity | |||
User=salt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above
I'm closing this PR for now, as commented on #64510 (comment), in favor of this other PR: #67186 (which is tackling the initial issue that motivated this PR) |
What does this PR do?
This PR should fix a problem that happens in some libgit2 versions, where there is an strict check for ssh "known_hosts" done by the "libgit2" library, in the context of fixing a CVE issue:
libgit2/libgit2@42e5db9
We noticed this CVE fix has been backported to older "libgit2" versions in some distributions.
Without the fix on this PR, we see
_pygit2.GitError: error loading known_hosts
errors when dealing with git ssh repositories.What issues does this PR fix or reference?
Fixes: #64121
Previous Behavior
There are gitfs errors we can see in the Salt master logs.
New Behavior
There are no errors in Salt master logs and gitfs works as expected.
Merge requirements satisfied?
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.