web-dev-qa-db-fra.com

Comment configurer Prewikka pour Bionic lors de sa première utilisation?

J'essaie d'installer le package Prewikka d'un système de gestion des informations et des événements de sécurité basé sur une interface Web pour Bionic.

En suivant les instructions sur mon terminal, lorsque je commence à installer le paquet Prewikka, une confirmation apparaît:

enter image description here

je ne fournis jamais de configuration d'un mot de passe pour la base de données Prewikka. J'essaie de trouver sur un site Docs mais je ne trouve pas mon problème exactement.

Comment connaître un mot de passe pour mon Prewikka sur dbconfig-common? Parce que j'ai choisi la base de données dbconfig-common par défaut sur les instructions précédentes, voir ci-dessous !.

enter image description here

Éditer # 1

Le développeur de Prewikka a déclaré Quant à Prelude, nous avons choisi d'utiliser dbconfig-common, de donner le mot de passe de l'administrateur et de saisir le mot de passe de la base de données. à ce sujet Documents pour faire l'intégration à Prelude Manager, donc je choisis dbconfig-common dans les instructions précédentes. Quand j'ai lu tous les documents du développeur Prelude, j'ai oublié de créer une base de données pour mon Prewikka !. Oh c'est mon faux. et à ce moment, je reçois des Erreurs que je ne comprends pas! mais je reste toujours un peu déroutant lors de la confirmation d'un mot de passe qui doit être saisi entre la base de données MySQL de Prewikka ou DBConfig-Common de Prelude?

Éditer # 2

en ce moment, je reçois des Erreurs que je ne comprends pas et qui me compliquent vraiment! quand j'ouvre le port par défaut de Prewikka, les erreurs apparaissent:

enter image description here

Sur mon terminal apparaît:

$ Sudo prewikka-httpd
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 59, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 489, in __init__
    dh.apply()
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 74, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 424, in apply
    self._apply()
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 415, in _apply
    [ update.apply() for update in self.list() ]
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 415, in <listcomp>
    [ update.apply() for update in self.list() ]
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 87, in inner
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 221, in apply
    self.run()
  File "/usr/lib/python3/dist-packages/prewikka/sql/install.py", line 72, in run
    """)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 211, in query
    self.db.query(q)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 547, in query
    return preludedb.SQL.query(self, sql)
RuntimeError: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 277, in process
    response = self._process_static(webreq) or self._process_dynamic(webreq)
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 244, in _process_dynamic
    self._prewikka_init_if_needed()
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 134, in _prewikka_init_if_needed
    raise self._prewikka_initialized
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 122, in _prewikka_init_if_needed
    env.db = database.Database(env.config.database)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 873, in __new__
    return MySQLDatabase(config)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 61, in inner
    raise DatabaseError(message=text_type(e))
prewikka.database.DatabaseError: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/lib/python3/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/lib/python3/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/lib/python3/dist-packages/prewikka/error.py", line 90, in _html_respond
    from prewikka import baseview
  File "/usr/lib/python3/dist-packages/prewikka/baseview.py", line 27, in <module>
    from prewikka import error, history, hookmanager, resource, response, template, utils, view
  File "/usr/lib/python3/dist-packages/prewikka/history.py", line 102, in <module>
    crontab.schedule("search_history", N_("Search history deletion"), "0 * * * *", _regfunc=history._history_cron, enabled=True)
  File "/usr/lib/python3/dist-packages/prewikka/crontab.py", line 240, in schedule
    self._init_system_job(ext_type, name, schedule, enabled, _regfunc)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/crontab.py", line 152, in _init_system_job
    res = env.db.query("SELECT 1 FROM Prewikka_Crontab WHERE ext_type=%s AND userid IS NULL", ext_type)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 547, in query
    return preludedb.SQL.query(self, sql)
RuntimeError: Table 'prewikka.Prewikka_Crontab' doesn't exist
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 59, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 489, in __init__
    dh.apply()
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 74, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 424, in apply
    self._apply()
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 415, in _apply
    [ update.apply() for update in self.list() ]
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 415, in <listcomp>
    [ update.apply() for update in self.list() ]
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 87, in inner
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 221, in apply
    self.run()
  File "/usr/lib/python3/dist-packages/prewikka/sql/install.py", line 72, in run
    """)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 211, in query
    self.db.query(q)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 547, in query
    return preludedb.SQL.query(self, sql)
