[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ircd.conf considerations / XML



Magnus Tjernstrom wrote:
> 
> The configuration file of the IRC server is starting to get more and
> more complicated and there are trouble trying to add new fields and
> lines. As of now the format still works and probably will for a long
> time so this might not even be an issue. Also this might not be the
> way to deal with the problems - if that is the case then I guess the
> thread will die quickly by itself.

Well XML is coming to saty that is for sure:) A simpler and easier to
understand configfile would be nice especially for newcomers.

> This is an attempt to create a new configuration file for the IRC server
> using XML. First a simple example of a configuranfile will be shown to
> give a first hint on what it finaly might look like. Then all the valid
> tags are shown to give a more accurate view on what could be done. Then
> finally is an incomplete attempt to create a dtd file for it. Unfortunately
> I'm no wizard at writing these so I'm sure there are plenty of errors in
> there.

I have tried to take a slightly different approach where things are divided
into four categories:
1. INFO - general stuff-header alike (M,A)
2. SOCKETS - to what the server binds(P)
3. CLASSES - which is divided into SERVERCLASS (Y,C,c,N,D,H,L,V,Q),
             SERVICECLASS (Y,S) and CLIENTCLASS (I,i,O)
4. DENIALS - BOUNCE (B) and KILL(K,k)

where () is the "lines" ie (Y) is Y-lines. There is one assumption that no one
uses a classs (Y) that spans over more than one of the groups
SERVER/SERVICE/CLIENT as far as I can se noone should/could but not 100% sure
though. If this is the rigth approach I am not sure of either but atleast it is
a try :)

> The structure in XML format, displaying all the different elements and
> attributes, was put together by Christophe Kalt and myself, in an effort
> to make a first draft covering all the lines and fields in the old version
> of the configuration file. However, I'm sure a lot of it could be done in
> a better way with the multitude of ideas that are still not spoken for,
> also the naming should be conscidered and simplified if possible.

The example below is atleast a try :)

> The main idea on how this attempt should continue is by creating a
> preprocessor that takes an XML file and turns it into the old version of
> the file, thus giving people the oppertunity to use both ways. I'm sure
> a new format will be looked upon very suspisiously and will not easily
> be accepeted (even I thinks it looks "odd" and unfamiliar right now).

Currently there is no other way than to do a preparser/converter IMHO. Would
ofcourse be better to just built in an XML parser but that will have to wait I
am sure.. don't want anyone to choke on the XML :)

> This is also one reason why I'm not sure this draft should be put public
> on mailinglists before the main objections are weeded out from people who
> has worked with both the IRCD and XML. Also the dtd part should be
> finished. Still, here it is...

If there is no objections i would suggest moving the XML config discussion to
another list IF the discussion evolves...

-jorgen
PS! Note that L,V and Q-lines are not represented in the suggestion yet...
anythign else missing?

The XML is parsed by a Validation parser (xml4j - IBM Alphaworks). The XML is
only meant as an example. There is no complete consequence in usage of #IMPLIED
(compiled defaults from ircd)
#REQUIRED and "DEFAULTS" written in the DTD. This has to be discussed, but I
guess the rigth forum has to be formed first?

Here goes.
irc.xml:
<?xml version = "1.0"?>
<!DOCTYPE IRC SYSTEM "irc.dtd">

<IRC>
 <INFO>
  <!-- M info-->
  <HOST NAME="sunsite.auc.dk">SunSITE Denmark, Aalborg University</HOST>
  <!-- A info-->
  <ADMIN EMAIL="irc@xxxxxxxxxxxxxx">Karsten Thygesen, Jorgen Nielsen</ADMIN>
 </INFO>

 <SOCKETS>
   <NET ID="normalport" IP="*" PORT="6667" MASK="*"/>
   <LOCAL ID="domainsocket" PATH="/tmp/.ircd" FILE="6667"/>
 </SOCKETS> 

 <CLASSES>
  <!-- ID is in ircd.conf '2' but why not use real names here so much easier to
read.
       Anyhow it is still possible to use numbers, but now also names
   -->
  <SERVERCLASS ID="internationals" CONNECTFREQ="320" PINGFREQ="90"
