Instalando PowerShell no Ubuntu 16.04

Olá amigos, satisfação em escrever novamente para vocês.

Hoje trago uma situação bem diferente, recentemente me deparei com um problema aonde precisava fazer um servidor linux  se conectar em uma maquina Windows.

A solução que adotei foi: Instalar o PoweShell no Ubuntu, e através dele fazer a conexão com a outra estação.

O PowerShell também está disponível para o Ubuntu 14.04, CentOS 7, Mac OS X e Docker

Segue abaixo o procedimento:

O pacote PowerShell depende de dois outros pacotes: libunwind8 e libicu55. Você pode instalá-los com o apt-get:

sudo apt-get install libunwind8 libicu55

O PowerShell ainda não está disponível nos repositórios do Ubuntu. Assim, você precisa baixar o pacote do PowerShell manualmente no GitHub.

wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.9/powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb

Agora você está pronto para instalar o pacote do PowerShell:

sudo dpkg -i powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb

 

Processo Finalizado:

Para iniciar o PowerShell, basta digitar “powershell” e você pode executar os comandos do PowerShell.

O procedimento é bem simples, qualquer duvida estou a disposição.

Continue Reading

Alterando o nome do host sem reboot no FreeBSD

Olá amigos, satisfação em escrever novamente para vocês.

As vezes nos deparemos com situações na qual precisamos fazer alguma migração ou alteração de host na qual é necessário mudar o nome do servidor sem reboot da maquina.
Recentemente me deparei com a necessidade de alterar o hostname de um banco de dados rodando no FreeBSD na qual não podia ser reiniciado no momento, com isso descrevi abaixo o processo de alteração.

Exibe o nome atual do host com o seguinte comando:

$ grep hostname /etc/rc.conf

OU

$ hostname

Conforme imagem abaixo podemos ver a saída no SO:

Procedimento para mudar o nome  do host noFreeBSD:

Digite o seguinte comando para editar /etc/rc.conf usando o editor de texto vi:
Exclua o nome antigo e configure o novo nome definido na variável hostname.

sudo vi /etc/rc.conf

Próximo Edite o arquivo / etc / hosts:
Substitua qualquer resquício do nome do computador antigo pelo novo.

sudo vi /etc/hosts

Observações:

Atualize o nome do host para a sessão atual digitando o seguinte comando:

sudo hostname novohostname

Opcional:

Reinicialize o sistema para que as alterações entrem em vigor ou para fins de teste:

sudo reboot

Como mudar o hostname do servidor FreeBSD sem reiniciar o sistema?

Digite os seguintes comandos no servidor FreeBSD:

$ sudo hostname novohostname

Em seguida, edite o arquivo /etc/rc.conf e atualize a variável hostname:

$ sudo vi /etc/rc.conf

Exemplo:

hostname = "novohostname"

Salve e feche o arquivo. Por fim, edite o arquivo /etc hosts  e atualize as linhas que contem seu nome de host antigo:

$ sudo vi /etc/hosts

A partir de:

127.0.0.1 antigohostname

Para:

127.0.0.1 novohostname

Salve e feche o arquivo.

 

Pronto pessoal seu hostname foi alterado com sucesso.

Qualquer duvida estou  a disposição

 

Continue Reading

Como instalar o Cacti no Centos7/RedHat7

Olá amigos, satisfação em escrever novamente para vocês.

Hoje veremos sobre o Cacti  que é uma ferramenta software livre administrativa de rede, que recolhe e exibe informações sobre o estado de uma rede de computadores através de gráficos, permitindo o monitoramento e gerenciamento de redes simples até redes complexas, com centenas de dispositivos. Foi desenvolvido para ser flexível de modo a se adaptar facilmente a diversas necessidades, bem como ser robusto e adicionando a isto uma interface Web intuitiva e fácil de usar. Monitora o estado de elementos de rede e programas bem como largura de banda utilizada e uso de CPU.

Instalando Apache

yum install httpd httpd-devel

Instalando MariaDB

yum install mariadb-server -y

Instalando PHP

yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli

Instalando PHP-SNMP

yum install php-snmp

Instalando NET-SNMP

yum install net-snmp-utils net-snmp-libs

Instalando RRDTool

yum install rrdtool

Iniciando Apache, MySQL e SNMP Services

systemctl start httpd.service
systemctl start mariadb.service
systemctl start snmpd.service