RuntimeError: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 277, in process
    response = self._process_static(webreq) or self._process_dynamic(webreq)
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 244, in _process_dynamic
    self._prewikka_init_if_needed()
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 134, in _prewikka_init_if_needed
    raise self._prewikka_initialized
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 122, in _prewikka_init_if_needed
    env.db = database.Database(env.config.database)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 873, in __new__
    return MySQLDatabase(config)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 61, in inner
    raise DatabaseError(message=text_type(e))
prewikka.database.DatabaseError: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/lib/python3/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/lib/python3/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/lib/python3/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/lib/python3/dist-packages/prewikka/error.py", line 90, in _html_respond
    from prewikka import baseview
  File "/usr/lib/python3/dist-packages/prewikka/baseview.py", line 27, in <module>
    from prewikka import error, history, hookmanager, resource, response, template, utils, view
  File "/usr/lib/python3/dist-packages/prewikka/history.py", line 102, in <module>
    crontab.schedule("search_history", N_("Search history deletion"), "0 * * * *", _regfunc=history._history_cron, enabled=True)
  File "/usr/lib/python3/dist-packages/prewikka/crontab.py", line 240, in schedule
    self._init_system_job(ext_type, name, schedule, enabled, _regfunc)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/prewikka/crontab.py", line 152, in _init_system_job
    res = env.db.query("SELECT 1 FROM Prewikka_Crontab WHERE ext_type=%s AND userid IS NULL", ext_type)
  File "/usr/lib/python3/dist-packages/prewikka/database.py", line 547, in query
    return preludedb.SQL.query(self, sql)
RuntimeError: Table 'prewikka.Prewikka_Crontab' doesn't exist

Éditer # 3

J'ai essayé de suivre à partir de ceci problème et il résolut avec ce qui suit:

  • Supprimé la base de données Prewikka
  • Recréé la base de données Prewikka
  • Réessayer d'exécuter le Prewikka

Mais cela ne fonctionne pas pour moi, j'utilise aussi les instructions comme mentionné Howto: https://www.prelude-siem.org/projects/prelude/wiki/InstallingPackageUbunt. alors qu'est-ce qu'il me manque quelque chose les gars ??

J'espère que tout le monde peut m'aider !, Merci d'avance.

2

