irc-2.9.5(IRC)

Introduction

Irc is a user interface to the Internet Relay Chat, a CB like interactive discussion environment. It is structured into channels, which are public discussion forums, and also allows for private intercommunication. Each participant has a nickname, which is the one specified in the command line or else his login name.

Install

  • Download IRC Server (irc-2.9.5+jp5-1.i386.rpm) from
    http://www.dgra.ne.jp/~kazu/my-rpm.html

  • Install
    # rpm -ihv irc-2.9.5+jp5-1.i386.rpm
    
  • If these messages was showed, install ncurses3 from Redhat CD-ROM
    error: failed dependencies:
            libncurses.so.3.0 is needed by irc-2.9.5+jp5-1
    
    # mount /mnt/cdrom
    # cd /mnt/cdrom/Redhat/RPMS/
    # rpm -ihv ncurses3-1.9.9e-11.i386.rpm
    

    Configuration

  • You can use a configuration sample file /usr/local/lib/ircd/example.conf and copy to ircd.conf. The mean of this file is 32 users can connect same time.
    ...
    M:speedking.my-machine.com::Japan:6667:
    A:IRC Server:Master me@my-machine.com::
    P::::6667:
    Y:1:120:1500:32:100000
    I:*@*::*@*:6667:1
    K:*:Permission denied:root:0
    ...
    
    1. M:Machine information
      M:speedking.my-machine.com::Japan:6667:
      
      IRC needs to know a few things about your UNIX site, and the ``M'' command specifies this information for IRC. The fomat of this command is:
      M:<Server NAME>:<YOUR Internet IP#>:<Geographic Location>:<Port>
      
    2. P:Port connections
      P::::6668: 
      
      The port line adds flexibility to the server's ability to accept connections. By use of this line in the ircd.conf file, it is easy to setup both Unix Domain ports for the server to accept connections on as well as extra internet ports.
      P:<Internet IP#>:<*>:<Internet IP Mask>:<Port>:
      
      1. Internet IP#
        If the host on which the server runs has several IP addresses, you can define for which IP address connections will be accepted. If no is defined here, server will bind to all interfaces (INADDR_ANY). See also MACHINE CONFIGURATION section to properly configure outgoing connections.
      2. Internet IP# Mask
        This defines where connections may come from and be accepted. The IP mask uses either *'s or 0's as wildcards. The following two lines are the same:
        P:::128.2.*:6664:
        P:::128.2.0.0:6664:
        
      3. Port
        The port number field tells the server which port number it should listen on for incoming connections.
    3. Y:Connection Classes
      To enable more efficient use of MAXIMUM_LINKS, connection classes were implemented. All clients belong to a connection class.

      Each line for a server should have the same number as the sixth field. If it is absent, the server deaults it to 0, using the defaults from the config.h file.
      To define a connection class, you need to include a Y: line in the ircd.conf file. This enables you to define the ping frequency, connection frequency (for servers) and maximum number of links that class should have.

      Currently, the Y: line MUST appear in the ircd.conf file BEFORE it is used in any other way.

      1. Server class
        Y:23:120:300:5:100000:0:0:
        
        This defines class 23 to allow 5 auto-connections, which are checked every 300 seconds. The connection is allowed to remain silent for 120 seconds before a PING is sent. NOTE: fields 3 & 4 are in seconds. The SendQ is set to 100000 bytes.

        Another feature of connection class is the ability to do automatic routing by using the class as a ``priority''. If you are connected to a server which has a class lower than one of the servers that is ``behind'' it, the server will disconnect the lower class one and schedule a ``new'' connection for the higher class server.

      2. Client class
        Y:1:60:0:50:20000:2:5:
        
        In case of a client class, the fields are interpreted a bit differently. This class (number 1) can be used by up to 50 users. The connections are allowed to remain silent for 60 seconds before a PING is set. The SendQ is set to 20000 bytes. A new connection in this class will only be allowed if there aren't more than 2 other local connections from the same IP address, or more than 5 other connections on the net from the same hostname.

      3. Client class
        Y:2:60:0:50:20000:2.1:5:
        
        In case of a client class, the fields are interpreted a bit differently. This class (number 1) can be used by up to 50 users. The connections are allowed to remain silent for 60 seconds before a PING is set. The SendQ is set to 20000 bytes. A new connection in this class will only be allowed if there aren't more than 2 other local connections from the same IP address, 1 other local connection from the same user from the same IP address, or more than 5 other connections on the net from the same hostname.

    4. I:Client connections
      I:<TARGET Host Addr>:<Password>:<TARGET Hosts NAME>:<Port>:<Class>
      
      The ircd.conf files contains entries that specify which clients are allowed to connect to your irc daemon. Obviously you want to allow your own machine's clients to connect. You may want to allow clients from other sites to connect. These remote clients will use your server as a connection point. All messages sent by these clients will pass through your machine.

      I:*::*::1
      
      Allow anyone from anywhere to connect your server.

      I:x::*.du.edu::1
      
      Allow any clients from machines whose names end in ``.du.edu'' to connect with no password.

      I:x::*.fi:6667:1
      
      Allow clients from machines matching ``*.fi'' to connect on the port 6667.

    5. O:Operator priviliges
      To become an IRC Administrator, IRC must know who is authorized to become an operator and what their ``Nickname'' and ``Password'' is.
      O:*.cair.du.edu:pyunxc:Jeff::1
      
      There is an OPERATOR at ``*.cair.du.edu'' that can get Operator priviliges if he specifies a password of ``pyunxc'' and uses a NICKNAME of ``Jeff''.
    6. Check config file
      # chkconf ircd.conf
      

    Automatic run

  • Add following line into /etc/rc.d/rc.local
    ...
    # IRC
    /usr/local/sbin/ircd -c -d /usr/local/lib/ircd
    ...
    

    Sample CGI

  • This is a sample CGI script which is able to show how many users are connecting the server.
    #!/usr/bin/perl
    #
    #@Use as a SSI
    #
    #  Example: <!--#exec cmd="./chk.pl"-->
    #
    
    $member = 0;
    
    unless (open(PIPE,"/bin/netstat |")) {
    print "ERROR\n";
    exit;
    }
    
    chop(@ans = );
    close(PIPE);
    
    $checkword = ":6667";
    
    foreach $line (@ans) {
    if ($line=~ m/$checkword/) {$member = $member+1};
    }
    
    print "$member users are chatting on this IRC server\n";
    
    exit;
    

    Back
    Google
    Web www.grape-info.com