UUGRN:Dienste/IRC/cgiirc

Aus UUGRN

cgiirc unter FreeBSD installieren[Bearbeiten]

Das Package cgiirc installiert sich in FreeBSD unter /usr/local/www/cgiirc. Dort ist es jedoch nicht ohne weiteres lauffähig.

Das Install-Script kopiert zunächst die statischen Bilder nach /usr/local/www/apache24/data/images/, in der config muss entsprechend /images als Pfad konfiguriert werden.

Dann werden die drei CGI-Scripte nach /usr/local/www/apache24/cgi-bin/ kopiert und so angepasst, dass sie jeweils vor allem anderen ihr akteuelles Verzeichnis nach /usr/local/www/cgiirc wechseln, da sie nur dort die cgiirc.conf und die Modulverzeichnisse finden.

install.sh[Bearbeiten]

Das nachfolgende Script unter /usr/local/www/cgiirc/install.sh speichern und ausführbar machen.

#! /bin/sh -x

cd -P "$(dirname "$0")"
rsync -avHWx ./images/ /usr/local/www/apache24/data/images/

CGI-BIN="/usr/local/www/apache24/cgi-bin/"

for CGI in irc.cgi client-perl.cgi nph-irc.cgi ; do
        cp ./${CGI} ${CGI-BIN}${CGI}
        patch -p0 ${CGI-BIN}${CGI} ./patches/${CGI}.patch
        rm ${CGI-BIN}${CGI}.orig
        chmod 750 ${CGI-BIN}${CGI}
        chown root:www ${CGI-BIN}${CGI}
done

Patches[Bearbeiten]

Das Verzeichnis /usr/local/www/cgiirc/patches und folgende 3 Dateien darin anlegen:

patches/client-perl.cgi.patch
--- client-perl.cgi.orig        2017-09-03 02:05:02.040837000 +0200
+++ client-perl.cgi     2017-09-03 02:05:11.247766000 +0200
@@ -17,6 +17,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

+BEGIN { chdir('/usr/local/www/cgiirc') or die $!; }
+
 use strict;
 use lib qw/modules/;
patches/irc.cgi.patch
--- irc.cgi.orig        2017-09-03 01:52:05.433100000 +0200
+++ irc.cgi     2017-09-03 01:52:37.336301000 +0200
@@ -20,6 +20,8 @@
 # Uncomment this if the server doesn't chdir (Boa).
 # BEGIN { (my $dir = $0) =~ s|[^/]+$||; chdir($dir) }

+BEGIN { chdir('/usr/local/www/cgiirc') or die $!; }
+
 use strict;
 use vars qw($VERSION $config $config_path);


patches/nph-irc.cgi.patch
--- nph-irc.cgi.orig    2017-09-03 02:07:45.810289000 +0200
+++ nph-irc.cgi 2017-09-03 02:08:13.274197000 +0200
@@ -20,6 +20,8 @@
 # Uncomment this if the server doesn't chdir (Boa).
 # BEGIN { (my $dir = $0) =~ s|[^/]+$||; chdir($dir) }

+BEGIN { chdir('/usr/local/www/cgiirc') or die $!; }
+
 require 5.004;
 use strict;


Config[Bearbeiten]

Die auf cgiirc.uugrn.lan installierte Config (https://cgiirc.uugrn.org/) ist folgende:

/usr/local/www/cgiirc/cgiirc.config
default_server = irc.uugrn.lan
default_port = 6667
default_channel = #uugrn
default_name = GAST
default_nick = gast????
default_user = cgiirc
script_nph = nph-irc.cgi
script_form = client-perl.cgi
script_login = irc.cgi
image_path = /images
socket_prefix = /tmp/cgiirc-
encoded_ip = 2
allow_non_default = 1
access_channel = .*
access_server = irc\.uugrn\.lan
access_port = .*
access_command =
session_timeout = 18000
login basic = Nickname, Realname
login advanced = Nickname, Realname, Channel
format = default

Der folgende Patch erzeugt aus der cgiirc.config.full eine cgiirc.config, wie sie auf cgiirc.uugrn.lan installiert ist.

--- cgiirc.config.full  2013-09-24 11:27:09.000000000 +0200
+++ cgiirc.config       2017-09-03 02:16:13.551073000 +0200
@@ -7,17 +7,17 @@

 # default server(s) to connect to, more than one server can
 # be entered as a comma seperated list
-default_server = irc.blitzed.org
+default_server = irc.uugrn.lan
 default_port = 6667

 # default channel(s), again this can be a comma seperated list
-default_channel = #cgiirc
+default_channel = #uugrn

 # Realname to use (in /whois)
-default_name = CGI:IRC User
+default_name = GAST

 # default nickname, a ? is replaced with a random number
-default_nick = CGI???
+default_nick = gast????

 # The default username to send, this will only be sent if
 # encoded_ip (below) is set to 1 or less and will have no affect
@@ -42,7 +42,7 @@
 # In script aliased directories (cgi-bin) the default will *not* work,
 # you need to move the directory elsewhere and change this to something
 # like /images.
-image_path = images
+image_path = /images

 # The charset to send to IRC, to send anything other than UTF-8 you will
 # need the Encode perl module installed.
@@ -114,7 +114,7 @@

 # This is regular experssion that sets what servers access should
 # be allowed to.
-access_server = .*
+access_server = irc\.uugrn\.lan

 # This is regular experssion that sets what ports access should
 # be allowed to.
@@ -192,6 +192,10 @@
 #login basic = Nickname, Channel
 #login advanced = Nickname, Realname, Channel, Server, Password, Format, Character set

+login basic = Nickname, Realname
+login advanced = Nickname, Realname, Channel
+
+
 # The default format to use
 format = default