Differences between revisions 14 and 15
Revision 14 as of 2006-07-31 05:46:43
Size: 3210
Editor: 67-41-86-59
Comment:
Revision 15 as of 2009-03-15 22:42:40
Size: 3204
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
''Thanks to Ticho for mentioning the idea''[[BR]]
''Thanks to Vagabond for quickly implementing support in his [wiki:Clients/Rirc rirc]''[[BR]]
''If you don't have/want xinetd/inetd check out [wiki:SpinetdHowto spinetd]''
''Thanks to Ticho for mentioning the idea''<<BR>>
''Thanks to Vagabond for quickly implementing support in his [[Clients:Rirc|rirc]]''<<BR>>
''If you don't have/want xinetd/inetd check out [[SpinetdHowto|spinetd]]''
Line 8: Line 8:
'''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.'''[[BR]] '''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.'''<<BR>>
Line 11: Line 11:
This is a quick guide on how to run irssi2 under inetd or xinetd, instead of ssh / local socket / whatnot. [[BR]] This is a quick guide on how to run irssi2 under inetd or xinetd, instead of ssh / local socket / whatnot. <<BR>>
Line 82: Line 82:
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.[[BR]] 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.<<BR>>

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.
To resolve the latter, I recommend you follow the SshInetdHowto afterwards. (:

This is a quick guide on how to run irssi2 under inetd or xinetd, instead of ssh / local socket / whatnot.
Includes inetd configuration, xinetd configuration and the rest. :)

Setting up inetd

  1. Edit /etc/services and add:

    irssi2 1027/tcp
  2. Create a irssi2wrap.sh, make it executable by your user, and put this in it:

    ### 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. (=
    $BIN
  3. Edit /etc/inetd.conf and add: (NOTICE THE STANDALONE "irssiwrap2.sh"; IMPORTANT)

    irssi2  stream  tcp  nowait  username_here  /path/to/irssi2wrap.sh irssi2wrap.sh /path/to/irssi2-binary
  4. Restart inetd.

Setting up xinetd

  1. Add irssi2 as a service as above
  2. Edit /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
    }
  3. Restart xinetd.

Conclusion

There's one "problem":

  • you have to make a wrapper script to get it to run as non-root (for inetd)

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.
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.

I hope this helps, it's really easy as pie.

InetdHowto (last edited 2009-03-15 22:42:40 by localhost)