2019/12/28

又到了半年一度的弱掃時間
使用的是kali linux 2019.4 的版本
本來是想裝完後直接 apt install openvas
可是用 Kali Linux Light 64-Bit 這個iso裝完後
竟然找不到 openvas
算了
只好再繼續用virtualbox的image
安裝執行都OK

這次的問題是出現了不少FP
所以必須在管理介面上調整

首先點進 scan - report
再點進要調整的report
就會看到所有的細項報告
接下來點撃該細項報告最右方的圖示






就可以調整new severity



2019/12/05

今天偶然發現librenms好像好久沒更新了
一看果然從6月後都沒更新
查了一下官網
最新版本是11月
馬上下指令
daili.sh
也沒有更新的訊息
再去communuty看了一下
現在要醬下指令更新了

su - librenms
git pull
./daily.sh

之前只要更新大多有問題
這次做完還好
再觀察看看

https://community.librenms.org/

2019/11/28

這几天在玩MHN

感覺還不錯
不過有些地方要注意
試了好久

首先裝server
依照官網的說明沒什麼問題
我是用 ubuntu 18.04

再來是佈署 sensor

網頁介面上有提供deploy的script

官網上有提到有些sensor可以裝在centos
不過網頁介面上的都是for ubuntu跟 respberry pi
有很多sensor可以選擇
不同sensor有不同的功能
不過不是每個都可以用
這地方試了好久

