Administration (Tanaguru 1.x)

mfaure's picture

Several scripts are available to create user and contracts.

User management

Edit the script to replace the database connection information ($DbUser, $DbUserPasswd and $DbName)

cd tanaguru-<version>.<architecture>/install-web-app/sql-management
vi ./tg-create-user.sh

Execute the script with the wished user data.

sh ./tg-create-user.sh -e <Email> -p <password> -l <LastName> -f <FirstName>

Contract Management

Edit the script to replace the database connection information ($DbUser, $DbUserPasswd and $DbName)

cd tanaguru-<version>.<architecture>/install-web-app/sql-management
vi ./tg-create-contract.sh

Execute the script with the wished contract data.

sh ./tg-create-contract.sh -l <SiteLabel> -w <FQDN-url> -u <UserId> -p <ProductId>

Where <ProductId> can be one the following values :

  • "1" which allows to audit "up to 10 pages".
  • "2" which allows to audit "whole sites".
  • "7" which allows to audit "files" through the upload module.

And <FDQN-url> is the Url associated with the contract. This value can be set to "" with the "up to 10 pages" product (ProductId=1); in this case the contract has no domain restriction. This value is ignored in case of "files" product

Crawl restriction for a contract

When an audit is launched, parameters are set to define the limitations of the crawl.

"page" or "group of pages" audit

For a "page" or "group of pages" audit, these parameters are defined as follows :

  • MAX_DOCUMENTS=1 (if page audit) or MAX_DOCUMENTS=$nb_pages (if group of pages audit)
  • DEPTH=0
  • MAX_DURATION=604800 (in seconds)
  • EXCLUSION_REGEXP=""

The two parameters PROXY_PORT and PROXY_HOST are set regarding the variables "proxyHost", "proxyPort" and "proxyUrlExclusion" defined in the tgol.conf file.

"site" audit

For a "site" audit, these parameters are defined by default as follows :

  • MAX_DOCUMENTS=50000
  • DEPTH=20
  • MAX_DURATION=604800 (corresponds to 7 days)
  • EXCLUSION_REGEXP=""

The two parameters PROXY_PORT and PROXY_HOST are set regarding the variables "proxyHost", "proxyPort" and "proxyUrlExclusion" defined in the tgol.conf file.

They correspond to the max value the user can fills in for each parameter (upper boundary) and can be overriden in the audit set-up form.

These default values correspond to the entries in the table "PARAMETER" in the tanaguru database. To override these default values, you can modify the field "Parameter_Value" for a given Parameter_Element. Please remind that this table MUST contain only ONE entry that combines a "Parameter_Value" with the field "Is_Default" set to true (b'1').

The site audit crawl parameters can also be specific to a contract. To override a parameter for a given contract, it is necessary to create a restriction to this contract. To do so,  an entry in the "RESTRICTION" table needs to be added with the wished value and the ID of associated RESTRICTION_ELEMENT. To be applied, the code of the RESTRICTION_ELEMENT ("Cd_Restriction_Element" field) MUST be idenitical to the code of the overrident parameter ("Cd_Parameter_Element" field of the PARAMETER_ELEMENT table). 

For example, to override the "MAX_DOCUMENTS" parameter for a given contract, you need to :

  • Retrieve the ID of the RESTRICTION_ELEMENT entry in the tanaguru database that correspond to this parameter:
SELECT `Id_Restriction_Element` FROM `TGSI_RESTRICTION_ELEMENT` WHERE `Cd_Restriction_Element`='MAX_DOCUMENTS';
  • Insert the wished value in the RESTRICTION TABLE, let's say "1000" :
INSERT IGNORE INTO `TGSI_RESTRICTION` (`Id_Restriction_Element`, `Restriction_Value`) VALUES ('$Id_Restriction_Element', '1000');

SELECT `Id_Restriction` FROM `TGSI_RESTRICTION` WHERE `Id_Restriction_Element`='$Id_Restriction_Element' AND `Restriction_Value`='1000';
  • Apply this restriction to the contract :
INSERT INTO TGSI_CONTRACT_RESTRICTION (`RESTRICTION_Id_Restriction`,`CONTRACT_Id_Contract`) VALUES ('$Id_Restriction, '$Id_Contrat'');

Usage restriction for a contract

Some contracts can be limited in terms of usage. Two limitations are possible :

  • Total number of audits
  • Total number of audits in a period for a given IP

Number of audits limitation

This limitation can be defined thanks to a RESTRICTION entry associated with the "RESTRICTION_ELEMENT" entry defined with the "Cd_Restriction_Element" set to "ACT_LIMITATION".

For example, to limit the numbers of audits for a given contract you need to  :

  • Retrieve the ID of the RESTRICTION_ELEMENT entry in the tanaguru database that correspond to this parameter:
SELECT `Id_Restriction_Element` FROM `TGSI_RESTRICTION_ELEMENT` WHERE `Cd_Restriction_Element`='ACT_LIMITATION';
  • Insert the wished value in the RESTRICTION TABLE, let's say "50" :
INSERT IGNORE INTO `TGSI_RESTRICTION` (`Id_Restriction_Element`, `Restriction_Value`) VALUES ('$Id_Restriction_Element', '50');

SELECT `Id_Restriction` FROM `TGSI_RESTRICTION` WHERE `Id_Restriction_Element`='$Id_Restriction_Element' AND `Restriction_Value`='50';
  • Apply this restriction to the contract :
INSERT INTO TGSI_CONTRACT_RESTRICTION (`RESTRICTION_Id_Restriction`,`CONTRACT_Id_Contract`) VALUES ('$Id_Restriction, '$Id_Contrat'');

Total Number of audits in a period for a given IP limitation

This limitation can be defined thanks to a RESTRICTION entry associated with the "RESTRICTION_ELEMENT" entry defined with the "Cd_Restriction_Element" set to "ACT_BY_IP_LIMITATION". The period is expressed in seconds and the format is "nb_of_acts/period"

For example, to the limit the number of audits in a period for a given IP for a given contract, you need to :

  • Retrieve the ID of the RESTRICTION_ELEMENT entry in the tanaguru database that correspond to this parameter:
SELECT `Id_Restriction_Element` FROM `TGSI_RESTRICTION_ELEMENT` WHERE `Cd_Restriction_Element`='ACT_BY_IP_LIMITATION';
  • Insert the wished value in the RESTRICTION TABLE, let's say "5/3600" (that corresponds to 5 audits per hour) :
INSERT IGNORE INTO `TGSI_RESTRICTION` (`Id_Restriction_Element`, `Restriction_Value`) VALUES ('$Id_Restriction_Element', '50');

SELECT `Id_Restriction` FROM `TGSI_RESTRICTION` WHERE `Id_Restriction_Element`='$Id_Restriction_Element' AND `Restriction_Value`='50';
  • Apply this restriction to the contract :
INSERT INTO TGSI_CONTRACT_RESTRICTION (`RESTRICTION_Id_Restriction`,`CONTRACT_Id_Contract`) VALUES ('$Id_Restriction, '$Id_Contrat'');