-> Kibana ->Logstash ->Elasticsearch ->Wazuh API ->Wazuh Manager ->Wazuh Agent
IP da VM
172.16.50.5
Porta SSH
51321
User: root
Senha: Zxvc@1234
IP WEB
127.16.50.5:5601
Adicionando Agente no Gerenciador Wazuh
Adicionando Agente no Gerenciador Wazuh
1 - No servidor Wazuh digite:
/var/ossec/bin/manage_agents
A seguinte tela aparecerá
2 – Selecione A para adicionar um agente. Será solicitado o nome do agente (use o nome do host do agente ou outro nome arbitrário), depois digite o endereço IP do agente e posteriormente o ID do agente (esse campo pode ser deixado em branco para atribuir automaticamente um ID). Feito isso, confirme teclando “Y”.
Extrair key do agente a ser adicionado
Para a instalação do agente na máquina desejada, será necessário extrair a chave do agente no qual deseja efetuar a instalação. Para extrair a chave, siga os seguintes passos:
1 - No servidor Wazuh digite:
/var/ossec/bin/manage_agents
2 – Tecle “E”, e depois digite a ID do agente desejado.
3 – Copie a Key para que seja usada no agente desejado.
Remover agente do servidor
Remover agente do servidor
1 - No servidor Wazuh digite:
/var/ossec/bin/manage_agents
2 – Tecle “R”, e depois digite a ID do agente desejado. Feito isso, confirme teclando “Y”.
Instalar agente windows
Instalar agente windows
Para que o computador desejado seja monitorado pelo Wazuh, se faz necessário a instalação de um agente que será responsável pela comunicação entre o computador e o servidor Wazuh. Para efetuar a instalação em uma máquina Windows, siga os seguintes passos:
2 – Selecione o arquivo correspondente a versão para Windows e efetue o download.
3 – Após o download, efetue a instalação do agente, concordando com os termos de uso, e ao final da instalação selecione a checkbox “Run Agent configuration interface” e dê enter.
4 – Com a tela do agente aberta, no campo “Manager IP” digite o endereço IP do servidor Wazuh, e no campo “Authentication Key” digite ou cole a Key extraída no servidor wazuh para o agente desejado. Feito isso, clique em “Save”.
5 – Para iniciar o monitoramento, clique em “Manager” e depois em “Start”. Feito isso, o computador estará registrado no servidor wazuh e começará a enviar os logs.
Instalar agente linux
Instalar agente linux
Para efetuar a instalação do Wazuh no Linux, primeiro identifique a versão do seu S.O.
1 - O primeiro passo para instalar o agente Wazuh é adicionar o repositório Wazuh ao computador CentOS desejado. Para isso configure o repositório executando os seguintes comandos no terminal:
2 – Ainda no terminal, execute o seguinte comando para a instalação:
# yum install wazuh-agent
3- Após a instalação, efetuaremos o registro do agente. Para isso, no terminal, execute o seguinte comando:
# /var/ossec/bin/manage_agents
A seguinte tela aparecerá:
4 – Pressione a tecla “I” e dê Enter. Após isso, cole ou digite a Key extraída no servidor wazuh para o agente desejado. Confirme a adição teclando “Y”. Feito isso, digite “Q” e tecle Enter para sair da configuração.
5 – Edite o arquivo de configuração “Ossec.conf” para adicionar o endereço IP do servidor Wazuh. Para isso, digite no terminal:
# vim /var/ossec/etc/ossec.conf
Na sessão cliente, altere o MANAGER IP para o endereço do Servidor Wazuh.
6 – Reinicie o agente com o seguinte comando:
# /var/ossec/bin/ossec-control restart
Atribuindo agentes a grupos
Atribuindo agentes a grupos
Depois que um agente for adicionado ao gerenciador, você pode atribui-lo a um grupo usando a ferramenta agente_groups. Segue abaixo um exemplo de como atribuir um agente com ID 002 ao grupo 'Servidores_Detic' usando estes métodos:
1 – No servidor Wazuh digite o seguinte comando no terminal:
# /var/ossec/bin/agent_groups -a -i 002 -g Servidores_Detic
Configurando alertas por e-mail
Configurando alertas por e-mail
Como o servidor SMTP da DETIC utiliza autenticação, uma retransmissão do servidor precisará ser configurada, pois o Wazuh não suporta isso. O postfix pode ser configurado para fornecer esse recurso. O guia a seguir descreve a configuração mínima necessária para usar o Postfix para enviar e-mails.
1 – Instale os pacotes necessários, utilizando o seguinte comando:
7 – Para configurar o Wazuh para enviar os alertas de e-mail, as configurações de e-mail devem ser configuradas na seção < global > do arquivo “ossec.conf”. Para isso, utilizando o editor de sua preferência, edite o arquivo /var/ossec/etc/ossec.conf. No campo < global>, deixe o arquivo da seguinte maneira:
8 – Após a configuração acima, precisamos definir o nível mínimo de alerta que irá acionar um e-mail. Por padrão, o nível é definido como 7. Se desejar mudar, basta alterar o número referente ao nível dentro do campo: < email_alert_level >. No exemplo abaixo, definiremos o nível mínimo como 10:
9 – Ao final da edição do arquivo “ossec.conf”, precisamos reiniciar o wazuh-manager. Para isso, utilizaremos o seguinte comando:
# systemctl restart wazuh-manager
Instalando e configurando Openscap Scanner
Instalando e configurando Openscap Scanner
O OpenScap Scanner funciona somente em máquinas Linux, e precisa ser instalado e configurado após a instalação do agente wazuh. Segue abaixo os passos para a instalação:
1 – No agente desejado, efetue a instalação do open-scap scanner utilizando o seguinte comando:
# yum install openscap-scanner
2 – Após a instalação do openscap-scanner, com o editor de sua preferência, abra o arquivo: /var/ossec/etc/ossec.conf. Feito isso, procure: “< wodle name=“open-scap”>” e altere o campo “< disabled>no < /disabled>” para “< disabled>yes < /disabled>”.
3 – Salve o arquivo e reinicie o ossec-control com o seguinte comando:
#mysql -u root -p
mysql> create database glpi;
mysql> create user 'glpi'@'localhost' identified by 'trh!169KHYC';
mysql> grant all on glpi.* to glpi identified by 'trh!169KHYC';
mysql> quit;
Continuar instalação através do navegador
Continuar instalação através do navegador
1 - Acessar o GLPI através do navegador pelo IP ou domínio
2 - Selecionar idioma
3 - verificar lista de dos requisitos de instalação e continuar se todos os requisitos estiverem ok, do contrário realizar as instalações de dependências que for solicitado.
4 - Conectar com o banco de dados usando o usuário e senha criados no passo 5.
PostgreSQL 9.5 ou superior - Node.JS 14.0 ou superior - Proxy reverso para o apontamento DNS
Este manual considera PostgreSQL 13.0 e NodeJS 16.6.0, sendo executados num ambiente Debian 10.
{.is-info}
Configuração do PostgreSQL
1. Primeiramente, atualize o sistema operacional ```` sudo apt update sudo apt -y upgrade ````
2. Após a instalação das atualizações, reinicie o server ```` sudo reboot ````
3. Antes de configurar o repositório, importe a chave GPG utilizada para a assinatura dos pacotes ```` sudo apt update sudo apt -y install gnupg2 wget –quiet -O -https://www.postgresql.org/media/keys/ACCC4CF8.asc| sudo apt-key add - ````
4. Adicione o repositório do PostgreSQL ```` echo “debhttp://apt.postgresql.org/pub/repos/apt/`lsb_release -cs`-pgdg main” |sudo tee /etc/apt/sources.list.d/pgdg.list ````
5. Verifique se o repositório foi adicionado corretamente usando o comando `cat` ```` $ cat /etc/apt/sources.list.d/pgdg.list deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main ````
6. Atualize a lista de pacotes do sistema ```` sudo apt update ````
8. Inicie o servidor do BD ```` sudo pg_ctlcluster 13 main start ````
9. Confirme o status do serviço utilizando o `journalctl` ```` $ systemctl status postgresql@13-main.service ● postgresql@13-main.service - PostgreSQL Cluster 13-main
Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)
Active: active (running) since Fri 2020-10-30 11:27:01 CET; 2min 11s ago
Oct 30 11:26:59 debian systemd[1]: Starting PostgreSQL Cluster 13-main… Oct 30 11:27:01 debian systemd[1]: Started PostgreSQL Cluster 13-main. ````
10. Inicie o prompt do PostgreSQL ```` $ sudo su - postgres postgres@debian:~$ psql psql (13.0 (Debian 13.0-1.pgdg100+1)) Type “help” for help.
postgres=# ````
11. Altere a senha do usuário `postgres` ```` postgres=# alter user postgres with password 'S3nh4F0rt3'; ````
12. Crie um usuário no BD para a wiki ```` postgres=# CREATE ROLE adminwiki WITH SUPERUSER CREATEDB CREATEROLE LOGIN ENCRYPTED PASSWORD 'S3nh4F0rt3'; ````
13. Você pode conferir quais os usuários existentes com o comando `\du` ```` postgres-# \du
List of roles
Role name | Attributes | Member of ————+————————————————————+———– adminwiki | Superuser, Create role, Create DB | {} postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} ````
14. Crie o banco de dados ```` postgres-# CREATE DATABASE wiki; ````
15. Dê privilégios de acesso ao banco recém-criado para o usuário criado anteriormente ```` postgres-# GRANT ALL PRIVILEGES ON DATABASE wiki TO adminwiki; ````
16. Você pode conferir quais os usuários existentes com o comando `\l` ```` postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
17. Edite o arquivo `pg_hba.conf`, alterando o método de login para `md5` ```` # TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections: host all all 127.0.0.1/32 md5 ````
Modelo para referência ```` # USER can be “all”, a user name, a group name prefixed with “+”, or a # comma-separated list thereof. In both the DATABASE and USER fields # you can also write a file name prefixed with “@” to include names # from a separate file. # # ADDRESS specifies the set of hosts the record matches. It can be a # host name, or it is made up of an IP address and a CIDR mask that is # an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that # specifies the number of significant bits in the mask. A host name # that starts with a dot (.) matches a suffix of the actual host name. # Alternatively, you can write an IP address and netmask in separate # columns to specify the set of hosts. Instead of a CIDR-address, you # can write “samehost” to match any of the server's own IP addresses, # or “samenet” to match any address in any subnet that the server is # directly connected to. # # METHOD can be “trust”, “reject”, “md5”, “password”, “scram-sha-256”, # “gss”, “sspi”, “ident”, “peer”, “pam”, “ldap”, “radius” or “cert”. # Note that “password” sends passwords in clear text; “md5” or # “scram-sha-256” are preferred since they send encrypted passwords. # # OPTIONS are a set of options for the authentication in the format # NAME=VALUE. The available options depend on the different # authentication methods – refer to the “Client Authentication” # section in the documentation for a list of which options are # available for which authentication methods. # # Database and user names containing spaces, commas, quotes and other # special characters must be quoted. Quoting one of the keywords # “all”, “sameuser”, “samerole” or “replication” makes the name lose # its special character, and just match a database or username with # that name. # # This file is read on server startup and when the server receives a # SIGHUP signal. If you edit the file on a running system, you have to # SIGHUP the server for the changes to take effect, run “pg_ctl reload”, # or execute “SELECT pg_reload_conf()”. # # Put your actual configuration here # ———————————- # # If you want to allow non-local connections, you need to add more # “host” records. In that case you will also need to make PostgreSQL # listen on a non-local interface via the listen_addresses # configuration parameter, or via the -i or -h command line switches.
# TYPE DATABASE USER ADDRESS METHOD
# “local” is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. local replication all peer host replication all 127.0.0.1/32 ident host replication all ::1/128 ident ````
18. Reinicie o serviço para que as configurações entrem em vigor ```` systemctl restart postgresql@13-main.service ````
# ——————————————————————— # Port the server should listen to # ———————————————————————
port: 3000
# ——————————————————————— # Database # ——————————————————————— # Supported Database Engines: # - postgres = PostgreSQL 9.5 or later # - mysql = MySQL 8.0 or later (5.7.8 partially supported, refer to docs) # - mariadb = MariaDB 10.2.7 or later # - mssql = MS SQL Server 2012 or later # - sqlite = SQLite 3.9 or later
db:
type: postgres
# PostgreSQL / MySQL / MariaDB / MS SQL Server only:
host: localhost
port: 5432
user: wikijs
pass: wikijsrocks
db: wiki
ssl: false
# Optional - PostgreSQL / MySQL / MariaDB only:
# -> Uncomment lines you need below and set `auto` to false
# -> Full list of accepted options: https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options
sslOptions:
auto: true
# rejectUnauthorized: false
# ca: path/to/ca.crt
# cert: path/to/cert.crt
# key: path/to/key.pem
# pfx: path/to/cert.pfx
# passphrase: xyz123
# SQLite only:
storage: path/to/database.sqlite
####################################################################### # ADVANCED OPTIONS # ####################################################################### # Do not change unless you know what you are doing!
# ——————————————————————— # SSL/TLS Settings # ——————————————————————— # Consider using a reverse proxy (e.g. nginx) if you require more # advanced options than those provided below.
ssl
enabled: false
port: 3443
# Provider to use, possible values: custom, letsencrypt
provider: custom
# ++++++ For custom only ++++++
# Certificate format, either 'pem' or 'pfx':
format: pem
# Using PEM format:
key: path/to/key.pem
cert: path/to/cert.pem
# Using PFX format:
pfx: path/to/cert.pfx
# Passphrase when using encrypted PEM / PFX keys (default: null):
passphrase: null
# Diffie Hellman parameters, with key length being greater or equal
# to 1024 bits (default: null):
dhparam: null
# ++++++ For letsencrypt only ++++++
domain: wiki.yourdomain.com
subscriberEmail: admin@example.com
# ——————————————————————— # Database Pool Options # ——————————————————————— # Refer to https://github.com/vincit/tarn.js for all possible options
pool
# min: 2
# max: 10
# ——————————————————————— # IP address the server should listen to # ——————————————————————— # Leave 0.0.0.0 for all interfaces
bindIP: 0.0.0.0
# ——————————————————————— # Log Level # ——————————————————————— # Possible values: error, warn, info (default), verbose, debug, silly
logLevel: info
# ——————————————————————— # Offline Mode # ——————————————————————— # If your server cannot access the internet. Set to true and manually # download the offline files for sideloading.
offline: false
# ——————————————————————— # High-Availability # ——————————————————————— # Set to true if you have multiple concurrent instances running off the # same DB (e.g. Kubernetes pods / load balanced instances). Leave false # otherwise. You MUST be using PostgreSQL to use this feature.
ha: false
# ——————————————————————— # Data Path # ——————————————————————— # Writeable data path used for cache and temporary user uploads. dataPath: ./data ````
5. Por razões de segurança, nós queremos que o serviço seja executado por um usuário sem privilégios. Para tal, criaremos um usuário e grupo respectivo. ```` groupadd -r wikijs useradd -r -s /bin/false -g wikijs wikijs chown -R wikijs:wikijs < /var/wiki/> ````
6. Crie o serviço ```` vim /etc/systemd/system/wiki.service ````
Modelo para referência ```` [Unit] Description=Wiki.js After=network.target
[Service] Type=simple ExecStart=/usr/bin/node server Restart=always # Consider creating a dedicated user for Wiki.js here: User=nobody Environment=NODE_ENV=production WorkingDirectory=/var/wiki
[Install] WantedBy=multi-user.target ````
7. Antes de prosseguir, é necessário recarregar o systemd ```` systemctl daemon-reload ````
8. Ative e inicie o serviço ```` systemctl enable –now wiki ````
9. Para acompanhar o status de execução do serviço, use o `journalctl` ```` journalctl -u wiki ````