最後我選了 Dionaea
官網上是說只能裝在 Ubuntu 14.04/Centos 7
其他版本有問題
不過我裝在ubuntu 18.04是ok的
只是安裝過程中碰到以下的問題

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/libe/libemu/libemu2_0.2.0+git20120122-1.2build1_amd64.deb  403  Forbidden [IP: 91.189.88.173 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

最後解決的方法是直接下載這個檔然後 dpkg -i
之後就沒問題了
介面還可以接受
資料是放在mongodb裡
也提供 rest可以撈
不過沒找到完整文件
另外就是直接使用mongoexport把資料撈出來
要注意的是mongodb時間是ISODate
如果用bash shell要記得轉換時間

date -u -Ins

每十分鐘從mongodb撈出資料

#!/bin/bash

date -d '10 mins ago' -u -Ins |cut -d ',' -f 1 > /tmp/time
echo "DBQuery.shellBatchSize = 3000000" > /tmp/get10min.js
echo "use mnemosyne" >> /tmp/get10min.js
echo 'db.session.find({"timestamp":{$gt:ISODate("'`cat /tmp/time`'")}})' >> /tmp/get10min.js

mongo < /tmp/get10min.js > /tmp/mhn_10min_data


https://github.com/pwnlandia/mhn

https://github.com/pwnlandia/mhn/wiki/List-of-Supported-Sensors

https://github.com/pwnlandia/mhn/wiki/MHN-REST-APIs

https://github.com/pwnlandia/mhn/wiki/Exporting-Honeypot-Data-from-MHN

https://www.itread01.com/content/1545640216.html

2019/11/22

今天在下grep 指令時出現以下的訊息

Binary file /tmp/test matches

查了一下說是因為檔案是binary file 無法執行grep 指令
明明就是text file
解決方式是強制指定為txt
指令

grep -a abc /tmp/test

2019/11/21

目前有三台ES
在graylog上設定 

shards = 3
replicas = 1

在index set看到每天的量大約 100G左右

對應到每一台ES的空間大約是 70G

所以算法就是

100G * 2 = 200 G

然後再分配到3台

200G / 3 就大約等於 70G 因為還要加上 index 所以會大一些

2019/11/13

今天在使用mutt時一直出現以下的錯誤
找了半天還是沒有答案

mutt -s 'test' abc@de.com -a /tmp/test < test

SMTP session failed: 500 5.5.2 Error: bad UTF-8 syntax
Could not send the message.

改用

/usr/bin/mail -a /tmp/test1 -a /tmp/test2 -S smtp="10.0.0.1:25" -r "from@dde.com" -s 'test' to@de.com < test

https://www.binarytides.com/linux-mailx-command/

2019/11/06

剛剛在設定.muttrc從hinet寄信的時候

設ip不能寄
set smtp_url = "smtp://168.95.4.10:25/"

要設fqdn才能寄
set smtp_url = "smtp://msa.hinet.net:25/"

什麼怪事都有

http://nengfang.blogspot.com/2014/07/hinet-isp-smtp-server.html

2019/11/01

今天模擬在一台graylog server 三個ES node的環境
然後當有一台ES fail時要怎麼處理

首先我們先看一下目前ES的狀況
有三個node
status也是green

curl -XGET http://192.168.12.201:9200/_cluster/health?pretty
{
  "cluster_name" : "graylog",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 11,
  "active_shards" : 14,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

再來看一下目前所有shards的狀況

curl -XGET 192.168.12.203:9200/_cat/shards
gl-events_0        3 p STARTED 0 230b 192.168.12.202 es-node-02
gl-events_0        2 p STARTED 0 230b 192.168.12.201 es-node-1
gl-events_0        1 p STARTED 0 230b 192.168.12.203 es-node-03
gl-events_0        0 p STARTED 0 230b 192.168.12.202 es-node-02
graylog_3          2 r STARTED 1  7kb 192.168.12.203 es-node-03
graylog_3          2 p STARTED 1  7kb 192.168.12.201 es-node-1
graylog_3          1 r STARTED 1  7kb 192.168.12.202 es-node-02
graylog_3          1 p STARTED 1  7kb 192.168.12.201 es-node-1
graylog_3          0 p STARTED 1  7kb 192.168.12.202 es-node-02
graylog_3          0 r STARTED 1  7kb 192.168.12.203 es-node-03
gl-system-events_0 3 p STARTED 0 230b 192.168.12.203 es-node-03
gl-system-events_0 2 p STARTED 0 230b 192.168.12.202 es-node-02
gl-system-events_0 1 p STARTED 0 230b 192.168.12.201 es-node-1
gl-system-events_0 0 p STARTED 0 230b 192.168.12.203 es-node-03



我們關掉其中一個ES node 192.168.12.202 模擬故障

查看整個cluster狀況
nodes變成2
status也變為red

curl -XGET http://192.168.12.201:9200/_cluster/health?pretty
{
  "cluster_name" : "graylog",
  "status" : "red",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 8,
  "active_shards" : 9,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 5,
  "delayed_unassigned_shards" : 5,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 64.28571428571429
}

再來看一下shards的狀況
192.168.12.202這個node己經不見了
而且上面的shards 變成 UNASSIGNED

curl -XGET 192.168.12.203:9200/_cat/shards
gl-system-events_0 3 p STARTED    0 261b 192.168.12.203 es-node-03
gl-system-events_0 2 p UNASSIGNED                       
gl-system-events_0 1 p STARTED    0 261b 192.168.12.201 es-node-1
gl-system-events_0 0 p STARTED    0 261b 192.168.12.203 es-node-03
graylog_3          2 r STARTED    1  7kb 192.168.12.203 es-node-03
graylog_3          2 p STARTED    1  7kb 192.168.12.201 es-node-1
graylog_3          1 r STARTED    1  7kb 192.168.12.203 es-node-03
graylog_3          1 p STARTED    1  7kb 192.168.12.201 es-node-1
graylog_3          0 p STARTED    1  7kb 192.168.12.203 es-node-03
graylog_3          0 r STARTED    1  7kb 192.168.12.201 es-node-1
gl-events_0        3 p UNASSIGNED                       
gl-events_0        2 p STARTED    0 261b 192.168.12.201 es-node-1
gl-events_0        1 p STARTED    0 261b 192.168.12.203 es-node-03
gl-events_0        0 p UNASSIGNED


找一台机器重裝ES後並重新加入cluster


先看一下狀況
nodes己經回來變成3了
可是status還是red

curl -XGET http://192.168.12.201:9200/_cluster/health?pretty
{
  "cluster_name" : "graylog",
  "status" : "red",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 8,
  "active_shards" : 11,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 3,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 78.57142857142857
}

再來看shards的狀況
還是 UNASSIGNED 並沒有復原

curl -XGET 192.168.12.203:9200/_cat/shards
gl-system-events_0 3 p STARTED    0 261b 192.168.12.203 es-node-03
gl-system-events_0 2 p UNASSIGNED                       
gl-system-events_0 1 p STARTED    0 261b 192.168.12.201 es-node-1
gl-system-events_0 0 p STARTED    0 261b 192.168.12.203 es-node-03
graylog_3          2 r STARTED    1  7kb 192.168.12.203 es-node-03
graylog_3          2 p STARTED    1  7kb 192.168.12.201 es-node-1
graylog_3          1 r STARTED    1  7kb 192.168.12.203 es-node-03
graylog_3          1 p STARTED    1  7kb 192.168.12.201 es-node-1
graylog_3          0 p STARTED    1  7kb 192.168.12.203 es-node-03
graylog_3          0 r STARTED    1  7kb 192.168.12.201 es-node-1
gl-events_0        3 p UNASSIGNED                       
gl-events_0        2 p STARTED    0 261b 192.168.12.201 es-node-1
gl-events_0        1 p STARTED    0 261b 192.168.12.203 es-node-03
gl-events_0        0 p UNASSIGNED


查了資料說可以 reroute share
但實作上有問題無法執行


目前試出來的做法是先關掉graylog server

systemctl stop graylog-server.service

接下來把所有的 UNASSIGNED 砍了

curl -XDELETE '192.168.12.201:9200/gl-system-events_0/'

curl -XDELETE '192.168.12.201:9200/gl-events_0'

砍完後再去看shards

curl -XGET 192.168.12.203:9200/_cat/shards
graylog_3 2 r STARTED 1 7kb 192.168.12.203 es-node-03
graylog_3 2 p STARTED 1 7kb 192.168.12.201 es-node-1
graylog_3 1 r STARTED 1 7kb 192.168.12.202 es-node-02
graylog_3 1 p STARTED 1 7kb 192.168.12.201 es-node-1
graylog_3 0 r STARTED 1 7kb 192.168.12.202 es-node-02
graylog_3 0 p STARTED 1 7kb 192.168.12.203 es-node-03

這個是原本的資料檔
而且有設定 Index replicas

重啟graylog server

graylog會把剛剛砍掉的 gl-system-events_0 gl-events_0 建回來
收集的資料是放在 graylog_* 所以不會有影響

再看一次shards
全部都正常了

curl -XGET 192.168.12.203:9200/_cat/shards
gl-system-events_0 3 p STARTED 0 230b 192.168.12.203 es-node-03
gl-system-events_0 2 p STARTED 0 230b 192.168.12.202 es-node-02
gl-system-events_0 1 p STARTED 0 230b 192.168.12.201 es-node-1
gl-system-events_0 0 p STARTED 0 230b 192.168.12.203 es-node-03
graylog_3          2 r STARTED 1  7kb 192.168.12.203 es-node-03
graylog_3          2 p STARTED 1  7kb 192.168.12.201 es-node-1
graylog_3          1 r STARTED 1  7kb 192.168.12.202 es-node-02
graylog_3          1 p STARTED 1  7kb 192.168.12.201 es-node-1
graylog_3          0 r STARTED 1  7kb 192.168.12.202 es-node-02
graylog_3          0 p STARTED 1  7kb 192.168.12.203 es-node-03
gl-events_0        3 p STARTED 0 230b 192.168.12.202 es-node-02
gl-events_0        2 p STARTED 0 230b 192.168.12.201 es-node-1
gl-events_0        1 p STARTED 0 230b 192.168.12.203 es-node-03
gl-events_0        0 p STARTED 0 230b 192.168.12.202 es-node-02


所以記得 Configure Index Set 要設定Index replicas 至少為1
Index shards的數量就根据你ES node的數量來設定
如果ES node 有三個 就設定為3




2019/10/26

Load Balancing in NGINX

今天有人問graylog的三個node怎麼做load balance
想到之前玩過haproxy
可是查了一下資料
haproxy不支援UDP的load balance
nginx目前已經有支援了
設定方法如下

udp loadbalance

# Load balance UDP‑based DNS traffic across two servers
stream {
    upstream dns_upstreams {
        server 192.168.1.1:53;
        server 192.168.1.2:53;
    }

    server {
        listen 53 udp;
        proxy_pass dns_upstreams;
        proxy_timeout 1s;
        proxy_responses 1;
        error_log logs/dns.log;
    }
}

=============================================================

tcp load balance

upstream mytest {
server 192.168.2.1 weight=3;
server 192.168.2.2 weight=2;
}
server {
listen 443 ssl;
server_name my.test.tw;
access_log /var/log/nginx/my.test.tw.access.log main;
error_log /var/log/nginx/my.test.tw.error.log warn;
ssl_certificate my.test.tw.crt;
ssl_certificate_key my.test.tw.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
proxy_pass http://mytest;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}


https://blog.dtask.idv.tw/Nginx/2018-07-31/

https://www.nginx.com/blog/announcing-udp-load-balancing/
proxmox mail gateway 的 clamav-daemon
時不時就會出現fail的狀況
因為pmg本來就有自我檢查機制
所以想說不管他
可是今天看到後
手動去重啟
又馬上fail
覺得很怪
查了一下log


Oct 26 06:39:53 mg kernel: [765738.983038] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-freshclam.service: cache:1696KB rss:1100KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:528KB writeback:1056KB swap:660KB inactive_anon:720KB active_anon:356KB inactive_file:4KB active_file:4KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765738.983052] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-daemon.service: cache:1508KB rss:1760KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:0KB writeback:660KB swap:0KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765738.983088] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-daemon.service: cache:68KB rss:44KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:396KB writeback:0KB swap:0KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765738.983097] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-daemon.service: cache:0KB rss:92KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:396KB writeback:0KB swap:132KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765739.020710] oom_reaper: reaped process 4167 (clamd), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Oct 26 06:39:53 mg systemd[1]: clamav-daemon.service: Main process exited, code=killed, status=9/KILL

