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

Auth failure on FreeBSD #42

Closed
codedmart opened this issue Feb 11, 2020 · 6 comments
Closed

Auth failure on FreeBSD #42

codedmart opened this issue Feb 11, 2020 · 6 comments

Comments

@codedmart
Copy link

I use this package in various Linux distros, and have no problems, but when using it in FreeBSD I get

*** Exception: SocketError {socketErrorMessage = "Authentication failed", socketErrorFatal = True, socketErrorAddress = Just (Address "unix:guid=2fb1d926d67497d679a521255e41b85e,path=/tmp/dbus-4vBp0kLUee")}

I am not entirely sure what is going on. If I add some print statements I can see:

"AUTH EXTERNAL 31303031\r\n" <- sent
"REJECTED EXTERNAL" <- returned

The dbus session address is set. I tried connection with packages in python, and go just to be sure. Both of those are able to connect just fine. I don't know go but did notice in the go code there is some calls to UnixCredentials. Have no idea if the Haskell code is doing that for sure, but doesn't seem like it from what I can tell. Any ideas why this is failing on FreeBSD?

@rblaze
Copy link
Owner

rblaze commented Feb 12, 2020

Sorry, I have no clue here, and I have no FreeBSD around. Could you strace a simple test program and see if some syscall is failing?

@codedmart
Copy link
Author

Sure here is some more debugging output. The part I find interesting is this from the go output. Which is the initial null byte sent. The equvilant in the haskell output. In the go one there is this with the initial null byte send ...level=SOL_SOCKET,type=SCM_CREDS... which is what I linked above with the UnixCredentials part. Thanks!

@codedmart
Copy link
Author

I checked python as well. Seems it is sending something similar for the initial null byte:

sendmsg(3,{NULL,0,[{"\0",1}],1,{{level=SOL_SOCKET,type=SCM_CREDS,data={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}},104,0},MSG_NOSIGNAL) = 1 (0x1)

I will keep digging into this.

@codedmart
Copy link
Author

Well I was able to get this working, but it is pretty rough right now. I didn't see currently in the network package the ability to use sendmsg with cmsg which is needed to properly send credentials for the socket. There is a PR open to add this ability to network here. If I am reading things correctly it looks like this isn't needed in Linux because abstract is used rather than path for the unix socket which is why things work correctly there. I ended up using the network-msg package to get this working for me locally, but I am not sure adding that as another dep makes sense if the PR in network lands soon. So feel free to leave open or close and I will follow up when the PR in network lands.

@rblaze
Copy link
Owner

rblaze commented Feb 14, 2020

I think postponing this issue until network catches up is a good idea.

@rblaze
Copy link
Owner

rblaze commented Dec 5, 2020

I see network has new functions merged. Does dbus work on FreeBSD now?

@rblaze rblaze closed this as completed Mar 4, 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

No branches or pull requests

2 participants