SENDQUEUE="600000" MAXLINKS="1">
    <CONNECTION ID="*.se" SERVER="irc.ludd.luth.se" SERVERPORT="6667"
                INTRODUCES="*" COMPRESSION="YES"
                PASSWORDOUT="WhatIShouldSend" PASSWORDIN="WhatIWoudlExpect" />

    <CONNECTION ID="irc2.sci.kun.nl" SERVER="irc.sci.kun.nl" SERVERPORT="6667"
                INTRODUCES="*" COMPRESSION="YES"
                PASSWORDOUT="WhatIShouldSend" PASSWORDIN="WhatIWoudlExpect" />

    <!-- D-lines-->
    <CONNECTED MASK="*.nl"/>
    <CONNECTED MASK="*.se"/>
    <CONNECTED MASK="*.no"/>

  </SERVERCLASS>

  <SERVERCLASS ID="nationals" CONNECTFREQ="300" PINGFREQ="90"
SENDQUEUE="600000" MAXLINKS="1">
    <CONNECTION ID="irc.dknet.dk" SERVER="irc.dknet.dk" SERVERPORT="6667"
                INTRODUCES="*" COMPRESSION="YES"
                PASSWORDOUT="WhatIShouldSend" PASSWORDIN="WhatIWoudlExpect" />

    <CONNECTED MASK="*.dknet.dk"/>
  </SERVERCLASS>

  <CLIENTCLASS ID="localcamp" MAXUSERS="100" PINGFREQ="90" SENDQUEUE="240000"
               LOCALS="10" >
    <ACCEPT NAME=""         ADDRESS="10.*.*.*" PORT="normalport" PASSWORD=""
RESTRICTED="YES"/>
    <ACCEPT NAME="*@*.dk"   ADDRESS=""         PORT="normalport" PASSWORD=""/>
    <ACCEPT NAME="*@*.dk"   ADDRESS=""         PORT="normalport" PASSWORD=""/>

    <OPERATOR MASK="*.auc.dk" TYPE="global" USER="anircop" PORT="normalport"
PASSWORD="secret"/>
    <OPERATOR MASK="192.168.64.*" TYPE="local" USER="anircop" PORT="normalport"
PASSWORD="secret"/>
  </CLIENTCLASS>

  <CLIENTCLASS ID="ISPdenmark" MAXUSERS="100" PINGFREQ="90" SENDQUEUE="240000"
               LOCALS="1" GLOBALS="2" >
    <ACCEPT NAME="*.fr.tele.dk"  ADDRESS="" PORT="normalport" PASSWORD=""
RESTRICTED="YES"/>
    <ACCEPT NAME="*.tele.dk"     ADDRESS="" PORT="normalport" PASSWORD=""/>
    <ACCEPT NAME="*.image.dk"               PORT="normalport" PASSWORD=""/>

    <CLASSBOUNCE TO="irc.dknet.dk" PORT="6667"/>
  </CLIENTCLASS>


  <SERVICECLASS ID="dkservices" CONNECTFREQ="300" PINGFREQ="90"
SENDQUEUE="600000" MAXLINKS="1">
    <SERVICE NAME="sunsite.auc.dk" PASSWORD="secret" OPTIONMASK="242"/>
  </SERVICECLASS>

 </CLASSES>

 <DENIALS>
  <DENY MASK="www.*" REMARK="no_www_hosts_please" PORT="normalport"/>
  <DENY MASK="*" REMARK="not_a_good_idea_to_use_root" USER="root"/>
  <BOUNCE MASK="*.fi" TO="irc.funet.fi" PORT="6667"/>
  <BOUNCE MASK="*.se" TO="irc.ludd.luth.se" PORT="6667"/>
 </DENIALS>

</IRC>
-------
and irc.dtd:
<?xml version="1.0" encoding="UTF-8" ?>

<!ELEMENT IRC (INFO, SOCKETS, CLASSES, DENIALS)>

