first commit
This commit is contained in:
commit
365085c2b4
153
README.md
Executable file
153
README.md
Executable file
|
@ -0,0 +1,153 @@
|
||||||
|
<img src="https://linuxhint.com/wp-content/uploads/2019/05/Getting-started-with-OSSEC.jpg" width="50%">
|
||||||
|
|
||||||
|
# Install OSSEC XDR:
|
||||||
|
<br>
|
||||||
|
Version en cours 3.7 (voir le repo github en fin du README):
|
||||||
|
<br>
|
||||||
|
|
||||||
|
# Pour Linux:
|
||||||
|
|
||||||
|
<code>apt-get upgrade -y</code>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
# Install du repository
|
||||||
|
<code>wget -q -O - https://updates.atomicorp.com/installers/atomic | sudo bash</code><br>
|
||||||
|
|
||||||
|
# Update
|
||||||
|
<code>sudo apt-get update</code><br>
|
||||||
|
|
||||||
|
# Server
|
||||||
|
<code>sudo apt-get install ossec-hids-server</code><br>
|
||||||
|
|
||||||
|
# Agent
|
||||||
|
<code>sudo apt-get install ossec-hids-agent</code><br>
|
||||||
|
|
||||||
|
|
||||||
|
<code>addgroup user ossec</code><br>
|
||||||
|
changer user par votre utilisateur.<br>
|
||||||
|
|
||||||
|
<code>nano /var/ossec/etc/ossec.conf</code>
|
||||||
|
```
|
||||||
|
<global>
|
||||||
|
<email_notification>yes</email_notification>
|
||||||
|
<email_to>root@localhost</email_to>
|
||||||
|
<smtp_server>127.0.0.1</smtp_server>
|
||||||
|
<email_from>ossecm@localhost</email_from>
|
||||||
|
</global>
|
||||||
|
```
|
||||||
|
```
|
||||||
|
<syscheck>
|
||||||
|
<!-- Frequency that syscheck is executed - default to every 22 hours -->
|
||||||
|
<frequency>79200</frequency>
|
||||||
|
<alert_new_files>yes</alert_new_files>
|
||||||
|
```
|
||||||
|
```
|
||||||
|
<!-- Directories to check (perform all possible verifications) -->
|
||||||
|
<directories check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
|
||||||
|
<directories check_all="yes">/bin,/sbin</directories>
|
||||||
|
|
||||||
|
<directories report_changes="yes" realtime="yes" check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
|
||||||
|
<directories report_changes="yes" realtime="yes" check_all="yes">/var/www,/bin,/sbin</directories>
|
||||||
|
```
|
||||||
|
|
||||||
|
<code>nano /var/ossec/rules/local_rules.xml</code>
|
||||||
|
```
|
||||||
|
<rule id="554" level="7" overwrite="yes">
|
||||||
|
<category>ossec</category>
|
||||||
|
<decoded_as>syscheck_new_entry</decoded_as>
|
||||||
|
<description>File added to the system.</description>
|
||||||
|
<group>syscheck,</group>
|
||||||
|
</rule>
|
||||||
|
```
|
||||||
|
# Generation des clefs:
|
||||||
|
<code>
|
||||||
|
openssl genrsa -out /var/ossec/etc/client.keys 2048
|
||||||
|
</code>
|
||||||
|
<br>
|
||||||
|
<code>
|
||||||
|
openssl req -new -x509 -key /var/ossec/etc/client.keys -out /var/ossec/etc/client.cert -days 365
|
||||||
|
</code>
|
||||||
|
|
||||||
|
<code>/var/ossec/bin/ossec-control restart</code>
|
||||||
|
|
||||||
|
<code>
|
||||||
|
chmod 775 -R /var/ossec
|
||||||
|
</code>
|
||||||
|
<br>
|
||||||
|
<code>
|
||||||
|
chown -R ossec:ossec /var/ossec
|
||||||
|
</code>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo touch /var/log/messages
|
||||||
|
sudo touch /var/log/authlog
|
||||||
|
sudo touch /var/log/authlog
|
||||||
|
sudo touch /var/log/secure
|
||||||
|
sudo touch /var/log/authlog
|
||||||
|
sudo touch /var/log/xferlog
|
||||||
|
|
||||||
|
sudo mkdir /var/www/logs/
|
||||||
|
sudo touch /var/www/logs/access_log
|
||||||
|
sudo touch /var/www/logs/error_log
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Si error queue:<br>
|
||||||
|
<code>sudo apt-get install ossec-hids-server</code>
|
||||||
|
|
||||||
|
# Install OSSEC Web UI Version 1.0 pas 0.8 /!\
|
||||||
|
|
||||||
|
La version 0.8
|
||||||
|
wget https://github.com/ossec/ossec-wui/archive/master.zip
|
||||||
|
|
||||||
|
# Ma contribution Ossec Web Gui pour Php 8.1 ou +
|
||||||
|
|
||||||
|
unzip ossec_1.0.zip
|
||||||
|
mv ossec /var/www
|
||||||
|
attention à votre chemin apache web (/var/www/html)
|
||||||
|
<code>
|
||||||
|
chown -R www-data:www-data /var/www/ossec
|
||||||
|
</code>
|
||||||
|
<code>
|
||||||
|
chmod -R 775 /var/www/ossec
|
||||||
|
</code>
|
||||||
|
<code>cd /var/www/ossec</code>
|
||||||
|
|
||||||
|
<code>./setup.sh</code>
|
||||||
|
|
||||||
|
Username: admin
|
||||||
|
New password:
|
||||||
|
Re-type new password:
|
||||||
|
Adding password for user admin
|
||||||
|
Enter your web server user name (e.g. apache, www, nobody, www-data, ...)
|
||||||
|
www-data
|
||||||
|
You must restart your web server after this setup is done.
|
||||||
|
|
||||||
|
Setup completed successfully.
|
||||||
|
|
||||||
|
<code>systemctl restart apache2</code>
|
||||||
|
|
||||||
|
|
||||||
|
verifier les process:
|
||||||
|
```
|
||||||
|
ossecm 2389 0.0 0.0 3740 416 ? S 11:37 0:00 /var/ossec/bin/ossec-maild<br>
|
||||||
|
root 2393 0.0 0.0 2988 328 ? S 11:37 0:00 /var/ossec/bin/ossec-execd<br>
|
||||||
|
ossec 2397 0.3 0.1 8280 6844 ? S 11:37 0:00 /var/ossec/bin/ossec-analysisd<br>
|
||||||
|
root 2401 0.0 0.0 7124 456 ? S 11:37 0:00 /var/ossec/bin/ossec-logcollector<br>
|
||||||
|
root 2411 0.0 0.0 3908 404 ? S 11:37 0:00 /var/ossec/bin/ossec-syscheckd<br>
|
||||||
|
ossec 2415 0.0 0.0 3884 1472 ? S 11:37 0:00 /var/ossec/bin/ossec-monitord<br>
|
||||||
|
```
|
||||||
|
|
||||||
|
check mail<br>
|
||||||
|
|
||||||
|
<code>apt install mutt</code>
|
||||||
|
<br>
|
||||||
|
<code>sudo mutt</code>
|
||||||
|
|
||||||
|
# Pour Windows Agent:
|
||||||
|
Voir ossec-agent-win32-3.2.0-6132.exe
|
||||||
|
|
||||||
|
Le fichier ossec-hids-3.2.0.tar.gz est les sources en version 3.2
|
||||||
|
|
||||||
|
voir le GitHub de OSSEC:
|
||||||
|
https://github.com/ossec/ossec-hids
|
BIN
ossec-agent-win32-3.7.0-24343.exe
Normal file
BIN
ossec-agent-win32-3.7.0-24343.exe
Normal file
Binary file not shown.
BIN
ossec-hids-3.7.0.tar.gz
Normal file
BIN
ossec-hids-3.7.0.tar.gz
Normal file
Binary file not shown.
BIN
ossec.1.0.zip
Normal file
BIN
ossec.1.0.zip
Normal file
Binary file not shown.
69
ossec.conf.cli
Executable file
69
ossec.conf.cli
Executable file
|
@ -0,0 +1,69 @@
|
||||||
|
<!-- OSSEC example config -->
|
||||||
|
|
||||||
|
<ossec_config>
|
||||||
|
<client>
|
||||||
|
<server-ip>192.168.0.10</server-ip>
|
||||||
|
</client>
|
||||||
|
<global>
|
||||||
|
<email_notification>yes</email_notification>
|
||||||
|
<email_to>root@localhost</email_to>
|
||||||
|
<smtp_server>127.0.0.1</smtp_server>
|
||||||
|
<email_from>ossecm@localhost</email_from>
|
||||||
|
</global>
|
||||||
|
<syscheck>
|
||||||
|
<!-- Frequency that syscheck is executed (default every 2 hours) -->
|
||||||
|
<frequency>79200</frequency>
|
||||||
|
<alert_new_files>yes</alert_new_files>
|
||||||
|
<!-- Directories to check (perform all possible verifications) -->
|
||||||
|
<directories report_changes="yes" realtime="yes" check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
|
||||||
|
<directories report_changes="yes" realtime="yes" check_all="yes">/bin,/sbin,/boot</directories>
|
||||||
|
|
||||||
|
<!-- Files/directories to ignore -->
|
||||||
|
<ignore>/etc/mtab</ignore>
|
||||||
|
<ignore>/etc/hosts.deny</ignore>
|
||||||
|
<ignore>/etc/mail/statistics</ignore>
|
||||||
|
<ignore>/etc/random-seed</ignore>
|
||||||
|
<ignore>/etc/random.seed</ignore>
|
||||||
|
<ignore>/etc/adjtime</ignore>
|
||||||
|
<ignore>/etc/httpd/logs</ignore>
|
||||||
|
|
||||||
|
<!-- Check the file, but never compute the diff -->
|
||||||
|
<nodiff>/etc/ssl/private.key</nodiff>
|
||||||
|
</syscheck>
|
||||||
|
|
||||||
|
<rootcheck>
|
||||||
|
<rootkit_files>/var/ossec/etc/shared/rootkit_files.txt</rootkit_files>
|
||||||
|
<rootkit_trojans>/var/ossec/etc/shared/rootkit_trojans.txt</rootkit_trojans>
|
||||||
|
</rootcheck>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/messages</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/authlog</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/auth.log</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/secure</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/xferlog</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/maillog</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
</ossec_config>
|
224
ossec.conf.srv
Normal file
224
ossec.conf.srv
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
<!-- OSSEC example config -->
|
||||||
|
|
||||||
|
<ossec_config>
|
||||||
|
<global>
|
||||||
|
<!—Our LAN -->
|
||||||
|
<white_list>192.168.0.0/24</white_list>
|
||||||
|
<!-- Server -->
|
||||||
|
<white_list>127.0.0.1</white_list>
|
||||||
|
<white_list>192.168.0.10</white_list>
|
||||||
|
<white_list>1.1.1.1</white_list>
|
||||||
|
<email_notification>yes</email_notification>
|
||||||
|
<email_to>root@localhost</email_to>
|
||||||
|
<smtp_server>127.0.0.1</smtp_server>
|
||||||
|
<email_from>ossecm@localhost</email_from>
|
||||||
|
</global>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<include>rules_config.xml</include>
|
||||||
|
<include>pam_rules.xml</include>
|
||||||
|
<include>sshd_rules.xml</include>
|
||||||
|
<include>telnetd_rules.xml</include>
|
||||||
|
<include>syslog_rules.xml</include>
|
||||||
|
<include>arpwatch_rules.xml</include>
|
||||||
|
<include>symantec-av_rules.xml</include>
|
||||||
|
<include>symantec-ws_rules.xml</include>
|
||||||
|
<include>pix_rules.xml</include>
|
||||||
|
<include>named_rules.xml</include>
|
||||||
|
<include>smbd_rules.xml</include>
|
||||||
|
<include>vsftpd_rules.xml</include>
|
||||||
|
<include>pure-ftpd_rules.xml</include>
|
||||||
|
<include>proftpd_rules.xml</include>
|
||||||
|
<include>ms_ftpd_rules.xml</include>
|
||||||
|
<include>ftpd_rules.xml</include>
|
||||||
|
<include>hordeimp_rules.xml</include>
|
||||||
|
<include>roundcube_rules.xml</include>
|
||||||
|
<include>wordpress_rules.xml</include>
|
||||||
|
<include>cimserver_rules.xml</include>
|
||||||
|
<include>vpopmail_rules.xml</include>
|
||||||
|
<include>vmpop3d_rules.xml</include>
|
||||||
|
<include>courier_rules.xml</include>
|
||||||
|
<include>web_rules.xml</include>
|
||||||
|
<include>web_appsec_rules.xml</include>
|
||||||
|
<include>apache_rules.xml</include>
|
||||||
|
<include>nginx_rules.xml</include>
|
||||||
|
<include>php_rules.xml</include>
|
||||||
|
<include>mysql_rules.xml</include>
|
||||||
|
<include>postgresql_rules.xml</include>
|
||||||
|
<include>ids_rules.xml</include>
|
||||||
|
<include>squid_rules.xml</include>
|
||||||
|
<include>firewall_rules.xml</include>
|
||||||
|
<include>apparmor_rules.xml</include>
|
||||||
|
<include>cisco-ios_rules.xml</include>
|
||||||
|
<include>netscreenfw_rules.xml</include>
|
||||||
|
<include>sonicwall_rules.xml</include>
|
||||||
|
<include>postfix_rules.xml</include>
|
||||||
|
<include>sendmail_rules.xml</include>
|
||||||
|
<include>imapd_rules.xml</include>
|
||||||
|
<include>mailscanner_rules.xml</include>
|
||||||
|
<include>dovecot_rules.xml</include>
|
||||||
|
<include>ms-exchange_rules.xml</include>
|
||||||
|
<include>racoon_rules.xml</include>
|
||||||
|
<include>vpn_concentrator_rules.xml</include>
|
||||||
|
<include>spamd_rules.xml</include>
|
||||||
|
<include>msauth_rules.xml</include>
|
||||||
|
<include>mcafee_av_rules.xml</include>
|
||||||
|
<include>trend-osce_rules.xml</include>
|
||||||
|
<include>ms-se_rules.xml</include>
|
||||||
|
<!-- <include>policy_rules.xml</include> -->
|
||||||
|
<include>zeus_rules.xml</include>
|
||||||
|
<include>solaris_bsm_rules.xml</include>
|
||||||
|
<include>vmware_rules.xml</include>
|
||||||
|
<include>ms_dhcp_rules.xml</include>
|
||||||
|
<include>asterisk_rules.xml</include>
|
||||||
|
<include>ossec_rules.xml</include>
|
||||||
|
<include>attack_rules.xml</include>
|
||||||
|
<include>dropbear_rules.xml</include>
|
||||||
|
<include>unbound_rules.xml</include>
|
||||||
|
<include>sysmon_rules.xml</include>
|
||||||
|
<include>opensmtpd_rules.xml</include>
|
||||||
|
<include>exim_rules.xml</include>
|
||||||
|
<include>openbsd-dhcpd_rules.xml</include>
|
||||||
|
<include>dnsmasq_rules.xml</include>
|
||||||
|
<include>local_rules.xml</include>
|
||||||
|
</rules>
|
||||||
|
|
||||||
|
|
||||||
|
<syscheck>
|
||||||
|
<!-- Frequency that syscheck is executed -- default every 20 hours -->
|
||||||
|
<frequency>79200</frequency>
|
||||||
|
<alert_new_files>yes</alert_new_files>
|
||||||
|
<!-- Directories to check (perform all possible verifications) -->
|
||||||
|
<directories check_all="yes" realtime="yes">/etc,/usr/bin,/usr/sbin</directories>
|
||||||
|
<directories check_all="yes" realtime="yes">/var/www,/bin,/sbin,/boot</directories>
|
||||||
|
|
||||||
|
<!-- Files/directories to ignore -->
|
||||||
|
<ignore>/etc/mtab</ignore>
|
||||||
|
<ignore>/etc/hosts.deny</ignore>
|
||||||
|
<ignore>/etc/mail/statistics</ignore>
|
||||||
|
<ignore>/etc/random-seed</ignore>
|
||||||
|
<ignore>/etc/random.seed</ignore>
|
||||||
|
<ignore>/etc/adjtime</ignore>
|
||||||
|
<ignore>/etc/httpd/logs</ignore>
|
||||||
|
|
||||||
|
<!-- Check the file, but never compute the diff -->
|
||||||
|
<nodiff>/etc/ssl/private.key</nodiff>
|
||||||
|
</syscheck>
|
||||||
|
|
||||||
|
<rootcheck>
|
||||||
|
<rootkit_files>/var/ossec/etc/shared/rootkit_files.txt</rootkit_files>
|
||||||
|
<rootkit_trojans>/var/ossec/etc/shared/rootkit_trojans.txt</rootkit_trojans>
|
||||||
|
<system_audit>/var/ossec/etc/shared/system_audit_rcl.txt</system_audit>
|
||||||
|
<system_audit>/var/ossec/etc/shared/cis_debian_linux_rcl.txt</system_audit>
|
||||||
|
<system_audit>/var/ossec/etc/shared/cis_rhel_linux_rcl.txt</system_audit>
|
||||||
|
<system_audit>/var/ossec/etc/shared/cis_rhel5_linux_rcl.txt</system_audit>
|
||||||
|
</rootcheck>
|
||||||
|
|
||||||
|
<alerts>
|
||||||
|
<log_alert_level>1</log_alert_level>
|
||||||
|
<email_alert_level>7</email_alert_level>
|
||||||
|
</alerts>
|
||||||
|
|
||||||
|
<remote>
|
||||||
|
<connection>syslog</connection>
|
||||||
|
<allowed-ips>any</allowed-ips>
|
||||||
|
</remote>
|
||||||
|
|
||||||
|
<remote>
|
||||||
|
<connection>secure</connection>
|
||||||
|
</remote>
|
||||||
|
|
||||||
|
<command>
|
||||||
|
<name>host-deny</name>
|
||||||
|
<executable>host-deny.sh</executable>
|
||||||
|
<expect>srcip</expect>
|
||||||
|
<timeout_allowed>yes</timeout_allowed>
|
||||||
|
</command>
|
||||||
|
|
||||||
|
<command>
|
||||||
|
<name>firewall-drop</name>
|
||||||
|
<executable>firewall-drop.sh</executable>
|
||||||
|
<expect>srcip</expect>
|
||||||
|
<timeout_allowed>yes</timeout_allowed>
|
||||||
|
</command>
|
||||||
|
|
||||||
|
<command>
|
||||||
|
<name>disable-account</name>
|
||||||
|
<executable>disable-account.sh</executable>
|
||||||
|
<expect>user</expect>
|
||||||
|
<timeout_allowed>yes</timeout_allowed>
|
||||||
|
</command>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Active Response Config -->
|
||||||
|
<active-response>
|
||||||
|
<!-- This response is going to execute the host-deny
|
||||||
|
- command for every event that fires a rule with
|
||||||
|
- level (severity) >= 6.
|
||||||
|
- The IP is going to be blocked for 600 seconds.
|
||||||
|
-->
|
||||||
|
<command>host-deny</command>
|
||||||
|
<location>local</location>
|
||||||
|
<level>7</level>
|
||||||
|
<timeout>600</timeout>
|
||||||
|
</active-response>
|
||||||
|
|
||||||
|
<active-response>
|
||||||
|
<!-- Firewall Drop response. Block the IP for
|
||||||
|
- 600 seconds on the firewall (iptables,
|
||||||
|
- ipfilter, etc).
|
||||||
|
-->
|
||||||
|
<command>firewall-drop</command>
|
||||||
|
<location>local</location>
|
||||||
|
<level>7</level>
|
||||||
|
<timeout>600</timeout>
|
||||||
|
</active-response>
|
||||||
|
|
||||||
|
<!-- Files to monitor (localfiles) -->
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/messages</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/authlog</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/auth.log</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/secure</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/xferlog</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/maillog</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>apache</log_format>
|
||||||
|
<location>/var/www/logs/access_log</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>apache</log_format>
|
||||||
|
<location>/var/www/logs/error_log</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
<localfile>
|
||||||
|
<log_format>syslog</log_format>
|
||||||
|
<location>/var/log/exim_mainlog</location>
|
||||||
|
</localfile>
|
||||||
|
|
||||||
|
</ossec_config>
|
Loading…
Reference in New Issue
Block a user