Pour les paquets d'installation Prelude et Prewikka lors de la première utilisation:

  1. Avant l'installation nous avons besoin d'une base de données pour stocker les alertes, j'ai choisi de créer une base de données en MySQL

    _$ mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 8
    Server version: 8.0.13 MySQL Community Server - GPL    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.    
    Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.    
    mysql>CREATE USER user1@localhost IDENTIFIED BY 'pass';
    Query OK, 1 row affected (0,11 sec)    
    mysql>CREATE DATABASE prelude;
    Query OK, 1 row affected (2,09 sec)    
    mysql> GRANT ALL PRIVILEGES ON prelude.* TO user1@localhost;
    Query OK, 0 rows affected (0,93 sec)    
    mysql>CREATE DATABASE prewikka;
    Query OK, 1 row affected (2,10 sec)    
    mysql> GRANT ALL PRIVILEGES ON prelude.* TO user1@localhost;
    Query OK, 0 rows affected (0,94 sec)    
    mysql>FLUSH PRIVILEGES;
    mysql>EXIT;  
    _
  2. Prelude et Prewikka Installation requise

    _$ Sudo apt install prelude-utils prelude-manager prelude-lml libpreludedb*
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      dbconfig-common libmaxminddb0 prelude-lml-rules
    Suggested packages:
      dbconfig-mysql | dbconfig-pgsql | dbconfig-sqlite | dbconfig-sqlite3 | dbconfig-no-thanks mmdb-bin
    Recommended packages:
      default-mysql-client | postgresql-client
    The following NEW packages will be installed:
      dbconfig-common libmaxminddb0 libpreludedb0 libpreludedb7 libpreludedbcpp2 libpreludedb-dev libpreludedb-doc libpreludedb7-mysql libpreludedb7-pgsql libpreludedb7-sqlite prelude-lml prelude-lml-rules
      prelude-manager
    0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
    Need to get 968 kB of archives.
    After this operation, 3.881 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    _

    Pendant la configuration de dpkg, nous allons créer une base de données d’utilisateurs, une base de données de noms et une base de données de mots de passe stockées sur _dbconfig-common_. Si nous les avons oubliés comme dans mon cas, nous pouvons les vérifier dans le fichier _/etc/prewikka/prewikka.conf_.

  3. Configuration de l'enregistrement des agents.

    L'agent gestionnaire et l'agent client LML doivent exécuter des ensembles de commandes en tant que journaux d'analyse sur l'administrateur prélude.

    • Première chose à ajouter The Manager Agent avec ce qui suit:

      _$ prelude-admin add prelude-manager --uid 0 --gid 0 #for user id and group id, you can check on `/etc/passwd` file.
      Generating 2048 bits RSA private key... This might take a very long time.
      [Increasing system activity will speed-up the process].
      Generation in progress... 
      Created profile 'prelude-manager' with analyzerID 'xxxxxxxxxxxxxxxx'.  
      _
    • Deuxième chose à enregistrer L’agent LML avec ce qui suit:

      _$ prelude-admin register prelude-lml "idmef:w admin:r" 127.0.0.1 --uid 0 --gid 0
      Generating 2048 bits RSA private key... This might take a very long time.
      [Increasing system activity will speed-up the process].
      Generation in progress...   
      You now need to start "prelude-admin" registration-server on 127.0.0.1:
      example: "prelude-admin registration-server prelude-manager"  
      Enter the one-shot password provided on 127.0.0.1: 
      Confirm the one-shot password provided on 127.0.0.1:  
      Connecting to registration server (127.0.0.1:5553)... Authentication succeeded.
      Successful registration to 127.0.0.1:5553.  
      _

Sur l'agent du gestionnaire, exécutez:

_$ prelude-admin registration-server prelude-manager
The "password" password will be requested by "prelude-admin register"
in order to connect. Please remove the quotes before using it.  
Generating 1024 bits Diffie-Hellman key for anonymous authentication...
Waiting for peers install request on 0.0.0.0:5553...
Waiting for peers install request on :::5553...      
Connection from 127.0.0.1:45796...
Registration request for analyzerID="xxxxxxxxxxxxxxxx" permission="idmef:w admin:r".
Approve registration? [y/n]: y
127.0.0.1:45796 successfully registered.
_

Après validation du certificat, ne pas oublier de configurer le programme d'écoute du serveur sur le fichier _/etc/prelude/default/client.conf_, _/etc/prelude/default/global.conf_, _/etc/prelude-manager/prelude-manager.conf_ fichier et _/etc/prelude-lml/prelude-lml.conf_ fichier. et alors nous pouvons commencer le service de Prelude:

_$ Sudo systemctl enable prelude-manager
$ Sudo systemctl start prelude-manager
$ Sudo systemctl enable prelude-lml
$ Sudo systemctl start prelude-lml
_

Enfin après l'exécution du script _/usr/bin/prewikka_ python et nous obtiendrons le serveur d'écoute sous la forme _0.0.0.0:8000_ et nous pourrons tapez pour parcourir avec _localhost:8000_, si l'erreur de sortie n'apparaît pas, elle apparaîtra comme ci-dessous:

enter image description here

enter image description here

Sources: Prelude-WikiStart , Installation à partir des sources , Installation à partir de PackageUbunt .

0