Using the jail Module with (Base-)Lua on FreeBSD
- Reply: Dave Cottlehuber: "Re: Using the jail Module with (Base-)Lua on FreeBSD"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 29 Dec 2024 11:26:59 UTC
Dear FreeBSD Community,
I am currently working on a FreeBSD system where I am managing multiple
Jails using Bastille. Here's a snapshot of the active Jails for context:
```
user@microserver:~ $ jls
JID IP Address Hostname Path
1 10.0.0.1 dns /usr/local/bastille/jails/dns/root
2 10.0.0.10 redmine /usr/local/bastille/jails/redmine/root
... (truncated for brevity) ...
63 10.0.0.18 webproxy /usr/local/bastille/jails/webproxy/root
```
I attempted to use the jail module with Lua (via /usr/libexec/flua), but
I encountered issues when trying to load or interact with it. Below are
the steps and results:
```
user@microserver:~ $ /usr/libexec/flua
Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio
> package.cpath
/usr/lib/flua/?.so;/usr/lib/flua/loadall.so;./?.so
> local jail = require("jail")
> print(jail)
nil
> jail.list()
stdin:1: attempt to index a nil value (global 'jail')
stack traceback:
stdin:1: in main chunk
[C]: in ?
> local path = package.searchpath("jail", package.path)
> print(path)
nil
> local path = package.searchpath("jail", package.cpath)
> print(path)
nil
```
It seems that the jail module is not accessible through Lua’s require()
function, and package.searchpath doesn't locate it either in
package.path or package.cpath.
Questions:
- Is the jail module supposed to be available by default in
/usr/libexec/flua?
- If not, what are the steps to install or enable it?
- Are there any specific dependencies or configurations needed for Lua
to interact with the jail subsystem on FreeBSD?
I’d appreciate any guidance, as I am trying to leverage Lua scripting
for automating jail management tasks.
Thank you in advance for your time and help!
Best regards
Matthias