找了相關文章
都說是ram不夠的問題
目前是2G
先加到4G看看吧

2019/10/25

graylog上的三個node 總有一個會時出現時不出現
查了一下log
發現一直出現以下的訊息

Did not find meta info of this node. Re-registering.

搜尋了一下
几乎講的都是因為server沒有對時的關係
所以如果有建cluster環境的
切記要注意對時

但是在vmware的環境中
設完chrony對時
還是一直會出現秒差
只能去修改參數

stable_master_timeout = 60000

預設值為2000 就是 2秒
目前先改為60秒 再觀察看看
重啟graylog

後來想起來 vmware一直有時間不準的問題
想不到到現在還沒改善

2019/10/22

使用LXC的proxmox mail gateway 發生不能logratate的解法

options features 裡的 nesting要打開

https://forum.proxmox.com/threads/logrotate-issue-in-buster-lxc.56726/
今天整理graylog的時候發現一件事

目前我在index set的設定是留180天
超過的delete
不過我會手動去close index
只留約一個月的資料 查詢效率比較好
可是今天發現index超過了180天但系統並沒有去delete
我不確定是不是因為我手動去close的關係
如果真的是如此的話 那政策就要改成定時close
然後再手動去delete了
手動砍的shell如下
每天找出最舊的index再砍掉

