config file

config file

bis zur Revision 0.9.3 gab es 2 Config Files: /etc/dvgtool/dvgconfig.php und /etc/dvgtool/dvgconfig.pl Diese beiden Files sprachspezifisch (PHP und Perl) uptodate zu halten ist mühsam und eigentlich überflüssig.

Darum gibt es ein neues sprachunabhangies Config File: /etc/dvgtool/dvgconfig.xml und die dazu notwendigen libraries: /lib/DVG_config.php und /lib/DVG_config.pm

Multiple Instanzen

Um mehrere DVG Instanzen auf einem Host zu installieren muss pro Instanz ein Configfile erstellt werden. Der Instanzname ist der Servername des entsprechenden HTTP Hosts (beispielsweise dvg.dvgtool.org für die Demo-site). Das Configfile muss mit dem namen /etc/dvgtool/${sitename}.xml erstellt werden. Ist nur eine Site auf dem Host installiert, kann das Configfile weiterhin /etc/dvgtool/dvgconfig.xml heissen. Empfohlen ist das File nach der Instanz zu benennen.

Die PHP Seiten können mit $site = $_SERVER[“SERVER_NAME”]; den Sitenamen bestimmen.
Die Perlskripte müssen den Sitename aus dem File $DVG_ROOT/etc/sitename.conf lesen. ist der Sitename bekannt kann daraus der Configfile Namen zusammengesetzt werden.

Das File $DVG_ROOT/etc/sitename.conf wird automatisch mit PHP erstellt - wenn das file nicht existiert und das etc-Verzeichnnis für den Web-prozess (apache) schreibbar ist.

${sitename}.xml

Das Configfile muss im Verzeichnis /etc/dvgtool/ abgespeichert sein und für den Webserver und den User, unter dem die Perl-skripte ausgeführt werden, lesbar sein! Pro Site wird ein File mit dem namen ${sitename}.xml erwartet.

ACHTUNG: In dem Config File sind Passwörter enthalten!!!

