Introduction
Thanks to Ticho for mentioning the idea
Thanks to Vagabond for quickly implementing support in his rirc
If you don't have/want xinetd/inetd check out spinetd
Note that this is a ridiculous idea. Note that there is no authentication yet, so you're simply allowing everyone to connect to your irssi2 instance! So if you're going to try this, make sure the port is firewalled well. This is a quick guide on how to run irssi2 under inetd or xinetd, instead of ssh / local socket / whatnot.
Edit Create a Edit
Edit
There's one "problem": The reason for the script is related to the environment that irssi2 is run in under inetd, and no way to change it via the inetd.conf. I hope this helps, it's really easy as pie.
To resolve the latter, I recommend you follow the SshInetdHowto afterwards. (:
Includes inetd configuration, xinetd configuration and the rest.
Setting up inetd
/etc/services and add:irssi2 1027/tcp
### irssi2wrap.sh, by daxxar.
## Simple wrapper to make irssi2 run under inetd
## Please, if anyone knows a better way; lemme know. (:
# Check that the user (rather; inetd/xinetd) passed a proper binary.
BIN="$1"
if [ -z "$BIN" ]; then
echo "irssi2wrap.sh: you didn't pass a path to the real irssi2 binary. exiting."
exit 1
fi
if [ ! -r "$BIN" ] || [ ! -x "$BIN" ] || [ ! -f "$BIN" ]; then
echo "irssi2wrap.sh: you didn't pass the path ($BIN) to a readable, executable file. exiting."
exit 1
fi
# Better safe than sorry! :)
for v in `export|awk '{ sub(/^declare -x /, ""); sub(/=.*$/, ""); print $0 }'`; do unset $v; done
# Set up the needed stuff.
export PATH="/usr/local/bin:/usr/bin:/bin"
export USER="`id -un`"
# If you haven't got getent, use this instead:
# export HOME="`grep ^$USER: /etc/passwd|cut -f6 -d:`" instead.
export HOME="`getent passwd $USER|cut -f6 -d:`"
# Execute the binary itself. (=
$BINirssi2 stream tcp nowait username_here /path/to/irssi2wrap.sh irssi2wrap.sh /path/to/irssi2-binary
Setting up xinetd
/etc/xinetd.d/irssi2 and add:service irssi2
{
socket_type = stream
protocol = tcp
wait = no
user = username_here
server = /path/to/irssi2-binary
passenv =
env = PATH=/usr/local/bin:/usr/bin:/bin USER=username_here HOME=/path/to/homedir
port = 1027
}Conclusion
If you try replacing the inetd.conf line that has the wrapper with the real binary, you get an error about /root/.irssi2 not being writeable. This is due to the environment that it sets up, i.e. HOME, is obviously not updated.