mount_ntfs(8) -u/-g problem?

2022-08-17 Thread Michael W. Lucas
Hi,

I'm running:

OpenBSD victim.blackhelicopters.org 7.2 GENERIC.MP#640 amd64

According to mount_ntfs(8), -u and -g let you set UID and GID of
mounted filesystems. Took an NTFS USB drive, plugged it in, mounted
it, and checked ownership.

# mount_ntfs -u mwlucas -g mwlucas /dev/sd4i /mnt/
# ls -lai /mnt/
total 107
 4 -rwxr-xr-x   1 root  wheel   2560 Dec 31  1600 $AttrDef
 8 -rwxr-xr-x   1 root  wheel  0 Dec 31  1600 $BadClus
 6 -rwxr-xr-x   1 root  wheel  32768 Dec 31  1600 $Bitmap
 7 -rwxr-xr-x   1 root  wheel  0 Dec 31  1600 $Boot
11 drwxr-xr-x   1 root  wheel  0 Aug 17 15:05 $Extend
 2 -rwxr-xr-x   1 root  wheel  0 Dec 31  1600 $LogFile
 1 -rwxr-xr-x   1 root  wheel  0 Dec 31  1600 $MFTMirr
 9 -rwxr-xr-x   1 root  wheel  0 Aug 17 15:05 $Secure
10 -rwxr-xr-x   1 root  wheel 131072 Dec 31  1600 $UpCase
 3 -rwxr-xr-x   1 root  wheel  0 Dec 31  1600 $Volume
 5 drwxr-xr-x   1 root  wheel  0 Dec 31  1600 .
 2 drwxr-xr-x  15 root  wheel512 Aug 16 13:02 ..
36 drwxr-xr-x   1 root  wheel  0 Aug 17 15:05 System Volume Information
38 -rwxr-xr-x   1 root  wheel  111496224 Aug 17 13:35 
VirtualBox-6.1.36-152435-Win.exe

If I create /tmp/mnt owned by mwlucas:mwlucas and mount there,
ownership of the mount point is changed to root:wheel and the files
are owned by root.

# chown mwlucas:mwlucas /tmp/mnt
ls -lai /tmp/
total 1
 2 drwxrwxrwt   9 root wheel   512 Aug 17 15:42 .
 2 drwxr-xr-x  15 root wheel   512 Aug 16 13:02 ..
 25920 drwxrwxrwt   2 root wheel   512 Aug 16 13:02 .ICE-unix
388800 drwxrwxrwt   2 root wheel   512 Aug 16 13:02 .X11-unix
 77760 drwxr-xr-x   2 mwlucas  mwlucas 512 Aug 17 15:42 mnt
259200 drwxr-xr-x   2 root wheel   512 Aug 16 13:02 sndio
...

# mount_ntfs -u mwlucas -g mwlucas /dev/sd4i /tmp/mnt/

# ls -lai /tmp/mnt/
total 107
 4 -rwxr-xr-x  1 root  wheel   2560 Dec 31  1600 $AttrDef
 8 -rwxr-xr-x  1 root  wheel  0 Dec 31  1600 $BadClus
 6 -rwxr-xr-x  1 root  wheel  32768 Dec 31  1600 $Bitmap
 7 -rwxr-xr-x  1 root  wheel  0 Dec 31  1600 $Boot
11 drwxr-xr-x  1 root  wheel  0 Aug 17 15:05 $Extend
...

Am I doing something wrong here, or did I find a bug?

FWIW, mount_msdos -u and -g assigns ownership.

Thanks,
==ml



-- 
Michael W. Lucashttps://mwl.io/
author of: Absolute OpenBSD, SSH Mastery, git commit murder,
 Absolute FreeBSD, Immortal Clay, Prohibition Orcs, etc, etc, etc...
### New books: TLS Mastery, the Networknomicon, $ git sync murder ###



Re: [WIP PATCH] relayd: check for any certificate before inheriting default

2022-08-17 Thread Josuah Demangeon
Josuah Demangeon  wrote:
> I think I found a bug in relayd, but maybe I misunderstood
> how to configure it:

If I duplicate each "relay { ... }" section instead of using
two "listen on" within the same "relay", it works.

It suggests that there is indeed something fishy with the
relay having two "listen on".



[WIP PATCH] relayd: check for any certificate before inheriting default

2022-08-17 Thread Josuah Demangeon
Hello!

I think I found a bug in relayd, but maybe I misunderstood
how to configure it:

Bug reproduced (with a cert setup) as below:

$ cat /etc/relayd.conf:
table <"http"> { 127.0.0.1 }
http protocol "https" {
tls keypair "lap1.josuah.net"
}
relay "https" {
listen on 127.0.0.1 port 443 tls
listen on ::1 port 443 tls
protocol "https"
forward to <"http"> port 80 check tcp
}

$ ktrace relayd -dvv # without the patch applied
 ...
 87874 relayd   CALL  open(0x7f7e76d0,0)
 87874 relayd   NAMI  "/etc/ssl/::1:443.crt"
 87874 relayd   RET   open -1 errno 2 No such file or directory
 87874 relayd   CALL  open(0x7f7e76d0,0)
 87874 relayd   NAMI  "/etc/ssl/::1.crt"
 87874 relayd   RET   open -1 errno 2 No such file or directory
 ...

The second "listen" block inherit its configuration from the
first, and /etc/ssl/::1.crt as certificate instead of the
keypair list.

Although, even with the patch it does not work on the extra
listen address (the one replicated):

$ openssl s_client -connect ::1:443 -servername lap1.josuah.net
CONNECTED(0003)
5110093530528:error:1400A410:SSL routines:CONNECT_CR_CERT_REQ:sslv3 alert 
handshake failure:/usr/src/lib/libssl/tls13_lib.c:129:SSL alert number 40
---
no peer certificate available

If anyone has an idea on how to allow multiple listen
as shown in the example, I am interested.


The patch:

Check that there are no certificates in the keypair list
before searching the default /etc/ssl/$address.crt
certificate.

Index: src/usr.sbin/relayd/parse.y
===
RCS file: /cvs/src/usr.sbin/relayd/parse.y,v
retrieving revision 1.253
diff -u -r1.253 parse.y
--- src/usr.sbin/relayd/parse.y 15 Oct 2021 15:01:28 -  1.253
+++ src/usr.sbin/relayd/parse.y 17 Aug 2022 11:52:34 -
@@ -3421,7 +3421,8 @@
goto err;
}

-   if (relay_load_certfiles(conf, rb, NULL) == -1) {
+   if (TAILQ_EMPTY(>rl_proto->tlscerts) &&
+   relay_load_certfiles(conf, rb, NULL) == -1) {
yyerror("cannot load certificates for relay %s",
rb->rl_conf.name);



Re: USB mic no audio

2022-08-17 Thread Alexandre Ratchov
On Tue, Aug 16, 2022 at 05:44:29PM -0700, Courtney wrote:
> 
> $ sndiod -dd -f rsnd/2
...
> snd0: 48000Hz, s24le3, play 0:1, rec 0:0, 16 blocks of 480 frames
> snd0: device started

This appears to be a play-only device, so recording can't work,
probably USB attach order has changed. I'd suggest starting with
sndiod defaults (it configures first four devices) and using the
"sndioctl server.device" control to switch to the device with
recording capability (depend on device attach order).

Note that record-only and play-only devices can't be combined and used
as a single full-duplex device yet (see mailing list archives for more
details and workarounds).