Re: Transferring ownership of SSH connection from process A to B, letting A quit nicely?

2021-08-08 Thread Philip Guenther
On Sun, Aug 8, 2021 at 10:13 AM mid  wrote:
...

> I have tried sending the file descriptors associated with the connection
> to process B via sendmsg, thinking that maybe the
> file descriptors are reference-counted. It's a logical
> assumption, but it didn't work - the connection closed with
> process A.
>

File descriptors sent via sendmsg() on a unix domain socket of SCM_RIGHTS
control messages *are* reference-counted.

If you think you've done that and it's not behaving as expected, then first
check and report errors on *all* the system calls, and that the returned
data fields on things like recvmsg() have the values you expect.  If
sendmsg() is failing or you're accidentally discarding the fds in the
recvmsg() by not providing the space needed then yeah, the fds will be
closed because the last reference is gone.

If you're 100% sure you have it right, then it should be easy to provide a
program that demonstrates
1) passing an fd between processes
2) using it *successfully* in the receiving process
3) the sending process exiting
3) attempts to us it failing the receiving process

No?


Philip

(Replies not on the list will be deleted)


Re: Azure VMs

2021-08-08 Thread Brian Brombacher



> On Aug 8, 2021, at 9:15 PM, Steven Shockley  
> wrote:
> 
> Does anyone know if OpenBSD still works in Azure?  I found the docs on 
> uploading a VM, but they cover OpenBSD 6.1.  I also found 
> https://github.com/Azure/WALinuxAgent/issues/1360, where someone was trying 
> to use 6.3 and unable to get networking functional.  (The report was closed 
> as wontfix/unsupported.)
> 
> I just wanted to see if anyone was using a recent version of OpenBSD in Azure 
> before I drop a lot of time on it.  Thanks.
> 

I’ve been running in Azure since Hyper-V drivers were added years ago.  Works 
great.



Azure VMs

2021-08-08 Thread Steven Shockley
Does anyone know if OpenBSD still works in Azure?  I found the docs on 
uploading a VM, but they cover OpenBSD 6.1.  I also found 
https://github.com/Azure/WALinuxAgent/issues/1360, where someone was 
trying to use 6.3 and unable to get networking functional.  (The report 
was closed as wontfix/unsupported.)


I just wanted to see if anyone was using a recent version of OpenBSD in 
Azure before I drop a lot of time on it.  Thanks.




Transferring ownership of SSH connection from process A to B, letting A quit nicely?

2021-08-08 Thread mid
Hello. I have an interesting conundrum I'm dealing with, and
would like some ideas on getting it to work.

I'm making a useless service for recreational purposes,
and it involves holding many SSH connections at once. Ideally
said service should be composed of only one process, accepting multiple 
clients, since they interact with each other in (mostly)
real-time, unlike a typical web server.

But because of how SSH works, each connection sits behind yet
another process. I'd have to employ some IPC for it to work,
but would end up making it a lot less scalable. What I wanted was
so that each connection would invoke the SSH shell (process A),
and said shell would somehow pass ownership of the connection
to the main server process (process B). Afterwards, process A
could safely exit, leaving the SSH connection intact. This would
mean process B would be in charge of multiple SSH connections.

I have tried sending the file descriptors associated with the connection to 
process B via sendmsg, thinking that maybe the
file descriptors are reference-counted. It's a logical
assumption, but it didn't work - the connection closed with
process A.

I have also tried opening a /dev/ttyp* file corresponding to the connection, 
but that didn't work either. So is this not possible under OpenBSD's semantics?

Scalability is not a real issue, but having IPC adds a load
of complexity I'd rather not get involved with.

Thanks.



libusb1 and Yoctopuce USB sensors

2021-08-08 Thread Julian Smith
I've been trying to get a yoctopuce (https://www.yoctopuce.com/) USB
sensor to work on OpenBSD, but have run into problems.

The sensor has Linux code
(https://github.com/yoctopuce/yoctolib_cpp.git) that uses libusb, but
on OpenBSD using the libusb1 package, libusb_kernel_driver_active() and
libusb_detach_kernel_driver() are returning error code -12
(LIBUSB_ERROR_NOT_SUPPORTED).

I found some rather old advice saying that these errors can be
ignored (https://github.com/apple/cups/issues/4088), but then i get an
error -12 from libusb_submit_transfer().

I notice that 'pkg_info -R libusb1' shows just 9 ports depend on
libusb1, so i'm wondering whether the libusb1 port is expected to work
generally on OpenBSD, or whether it be better to try to use the usb(4)
ioctl API?

Thanks for any advice,

- Jules

-- 
http://op59.net