Das ist ein Beispiel von dem Config File:

  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!--
    DVG Configuration File 
    
    This is an example file only and it'll not work out of the box!
    
    You   N E E D    to edit this file to meet your settings
    and the file is stored in /etc/dvgtool/
    -> 
    
    $Id$
    
    (c) 2005 ... 2012 by ueli@dvgtool.org
    
  -->   
            
  <DVG configversion="1.1" site="dvg.dvgtool.org">
  
    <!-- is this a test installation? -->
    <TEST flag="no">
      <user>ueli</user>
    </TEST>
        
    <!-- Database connection -->
    <DB name="dvgdb" type="mysql" dbname="dvgtool" host="localhost" port="3306">
        <user name="RW" password="ROpassword" user="dvgtool-ro"/>
        <user name="RO" password="RWpassword" user="dvgtool-rw"/>
    </DB>
        
    <!-- Database Connection to the Address Database -->
    <DB name="address" type="mysql" dbname="ADDRESS_DBNAME" host="localhost" port="3306">
        <user name="RO" password="ROpassword" user="dvgtool-ro"/>
        <user name="RW" /> <!-- there is no RW access -->
        <tablename>TABLENAME</tablename>
    </DB>
        
    <!-- Database Connection to the radacct DB (Module Radacct) -->
    <DB name="radacct" type="mysql" dbname="RADACT_DBNAME" host="localhost" port="3306">
        <user name="RO" password="ROpassword" user="dvgtool-ro"/>
        <user name="RW" /> <!-- there is no RW access -->
        <tablename>TABLENAME</tablename>
    </DB>
        
    <!-- Database Connection to the radius DB (Module Radius) -->
    <DB name="radius" type="mysql" dbname="RADIUS_DBNAME" host="localhost" port="3306">
        <user name="RO" /> <!-- there is no RO access -->
        <user name="RW" password="RWpassword?" user="dvgtool-rw"/>
    </DB>
        
        
    <!-- Database Connection to the netflow DB (Module Netflow) -->
    <DB name="netflow" type="mysql" dbname="netflow" host="localhost" port="3306">
        <user name="RO" password="ROpassword?" user="dvgtool-ro"/>
        <user name="RW" /> <!-- there is no RW access -->
    </DB>
        
    <!-- various defaults settings -->
    <DEFAULTS> 
      <!-- the default Owner for new hosts -->
        <owner>A001297</owner>
    
      <!-- DirHash value they should not change after you set it! -->
        <dirhash1>23</dirhash1>
        <dirhash2>7</dirhash2>
        
      <!-- How many rows should be shown per page -->
        <elemnts_per_page>30</elemnts_per_page>
   
      <!--  Additional programs ...  -->
        <weathermap enabled="0" url="/weathermap/"/>
        <lookingglass enabled="0" url="/lg"/>
             
    </DEFAULTS>
  
    <HOST>
        <baseurl>https://dvg.DOMAINNAME/</baseurl>
        <domain>DOMAINNAME</domain>
        <!-- home -> home-directory -->
        <home>/home/DOMAINNAME/dvg</home>
       <!--
        <include>/home/maillink.ch/dvg/include</include>
        <include>/home/maillink.ch/dvg/bin/modules</include>
       -->
        <!-- hostid -> the host_id from the table dvg_host for this host -->
        <hostid>1</hostid>
        <cookiedomain>dvgtool.org</cookiedomain>
        <cookiettl>31536000</cookiettl>
    </HOST>
    <SNMP>
        <port>161</port>
        <timeout>0.5</timeout>
        <retries>2</retries>
        <backoff>1</backoff>
        <version>1</version>
    </SNMP>
    <SMTP>
        <server>localhost</server>
        <replayto>DVGSYSTEM.USER@DOMAINNAME</replayto>
        <mailfrom>bitbucket@DOMAINNAME</mailfrom>
    </SMTP>
    <AUTH>
      <usecrack>1</usecrack>
      <crackdict>/path_to_your/cracklib_dict</crackdict>
      <minlength>6</minlength>
      <maxattempt>3</maxattempt>
    </AUTH>
 
    <!-- Enable Remarks; Show remarks to user; 'yes' enables it, anything else disable it? -->
  
    <REMARK enabled="1">
      <show_remark_to_customer>no</show_remark_to_customer>
    </REMARK>
 
    <!-- the version of the rrdlib; dvg 0.9.4 needs for some graph version >= 1.2! -->
    <RRD version="1.2">
      <COLOR>
        <!-- The Colors for the RRDgraphs 
          see: http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html -->
        <BACKGROUND>e8e8e8cc</BACKGROUND>
        <CANVAS>ffffe066</CANVAS>
        <FONT>00006688</FONT>
      </COLOR>
    </RRD>

    <LETTER enabled="1">
      <template name="IP" path="/letter/ipinfo.rtf" />
      <template name="BBCS" path="/letter/ipadsl.rtf" />
      <template name="WORKNET" path="/letter/worknet.rtf" />
    </LETTER>
 
    <IPNET> <!-- see /admin/ipnet.php -->
      <carpet>
        <IPv4>
          <title_offset>32</title_offset>
          <legend_offset>80</legend_offset>
          <ip_per_line>256</ip_per_line>  <!-- must be pow(2,n) n ge  6 -->
          <px_per_line>16</px_per_line>   <!-- should be ge 9 -->
          <px_per_ip>4</px_per_ip>        <!-- should be ge 3 -->
        </IPv4>
        <IPv6>
          <title_offset>32</title_offset>
          <legend_offset>80</legend_offset>
          <!-- TO DEFINE -->
        </IPv6>
      </carpet>
      <RIR>
        <contact>CONTACTHANDLE-RIPE</contact>
        <admin>ADMINHANDLE-RIPE</admin>
        <template name="IPv4">
  %sinetnum: %s - %s
  netname: %s%s
  country: YOUR_COUNTRY
  admin-c: %s
  tech-c:  %s
  status:  ASSIGNED PA
  notify:  YOUR_NOTIFY_ADDRESS
  mnt-by:  YOUR_MAINTAINER_OBJECT
  %schanged: dvg-%s@DOMAINNAME %s
  source:  RIPE
        </template>
        <template name="person">
  person:  %s
  address: %s
  address: %s
  address: %s
  address: YOUR_COUNTRY
  phone:   %s
  fax-no:  %s
  e-mail:  %s
  nic-hdl: %s
  notify:  YOUR_NOTIFY_ADDRESS
  mnt-by:  YOUR_MAINTAINER_OBJECT
  changed: dvg-%s@DOMAINNAME %s
  source:  RIPE
        </template>
      </RIR>
    <ASN>65000</ASN> <!-- the AS-Number; used for the VRF-extension -->
    </IPNET>

    <RADIUS> <!-- as many as you needed regex expressions to check the RadiusUsernames -->
      <domain>^[A-Z0-9]+\.[a-z0-9\-]+@example\.com$</domain>
      <domain>^[A-Z0-9]+#[a-z0-9\-]+@example\.com$</domain>
      <!-- master are used by dvg_export_radius.pl -->
      <master>example.com</master>
      <master>second_domain.any</domain>
    </RADIUS>
        
    <COMMAND>
      <whois>/usr/bin/whois -B</whois>
    </COMMAND>
    
    <ASSET enabled="1">
      <!-- Remote link to the Asset Tracker -->
      <rttitle>Asset Tracker</rttitle>
      <rturl>https://rt.DOMAINNAME/rt/AssetTracker/Asset/Display.html?id=%d</rturl>
    </ASSET>
  
  </DVG>

Mit dem Program DVG_config.pl kann dar Inhalt des Config Files ausgegeben werden um zu prüfen, ob man die Werte am richtigen Ort eingegeben hat.

design/configfile.txt · Last modified: 2012/06/25 19:49 by Ueli Heuer
Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0