<!ELEMENT INFO (HOST, ADMIN)>
<!ELEMENT HOST (#PCDATA)>
<!ELEMENT ADMIN (#PCDATA)>


<!ELEMENT SOCKETS (LOCAL | NET)+>
<!ELEMENT NET EMPTY>
<!ELEMENT LOCAL EMPTY>

<!-- NOTE this design does not make it possible to use one class
     for different types SERVER/SERVICES/CLIENTS.
     As a plus though it makes it easier to seperate usage.
-->

<!ELEMENT CLASSES (SERVERCLASS | SERVICECLASS | CLIENTCLASS)*>

<!ELEMENT SERVERCLASS (CONNECTION+, CONNECTED*)>

<!ELEMENT CONNECTION EMPTY>
<!ELEMENT CONNECTED EMPTY>

<!ELEMENT CLIENTCLASS (ACCEPT+, OPERATOR*, CLASSBOUNCE*)>

<!ELEMENT ACCEPT EMPTY>
<!ELEMENT OPERATOR EMPTY>
<!ELEMENT CLASSBOUNCE EMPTY>

<!ELEMENT SERVICECLASS (SERVICE)*>

<!ELEMENT SERVICE EMPTY>

<!ELEMENT DENIALS (DENY | BOUNCE)*>

<!ELEMENT DENY EMPTY>
<!ELEMENT BOUNCE EMPTY>

<!ATTLIST HOST NAME CDATA #REQUIRED>

<!ATTLIST ADMIN EMAIL CDATA #REQUIRED>

<!ATTLIST NET ID ID #REQUIRED>
<!ATTLIST NET IP CDATA #REQUIRED>
<!ATTLIST NET PORT CDATA #REQUIRED>
<!ATTLIST NET MASK CDATA #REQUIRED>

<!ATTLIST LOCAL ID ID #REQUIRED>
<!ATTLIST LOCAL PATH CDATA #REQUIRED>
<!ATTLIST LOCAL FILE CDATA #REQUIRED>

<!ATTLIST SERVERCLASS ID ID #REQUIRED>
<!ATTLIST SERVERCLASS CONNECTFREQ CDATA #IMPLIED>
<!ATTLIST SERVERCLASS PINGFREQ CDATA #IMPLIED>
<!ATTLIST SERVERCLASS SENDQUEUE CDATA #IMPLIED>
<!ATTLIST SERVERCLASS MAXLINKS CDATA #IMPLIED>

<!ATTLIST CONNECTION ID CDATA #REQUIRED>
<!ATTLIST CONNECTION SERVER CDATA #REQUIRED>
<!ATTLIST CONNECTION SERVERPORT CDATA #REQUIRED>
<!-- INTRODUCES should be NMTOKENS but * is not valid in a token so won't go
-->
<!ATTLIST CONNECTION INTRODUCES CDATA #REQUIRED>
<!ATTLIST CONNECTION COMPRESSION (YES | NO) "YES">
<!ATTLIST CONNECTION PASSWORDOUT CDATA "">
<!ATTLIST CONNECTION PASSWORDIN CDATA "">

<!ATTLIST CONNECTED MASK CDATA #REQUIRED>

<!ATTLIST CLIENTCLASS ID ID #REQUIRED>
<!ATTLIST CLIENTCLASS MAXUSERS CDATA #IMPLIED>
<!ATTLIST CLIENTCLASS PINGFREQ CDATA #IMPLIED>
<!ATTLIST CLIENTCLASS SENDQUEUE CDATA #IMPLIED>
<!ATTLIST CLIENTCLASS LOCALS CDATA #REQUIRED>
<!ATTLIST CLIENTCLASS GLOBALS CDATA "10">

<!ATTLIST ACCEPT NAME    CDATA "">
<!ATTLIST ACCEPT ADDRESS CDATA "">
<!ATTLIST ACCEPT PORT IDREF #IMPLIED>
<!ATTLIST ACCEPT RESTRICTED (YES | NO) "YES">
<!ATTLIST ACCEPT PASSWORD CDATA "">

<!ATTLIST OPERATOR MASK CDATA #REQUIRED>
<!ATTLIST OPERATOR TYPE (global | local) "local">
<!ATTLIST OPERATOR USER CDATA #REQUIRED>
<!ATTLIST OPERATOR PORT IDREF #IMPLIED>
<!ATTLIST OPERATOR PASSWORD CDATA #REQUIRED>

<!ATTLIST CLASSBOUNCE TO CDATA #REQUIRED>
<!ATTLIST CLASSBOUNCE PORT CDATA "6667">

<!ATTLIST SERVICECLASS ID ID #REQUIRED>
<!ATTLIST SERVICECLASS CONNECTFREQ CDATA #IMPLIED>
<!ATTLIST SERVICECLASS PINGFREQ CDATA #IMPLIED>
<!ATTLIST SERVICECLASS SENDQUEUE CDATA #IMPLIED>
<!ATTLIST SERVICECLASS MAXLINKS CDATA #IMPLIED>

<!ATTLIST SERVICE NAME CDATA #REQUIRED>
<!ATTLIST SERVICE PASSWORD CDATA #REQUIRED>
<!ATTLIST SERVICE OPTIONMASK CDATA #REQUIRED>

<!ATTLIST DENY MASK CDATA #REQUIRED>
<!ATTLIST DENY REMARK CDATA "n/a">
<!ATTLIST DENY PORT IDREF #IMPLIED>
<!ATTLIST DENY USER CDATA #IMPLIED>

<!ATTLIST BOUNCE MASK CDATA #REQUIRED>
<!ATTLIST BOUNCE TO CDATA #REQUIRED>
<!ATTLIST BOUNCE PORT CDATA "6667">