#!/bin/bash

del_idx=`/usr/bin/curl -u admin:password 'http://127.0.0.1:9200/_cat/indices/graylog*?v'|grep close|awk '{print $2}'|sort -rn -t_ -k 2|tail -n 1`

/usr/bin/curl -XDELETE "http://localhost:9200/$del_idx/"

用crontab 來做吧

2019/10/21

proxmox mail gateway

預設不會去記錄信件主旨
因此要查找的時候有些不方便
修改方法如下

在 /etc/postfix/main.cf最後增加一行如下

header_checks = regexp:/etc/postfix/header_checks

建立 /etc/postfix/header_checks 這個檔 內容如下

/^Subject:/      WARN

接下來重啟服務
systemctl restart postfix

之後就可以在 /var/log/mail.log看到如下的log

Oct 21 06:43:49 mg postfix/cleanup[19866]: 74A29109C: warning: header Subject: Congratulate Jimmy (Gin-der) Peng for... from mailc-ab.linkedin.com[108.174.3.162]; from=<s-2f4oc1y30l5mpjzdxdjdkon8civu58akgxu9lf1h23ha66tmdhfi46d4@bounce.linkedin.com> to=<abc@de.com> proto=ESMTP helo=<mailc-ab.linkedin.com>

以上的方法在几器重開後 config就會被改回來

