On 18.12.2022 08:07, indivC wrote:
Can anyone provide a guide for this or rough instructions?
I'm running httpd(8) and trying to utilize a python(1) script
with an html file.
I've got this working using perl(1).
However, it doesn't work with python(1) when following the same steps.


As was already pointed out by others it may be good to know what
are you trying to achieve actually aka why you are trying to put
python in chroot. Especially as you said it works with perl fine
and that one is in base.


My python(1) version is 3.9.15
My OpenBSD version is 7.2 stable.

First, I use ldd(1)
to determine what files I need to copy for python(1).
Second, in '/var/www/',
I create all the folder paths from the ldd(1) output.
Third, I change the ownership of all the folders to be 'www:www'.
Then, I copy all the files from the ldd(1) output
into their respective folders.
Lastly, I change the permissions of all these files to 750.

At this point, before doing anything with httpd(8),
I try testing to ensure everything is correct with python(1).
If I run 'python3 /var/www/htdocs/test/test.py', the script runs.
However, if I run 'chroot /var/www htdocs/test/test.py',
I get the following error:
"ld.so: python3: can't load library 'libintl.so.7.0'"

'libintl.so.7.0' was one of the files that appeared in ldd(1).
ldd(1) said the path was '/usr/local/lib/'
and I've got the file copied to '/var/www/usr/local/lib/',
so I'm unsure why python(1) is saying it can't load it.

What's a little strange
is if I run the 'chroot' command from above several times in a row,
I'll see the same error for 'libpython3.9.so.0.0' as well.
ldd(1) also showed this file and I also have it,
so I'm not really sure what the problem is.

I've seen some posts indicate
that I also need to copy '/sbin/ldconfig' to '/var/www/'.
Then, run 'chroot /var/www sbin/ldconfig /usr/local/lib/'.
When I do that, I get the following error:
"ldconfig: /var/run/ld.so.hints.<rand>: No such file or directory"

In the above error, '<rand>' seems to be some pseudorandom value.
If I run the command multiple times, that value changes every time.
For instance, one value I got is 'IkB2akBOKX'.

Maybe the steps to configure this are a little different for python(1)
when compared to perl(1).
This is why I was hoping someone could provide a link to a guide
or provide some general steps for configuring this.
Currently, I've just been trying to piece together
what I've been able to find online.

Thanks.

Reply via email to