Configurando a inicialização com Sistema

systemctl enable httpd.service
systemctl enable mariadb.service
systemctl enable snmpd.service

Repositório + Nginx

yum install epel-release
yum install nginx

Instalando Cacti

yum install cacti

Definindo senha MYSQL

mysqladmin -u root password flisol2018

Acessar MYSQL:

mysql -u root -p

Rodar a Query

create database cacti;
GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'flisol';
GRANT ALL PRIVILEGES ON * . * TO 'cacti'@'localhost';
FLUSH privileges;
quit;

Criando tabelas

rpm -ql cacti | grep cacti.sql
mysql -u cacti -p cacti < /usr/share/doc/cacti-1.1.36/cacti.sql

Configurar conexão banco:

vim /etc/cacti/db.php

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "your-password-here";
$database_port = "3306";
$database_ssl = false;

Liberações Firewall

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

Configurando o Apache para aceitar as conexões

vim /etc/httpd/conf.d/cacti.conf

# httpd 2.4
Require all granted
# httpd 2.2
Order deny,allow
Deny from all
Allow from all

Reiniciar Apache

systemctl restart httpd.service
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Configurar Timezone no PHP

vim /ete/php.ini

date.timezone = "America/Sao_Paulo"

Habilitar a coleta dos graficos

sudo -u cacti /usr/bin/php /usr/share/cacti/poller.php

Acessando Aplicação:

Você deve abrir no navegador o endereço de ip apontando para o cacti, exemplo:

http://IP/cacti/

Algumas confirmações serão necessárias na interface web para concluir a instalação, após concluir a configuração da instalação  a interface web será aberta:

Pronto, sua instalação está realizada.

Estaremos criando um próximo artigo aonde mostra a configuração dos relatórios e equipamento para iniciar a analise com o Cacti.

 

Qualquer duvida estou a disposição.

Abraços

 

 

 

Continue Reading

Instalando Open-AudIT no Centos7/RedHat 7

Olá amigos, satisfação em escrever novamente para vocês.

Hoje veremos de maneira simples a instalação da ferramenta Open-AudIT no Linux.

O Open-AudIT também é suportado no Windows, porem não chegaremos a entrar neste método de instalação devido a performance da aplicação que ao ser executada no linux é superior ao Windows nesta situação.

Sistemas linux suportados: RedHat,Centos,Debian e Ubuntu.

Funcionalidades da Ferramenta

Open-AudIT é uma ferramenta de código livre que permite os administradores realizarem inventários de sua infraestrutura.

A propagação do agente pode ser realizado através de GPO para todos os computadores e servidor do domínio, assim a gestão de todos os ativos da sua rede podem ser controladas pela ferramenta.

Iniciando a instalação

Primeiramente se você tiver uma instalação mínima do Centos ou RedHat, provavelmente será necessário instalar o pacote perl-core para poder executar o instalador.

yum install perl-core

SELinux

Caso o  SELinux estiver rodando e ativo é necessário desativá-lo.

Parando a execução

setenforce 0

Para que não seja iniciado após uma reinicialização, edite o arquivo /etc/sysconfig/config e altere a linha:

SELINUX=enforcing

alterar para:

SELINUX=permissive

Firewall

Para desativar firewall completamente, execute os seguintes comandos:

service firewalld stop

Evitar a inicialização com SO:

chkconfig firewalld off

Instalando o Apache

yum install httpd -y

Agora, inicie o serviço Apache e ativá-lo na inicialização:

systemctl start httpd.service
systemctl enable httpd.service

Instalando o MySQL (MariaDB)

yum install mariadb-server mariadb -y

Quando a instalação for concluída, inicie o MariaDB e ative-a no boot:

systemctl start mariadb
systemctl enable mariadb

Depois de iniciar o MariaDB, execute o script de segurança inicial para remover alguns padrões arriscados:

mysql_secure_installation

Instalando o PHP

yum install php php-mysql -y

Para que o Apache reconheça o mecanismo PHP, reinicie-o:

systemctl restart httpd.service

Instalando o OpeAudIT

Realizando o Download do instalador:

wget http://dl-openaudit.opmantek.com/OAE-Linux-x86_64-release_2.1.1.run

Tornando o arquivo executável.

chmod +x "nome do arquivo"

Iniciando a instalação:

./"nome do arquivo"

Resumo do log da instalação:

++++++++++++++++++++++++++++++++++++++++++++++++++++++
Open-AudIT (1.4.0) Installation script
++++++++++++++++++++++++++++++++++++++++++++++++++++++
This installer will install Open-AudIT into /usr/local/omk.
To select a different installation location please rerun the installer with the -t option.
Ok to proceed with installation?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
++++++++++++++++++++++++++++++++++++++++++++++++++++++
performing pre-installation steps
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Opmantek daemon init scripts detected
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ok to shut down running Opmantek daemons for the duration of the installation?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Looking for old installations...
++++++++++++++++++++++++++++++++++++++++++++++++++++++
An old legacy installation was detected.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
The installer has found a pre-existing installation of one or more
Opmantek products in /usr/local/omk. 
The installation can proceed but may cause disruptions to installed legacy products other than Open-AudIT.
If you agree to continue, the installer will take a backup snapshot of your complete previous installation and then prepare the installation environment for Open-AudIT.
Do you want to continue the installation?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Creating legacy snapshot, please wait...
Snapshot created, file name: /root/omk-legacy-2014-08-20.tgz
The installer has created a full snapshot of your previous installion in /root/omk-legacy-2014-08-20.tgz. The installation of Open-AudIT will now proceed.
Should you need to revert to your previous installation status, simply remove all contents of /usr/local/omk and unpack the snapshot:
rm -rf /usr/local/omk/* && tar -C / -xzvf /root/omk-legacy-2014-08-20.tgz
Hit <Enter> when ready to continue: 
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Checking the Open-AudIT dependencies
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Required package mysql-server is installed.
Required package apache2 is installed.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Required packge apache2-utils is not installed.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Open-AudIT requires package apache2-utils to be installed and configured.
Do you want to install this package now?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Using apt-get to install apache2-utils
Required package libapache2-mod-proxy-html is installed.
Required package libapache2-mod-php5 is installed.
Required package openssh-client is installed.
Required package php5 is installed.
Required package php5-ldap is installed.
Required package php5-mcrypt is installed.
Required package php5-mysql is installed.
Required package php5-snmp is installed.
Required package nmap is installed.
Required package zip is installed.
Required package wget is installed.
Required package curl is installed.
Required package sshpass is installed.
Required package screen is installed.
Required package smbclient is installed.
Required package logrotate is installed.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Required packge libtime-parsedate-perl is not installed.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Open-AudIT requires package libtime-parsedate-perl to be installed and configured.
Do you want to install this package now?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Using apt-get to install libtime-parsedate-perl
-------COMMAND RETURNED EXIT CODE 100--------
apt-get -yq install libtime-parsedate-perl Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package libtime-parsedate-perl
----------------------------------------
Looking for an existing Open-AudIT Community installation...
Do you want to perform a backup of your Open-AudIT installation?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Backing up database openaudit
Open-AudIT Backup created successfully, file name: /root/open-audit-backup-2014-08-20.tgz
++++++++++++++++++++++++++++++++++++++++++++++++++++++
copying files
++++++++++++++++++++++++++++++++++++++++++++++++++++++
........................................................................................................................................................................................................................................................................
++++++++++++++++++++++++++++++++++++++++++++++++++++++
done copying files
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
performing post-installation operations
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Open-AudIT needs the live configuration files in /usr/local/omk/conf/, and ships the defaults in /usr/local/omk/install/. If you agree, the installer will copy all missing files to the live configuration directory - it will not overwrite any files that are already present.
Ok to copy new or missing config files into the live configuration directory?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Init script for Opmantek daemon already present.
Installing conveniece symlinks
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Updated logrotation config file omk-rotate.conf available
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ok to install the updated logrotation config file omk-rotate.conf?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Updated logrotation config file open-audit-rotate.conf available
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ok to install the updated logrotation config file open-audit-rotate.conf?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Upgrading Opmantek Modules file
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjusting users, ownerships and permissions
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Priming remaining directories
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Configuration Updates
++++++++++++++++++++++++++++++++++++++++++++++++++++++
The new version of Open-AudIT may have introduced new configuration items, which can be added automatically (with their default settings).
Do you want to import any new configuration settings now?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Updating common config with new defaults.
Apache config directory unknown or non-existent, cannot install proxy config file!
Please note that the GUI for your Open-AudIT installation will only be available
at the URL http://localhost:8042/ until you configure Apache, and enable the Apache proxy with the config file ./install/04omk-proxy.conf or equivalent.
Hit <Enter> when ready to continue.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Installing Open-AudIT files
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copying Open-AudIT Web files
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Upgrade of existing Open-AudIT installation, no database initialisation required.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
performing final update operations
++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjusting Open-AudIT for standalone operation
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjusting Login Banner
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Detecting Configuration Changes
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Would you like to see an overview of all changed configuration items?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Performing config diff check, please wait...
Can't locate Time/ParseDate.pm in @INC (you may need to install the Time::ParseDate module) (@INC contains: /usr/local/omk/bin/../lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/omk/bin/../lib/OMK/Common.pm line 74.
BEGIN failed--compilation aborted at /usr/local/omk/bin/../lib/OMK/Common.pm line 74.
Compilation failed in require at /usr/local/omk/bin/opdiffconfigs.pl line 40.
BEGIN failed--compilation aborted at /usr/local/omk/bin/opdiffconfigs.pl line 40.
Can't locate Time/ParseDate.pm in @INC (you may need to install the Time::ParseDate module) (@INC contains: /usr/local/omk/bin/../lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/omk/bin/../lib/OMK/Common.pm line 74.
BEGIN failed--compilation aborted at /usr/local/omk/bin/../lib/OMK/Common.pm line 74.
Compilation failed in require at /usr/local/omk/bin/opdiffconfigs.pl line 40.
BEGIN failed--compilation aborted at /usr/local/omk/bin/opdiffconfigs.pl line 40.
The configuration comparison tool has detected some differences between the shipped defaults (in /usr/local/omk/install) and the active settings (in /usr/local/omk/conf). 
The affected files are:  opModules.nmis opCommon.nmis
A detailed listing of these differences has been saved in /tmp/Open-AudIT-config-diffs-2014-08-20.
You should review those differences (using less or an editor like nano, vi or emacs) and adjust your configuration settings accordingly.
Hit <Enter> when ready to continue: 
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Opmantek Daemon Startup
++++++++++++++++++++++++++++++++++++++++++++++++++++++
The Opmantek daemon can now be started. It needs to be active to provide the Open-AudIT GUI, but you might want to delay that operation until you have adjusted the configuration files.
Do you want to start the Opmantek daemon now?
Type 'y' or hit <Enter> to accept, any other key for 'no': y
Starting OMKD
opEvents not installed or opEvents daemon init script not installed as /etc/init.d/opeventsd.
opConfig not installed or opConfig daemon init script not installed as /etc/init.d/opconfigd.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Open-AudIT is Ready for Configuration
++++++++++++++++++++++++++++++++++++++++++++++++++++++
This initial installation of Open-AudIT is now complete.
However, to configure and fine-tune the application suitably for your environment you will need to make certain configuration adjustments.
We highly recommend that you visit the documentation site for Open-AudIT at https://community.opmantek.com/display/OA/Home which will help you to determine what configuration changes may be required for your environment.
If you have started the Opmantek daemon, then your new Open-AudIT dashboard should now be accessible at http://<HOSTNAME_OR_IP>/omk/oae/
If your browser is running on the same machine as Open-AudIT was installed onto, this would be http://localhost/omk/oae/
++++++++++++++++++++++++++++++++++++++++++++++++++++++
installation complete.
++++++++++++++++++++++++++++++++++++++++++++++++++++++

Acessando a interface WEB

http://IP>/omk/oae/

Conclusão

A interface WEB tem varias funcionalidades que é bacana ser estudadas.
Para gestão de grandes ambientes você pode realizar seperação por grupos e criar varias visões customizadas.

Espero que todos gostem e qualquer duvida estou a disposição. Abraços

Continue Reading

How to Stop and Start Firewalld on Centos 7 and Red Hat 7

Default installations of the CentOS 7 Linux operating system have the firewalld firewall installed and enabled by default as a security measure, but how can we disable it?

Disable Firewalld:
To disable firewalld, run the command as root:

systemctl disable firewalld

Stop Firewalld
To stop firewalld:

systemctl stop firewalld

Check the Status of Firewalld
And finally, to check the status of firewall:

systemctl status firewalld

Enable Firewalld
To enable firewalld, run the following command as root:

systemctl enable firewalld

Start Firewalld
To start firewalld, run the following command as root:

systemctl start firewalld

Check the Status of Firewalld

To check the status of firewalld, run the following command as root:

systemctl status firewalld

Continue Reading