找到另一個方法
直接去改pmg的perl

First, add this somewhere between the 'use' statements at the beginning of the file:

use PVE::Tools;

Then search for this line:

$self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid});

Add the following below that line:

$self->log (3, "$queue->{logid}: Subject: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($entity->head->get('subject'))) || 'No Subject');
my @fromarray = split('\s*,\s*', $entity->head->get('from') || $msginfo->{sender});
$self->log (3, "$queue->{logid}: From: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($fromarray[0])) );

https://forum.proxmox.com/threads/how-to-log-subjects-of-all-incoming-email.54191/

第二種方法會把subject放在獨立行
不方便查找

官方其實有提供解法方法

You can find the default templates in /var/lib/pmg/templates/. Please do not modify them directly, because your modification would get lost on the next update. Instead, copy the template you wish to change to /etc/pmg/templates/, then apply your changes there.

Templates can access any configuration setting, and you can use the pmgconfig dump command to get a list of all variable names:

# pmgconfig dump
...
dns.domain = yourdomain.tld
dns.hostname = pmg
ipconfig.int_ip = 192.168.2.127
pmg.admin.advfilter = 1
...
The same tool is used to force regeneration of all template based configuration files. You need to run that after modifying a template, or when you directly edit configuration files

# pmgconfig sync --restart 1

https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#_service_configuration_templates

2019/10/20

今天在使用gnuplot
發現一個問題
當先進入gnuplot後再下指令畫圖
可以跳出另一個視窗
可是如果使用
gnuplot -e 的方式
畫面一閃就不見了
只能夠output到檔案

gnuplot -e "set terminal png; set output '/tmp/1.png'; plot '/tmp/33' with line"

另外如果在python 呼叫 gnuplot
也不能在視窗上顯示
只能夠output到檔案

語法如下

import Gnuplot

g = Gnuplot.Gnuplot()
g("set terminal png")
g("set output '/tmp/1.png'")
g.plot("'/tmp/33' with line")

記得要先 apt install  python-gnuplot

看圖指令
eog /tmp/1.png






















http://yurinfore.blogspot.com/2007/05/python.html

2019/10/19

proxmox mail gateway的問題

今天在使用 tracking center 找資料的時候出現


















結果找了一下問題
竟然是要把ublock關掉才會正常
XD

https://forum.proxmox.com/threads/connection-error-in-tracking-center.41293/

2019/10/18

proxmox mail gateway 今年 opensource
因為之前都是用fortiget來處理spam的問題
所以也沒想要換
不過因為保固到期 新的合約沒有買到spam這個授權
而且最近也把mail server 換到centos 8
所以就想說來試看看
如果本來就是用 proxmox ve
那就可以直接使用LXC的template
我就是直接用template
安裝很快 裝完template也就可以砍了
再來說明一下裝完後有那些要改
首先是登入的root密碼
接下來使用iptables去管制能夠連到管理介面的來源ip

mail filter

一直以來我們的處理方式都是在主旨加上tag 而不是去隔離信
所以這裡要改
至於要不要通知管理者 就自行決定了
如果需要黑白名單 也是在這裡加














configuration

管理者的mail要記得改
















mail proxy

relaying
relay domains
transports
請依自己的環境修改
如果使用greylist 白名單是加在這裡 要注意 不是在mail filter














options

紅框是我覺得一定要改的
信件大小是跟著gmail的規則
網路上看到都說不要開greylist 可是我認為要開 可以少掉很多spam
SMTPD banner 如果不改 會顯示proxmox
站在安全的角度 我不想讓人知道我用什麼產品
其他就視需要自行決定了


















未加greylist



















加上greylist



















spam跟virus的更新系統會自動做
至於其他就自己看看

文件上的這張圖怪怪的


















實体上不是直接放在mail server 前面
而是要在DNS設定MX
外面進來的信先進到PMG
處理完後再轉到mail server
所以我目前的做法是在mail server上用iptable管制特定ip才能連到25
而且出去的信我也是從mail servre直接出去
不再經過PMG
到目前大約運作十多天
看起來效果還不錯

https://www.proxmox.com/en/proxmox-mail-gateway
https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html

2019/10/17

今天從proxmox下載新的lxc centos 7 template回來
create後發現root不能登入

pct enter 107

直接進去後再改密碼還是一樣

應該是template有問題了
而且centos 8的template已經上架
直接捉回來用 沒問題

2019/10/16

因為centos 8的php已 經升到7了
所以試看看裝 ocs 2.6有沒有問題

先補一下需要的rpm

dnf --enablerepo=PowerTools install perl-MIME-Types
dnf --enablerepo=PowerTools install perl-Digest-SHA1 -y
dnf --enablerepo=PowerTools install perl-Switch -y

epel-release
make
mariadb
mariadb-server
mod_perl
perl-Apache2-SOA
perl-Apache-DB
perl-Apache-DBI
perl-DBI
perl-Digest-SHA
perl-Net-IP
perl-SOAP-Lite
perl-XML-Entities
perl-XML-Simple
php
php-curl
php-gd
php-json
php-mbstring
php-mysqlnd
php-soap
php-xml
tar
httpd
zlib

大約是這些
如果有漏的
在跑setup時再補一下
centos 8還不錯 所有需要的東西都可以直接用dnf install 來裝

裝好mariadb記得先改一下root的密碼

mysqladmin -u root password 'passwd'

setup跑完後
改以下二個檔的帳號跟密碼

/etc/httpd/conf.d/z-ocsinventory-server.conf

/usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php

改權限

chmod -R 766 /usr/share/ocsinventory-reports
chown -R apache:apache /usr/share/ocsinventory-reports/
chown -R apache:apache /var/lib/ocsinventory-reports/

登入
http://server-hostname-or-IP/ocsreports
預設是admin admin
記得改掉

php在這個版本有個獨立的daemon

php-fpm

如果在/var/log/httpd/裡沒有看到錯誤
記得到
/var/log/php-fpm
查看看

要重啟daemon要重啟三個

systemctl restart httpd mariadb.service php-fpm.service

https://otx.alienvault.com 是一個公開的情資交換平台
只要註冊帳號(免費) 就可以接收跟發布相關的情資
速度相當快
不要忘記訂閱自己感興趣的user
如 AlienVault
註冊完後有相關的訊息也會mail到註冊的信箱

而且也提供相關的API可以使用
因為目前寫python的几會比較多
所以簡單說明
首先要到https://github.com/AlienVault-OTX/OTX-Python-SDK下載
下載後直接執行
python setup.py install
就安裝完成了
再來我是直接到github找相關程式
以下這個是我覺得還不錯的
https://github.com/Neo23x0/signature-base/blob/master/threatintel/get-otx-iocs.py

下載後在執行前只要改以下二個地方
otx key只要註冊後就可以拿到

OTX_KEY = 'yout otx key'

以下改成拿回來的資料要放那裡
parser.add_argument('-o', metavar='dir', help='Output directory', default='/tmp')

改好後執行
/usr/bin/python Get-OTX-IOCs.py

就會在/tmp裡看到
otx-c2-iocs-ipv4.txt
otx-c2-iocs-ipv6.txt
otx-c2-iocs.txt
otx-filename-iocs.txt
otx-hash-iocs.txt
這些檔案
接下來就可以拿來應用了

也有人針對ip整理過 可以直接拿來用

不過最大的問題是 拿到這麼多的資料 一般firewall是不可能全部吃進去的
一定要找別的設備才能處理