httpd: removing italic CSS from directories in directory index

2024-05-29 Thread Paul W . Rankin
Hello,

I very much appreciate the new directory index in httpd. Thank you espie@ :)

I would like to make a suggestion for the default CSS, which is to remove the 
italic styling of directories:

--- /Users/pwr/Downloads/css.h.in.txt~  2024-05-21 12:33:11
+++ /Users/pwr/Downloads/css.h.in.txt   2024-05-21 12:36:08
@@ -18,7 +18,6 @@
tr.sort th::after { content: "\a0\2195"; }
tr.dir td:nth-child(2n+1) { 
  font-weight: bold; 
-font-style: italic; 
}
td, th { padding: 2pt 2em; }
td:first-child, th:first-child { padding-left: 5pt; }

As the CSS is currently “one size fits all”[1] I think it best to keep it 
minimal, and I personally find the italics not aesthetically pleasing, because 
the trailing slash gets pushed up against the last letter.

[1] 
https://cvsweb.openbsd.org/src/usr.sbin/httpd/css.h.in?rev=1.1=text/x-cvsweb-markup

Many thanks,

-- 
Paul W. Rankin
https://www.paulwrankin.com



Re: Daily digest, Issue 5434 (19 messages)

2021-05-14 Thread Paul W. Rankin

Date: Tue, 11 May 2021 12:39:20 - (UTC)
From: Stuart Henderson 
To: misc@openbsd.org
Subject: Re: Editing boot.conf to set tty to fb0 in miniroot69.img
Message-ID: 

On 2021-05-11, Paul W. Rankin  wrote:


...on my OpenBSD server, I tried mounting the miniroot69.img and
altering boot.conf directly:

# vnconfig vnd0 miniroot69.img
# mount /dev/vnd0a /mnt

But this just presents:

# ls -1
bsd
bsd.rd

Does anyone have any suggestion of how I might achieve editing 
boot.conf

on the miniroot69 image or otherwise how to boot the Raspberry Pi 4B
into fb0?


That would go on the booted disk, not inside the ramdisk kernel, so

cd /mnt
mkdir etc
echo set tty fb0 > etc/boot.conf

Pretty sure I tested that scenario and it worked without boot.conf
though I'm not sure if it was with the pftf firmware or U-Boot.


Thank you Stuart, this worked :)
Great to know that an arm64 *can* be booted without access to the serial 
console.




Editing boot.conf to set tty to fb0 in miniroot69.img

2021-05-11 Thread Paul W. Rankin

Hello,

I am trying to install OpenBSD on a Raspberry Pi 4B without the 
assistance of the serial console. The Pi firmware is set to boot from 
USB. I have arm64 miniroot69 on a USB and the system boots; I see the 
"BOOT>" prompt, but my USB keyboard does not appear to be recognised at 
this point in boot, so I cannot interrupt and set tty to fb0. The boot 
then proceeds to the serial console (i.e. blank screen).


The thought occurred that it may be possible to change boot.conf in the 
miniroot69 image to set tty to fb0 but so far my attempts have been 
unsuccessful. I have tried...


...on my macOS system, I tried many variations of the following without 
success:


# qemu-system-aarch64 -machine raspi3 -hda /dev/disk2
# qemu-system-aarch64 -machine virt -hda /dev/disk2
# qemu-system-aarch64 -machine raspi3 -drive 
file=miniroot69.img,format=raw

# qemu-system-aarch64 -machine virt -drive file=/dev/disk2,format=raw

The qemu system just presents a blank screen. Nothing on serial or 
parallel screens.


...on my OpenBSD server, I tried mounting the miniroot69.img and 
altering boot.conf directly:


# vnconfig vnd0 miniroot69.img
# mount /dev/vnd0a /mnt

But this just presents:

# ls -1
bsd
bsd.rd

Does anyone have any suggestion of how I might achieve editing boot.conf 
on the miniroot69 image or otherwise how to boot the Raspberry Pi 4B 
into fb0?


Much thanks,

--
Paul W. Rankin
https://bydasein.com

The single best thing you can do for the world is delete your social 
media accounts.




Re: cgit about-filter in chroot (httpd + slowcgi)

2021-03-31 Thread Paul W. Rankin

On 2021-03-28 19:33, Kristaps Dzonsons wrote:


Instead of downloading, recompiling, and installing lowdown; then
building and installing a program that execs the downloaded lowdown;
why don't you cut out the first step and call through to the C API
installed with the lowdown port?  There's a full example in the
EXAMPLES section of lowdown_file(3).


Sorry Kristaps I didn't see this because I was not previous subscribed 
to the list. Thanks for pointing me in this direction, it does look like 
the optimal approach. At my current point in The C Programming Language 
book the example still looks like Greek to me (I'm not up to structs or 
pointers) but one day...


Thanks!



Re: cgit about-filter in chroot (httpd + slowcgi)

2021-03-28 Thread Paul W. Rankin

On 2021-03-28 18:56, Omar Polo wrote:

Thanks Omar, I like this approach! I'm pretty green to C so this is
what I have (which doesn't work):

#include 
int main(void) {
execl("/bin/lowdown", NULL);
}

There is no HTML render but at least no errors, but cgit expects the
resulting HTML printed to STDOUT, so I wonder whether this requires a
return?


Assuming that the shell script you posted actually works yes, that
snippet (with a small tweak[0]) should work.  Make sure it's statically
linked.

For reference, here's how I would do it

$ cat < my-cgit-filter.c
#include 

int
main(void)
{
execl("/bin/lowdown", "lowdown", NULL);
return 1;
}
EOF
$ cc my-cgit-filter.c -o my-cgit-filter.c -static
$ # check that it's actually statically linked
$ ldd my-cgit-filter
my-cgit-filter:
StartEnd  Type  Open Ref GrpRef Name
05196d856000 05196d87b000 dlib  10   0
/tmp/my-cgit-filter

[0]: if you compile your snippet, clang should warning about a missing
 sentinel, something along the lines of

 > warning: not enough variable arguments in 'execl' declaration to 
fit a

 > sentinel [-Wsentinel]
 >   execl("/bin/lowdown", NULL);

 which should suggest the use of
 >   execl("/bin/lowdown", "lowdown", NULL);


Thank you so much Omar! Making the sentinel change solved it :)



Re: cgit about-filter in chroot (httpd + slowcgi)

2021-03-28 Thread Paul W. Rankin



On 2021-03-28 18:14, Omar Polo wrote:

Paul W. Rankin  writes:

The cgit about-filter doesn't want an executable to do e.g. the
Markdown conversation, rather it wants a script that will return the
command to perform this, e.g.:

#!/bin/sh
case "$1" in
(*.md)  exec /bin/lowdown ;;
(*) exit ;;
esac

This works, i.e. README.md files are converted to HTML, but this
requires copying the sh binary into /var/www/bin, which is the
troubling part.

Is this an acceptable thing to do, security-wise?


I don't know almost anything about cgit, but if that's really the
problem you could statically-link a program that does the above (just a
call to execl("/bin/lowdown", NULL); may be enough) and use that.


Thanks Omar, I like this approach! I'm pretty green to C so this is what 
I have (which doesn't work):


#include 
int main(void) {
execl("/bin/lowdown", NULL);
}

There is no HTML render but at least no errors, but cgit expects the 
resulting HTML printed to STDOUT, so I wonder whether this requires a 
return?




Re: cgit about-filter in chroot (httpd + slowcgi)

2021-03-28 Thread Paul W. Rankin

On 2021-03-28 15:37, Paul W. Rankin wrote:

I'm running cgit with httpd + slowcgi and can't seem to get the
about-filter to work. Both httpd and slowcgi run in the default chroot
of /var/www.

I've compiled lowdown with "-static -pie" to /var/www/bin/lowdown
(chroot /bin/lowdown) with permissions:

-rwxr-xr-x  1 root  bin  1325512 Mar  4 01:38 /var/www/bin/lowdown

In my cgitrc (cgit.conf):

about-filter=/bin/lowdown
readme=:README.md

However, upon visiting an About page of a repo that includes a
README.md, I get only a blank page and the following is logged in
error.log:

lowdown: README.md: No such file or directory


Okay I figured this out, but the solution raises a troubling question...

The cgit about-filter doesn't want an executable to do e.g. the Markdown 
conversation, rather it wants a script that will return the command to 
perform this, e.g.:


#!/bin/sh
case "$1" in
(*.md)  exec /bin/lowdown ;;
(*) exit ;;
esac

This works, i.e. README.md files are converted to HTML, but this 
requires copying the sh binary into /var/www/bin, which is the troubling 
part.


Is this an acceptable thing to do, security-wise?