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

[stale] add OpenBSD support for generating the machine id if /etc/machine-id … #712

Closed
wants to merge 3 commits into from

Conversation

rnagy
Copy link
Contributor

@rnagy rnagy commented Mar 22, 2021

…is unavailable

use the hw.uuid sysctl on openbsd to get the hardware UUID in case /etc/machine-id
is not available because /proc is linux-only

…is unavailable

use the hw.uuid sysctl on openbsd to get the hardware UUID in case /etc/machine-id
is not available because /proc is linux-only
outside of linux GNU make is usually called gmake so let's
allow overriding the MAKE variable from the environment
@AlteredCoder
Copy link
Contributor

Hello @rnagy , thanks for your contribution!

Can you also push the go.mod please ? The CI failed because of this i think :/

@rnagy
Copy link
Contributor Author

rnagy commented Mar 22, 2021

The go.mod I have has no diffs to the one in HEAD.

@AlteredCoder
Copy link
Contributor

Do you have a link to the documentation of the syscall module that you use ?
In the official documentation (https://golang.org/pkg/syscall/) , the Sysctl function doesn't exist.
What is your go version also please ?

@rnagy
Copy link
Contributor Author

rnagy commented Mar 22, 2021

go version go1.15.2 openbsd/amd64

Anyway it seems that syscall is deprecated, so let me get back to you with another solution.

@AlteredCoder
Copy link
Contributor

Ok @rnagy , thanks !

@@ -21,6 +22,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
"golang.org/x/sys/unix"

Choose a reason for hiding this comment

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

T

Copy link
Contributor Author

Choose a reason for hiding this comment

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

?

Copy link
Contributor

Choose a reason for hiding this comment

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

@rnagy : I reported @cuddytrippin for spam on other issues as well :/

@AlteredCoder
Copy link
Contributor

@rnagy it seems that the build still doesn't work :/, let me know if you need any help on this

@sbz
Copy link
Contributor

sbz commented Mar 25, 2021

The library used for getting the host uuid machineid does not support OpenBSD yet, I'm suggesting instead of patching crowdsec to provide the OpenBSD support in machineid

Currently machineid for the 'BSD' use /etc/hostid which is valid on FreeBSD and fallback using kenv which is not available on OpenBSD. I propose you add for OpenBSD the following:

Read from /etc/machine-id if it exists as proposed by issues#9 and fallback using sysctl hw.uuid like that the usage of machine.ID() call should be able to handle the OpenBSD case 🤝

The fallback strategy is implemented here for the BSD in machineid

For the context, I started to do the same patch with https://gist.github.com/sbz/3c23c52d6817246b3682922944a9c3ba but I realized after it's not needed.

@rnagy
Copy link
Contributor Author

rnagy commented Mar 26, 2021

The library used for getting the host uuid machineid does not support OpenBSD yet, I'm suggesting instead of patching crowdsec to provide the OpenBSD support in machineid

Currently machineid for the 'BSD' use /etc/hostid which is valid on FreeBSD and fallback using kenv which is not available on OpenBSD. I propose you add for OpenBSD the following:

Read from /etc/machine-id if it exists as proposed by issues#9 and fallback using sysctl hw.uuid like that the usage of machine.ID() call should be able to handle the OpenBSD case

The fallback strategy is implemented here for the BSD in machineid

For the context, I started to do the same patch with https://gist.github.com/sbz/3c23c52d6817246b3682922944a9c3ba but I realized after it's not needed.

That project seems dead, but it is worth a try... i've submitted a pull request. This ecosystem is really not good.

@AlteredCoder
Copy link
Contributor

Hello @rnagy , we will wait to see if they accept your PR. If not, we will integrate those changes in crowdsec

@AlteredCoder
Copy link
Contributor

Hello @rnagy , your PR in the machineid project is still pending .. If it still the case at the end of the week, we will add your code to crowdsec directly next week.

@rnagy
Copy link
Contributor Author

rnagy commented May 3, 2021

Hello @rnagy , your PR in the machineid project is still pending .. If it still the case at the end of the week, we will add your code to crowdsec directly next week.

What if I fork that project and then you can point the build system to use that repo?

@AlteredCoder
Copy link
Contributor

Hello @rnagy, sorry for the delay

Yes that might be a good idea :)

@buixor buixor changed the title add OpenBSD support for generating the machine id if /etc/machine-id … [deprecated] add OpenBSD support for generating the machine id if /etc/machine-id … Jan 20, 2022
@buixor buixor changed the title [deprecated] add OpenBSD support for generating the machine id if /etc/machine-id … [stale] add OpenBSD support for generating the machine id if /etc/machine-id … Jan 20, 2022
@buixor buixor closed this Feb 14, 2022
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