昨天發現有几台brocade的fan壞了
本來在crontab是有寫檢查fail及error的script
但因為brocade 在log上會一直出現fan
因為會一直變換轉速
所以之前拿掉了 因為量太大
這次再加回去
grep Fan|grep fail
但要撈log時 使用cut時發現一個問題
當每個月的10號之前
會有二個空格
Apr 9 19:37:20 192.168.204.251 System: Fan 1 (from left when facing right side), failed
Apr和9間就有二個空格
如此便會影使用cut取值的正確
為了要解決這個問題
使用一次 tr 就好了
tr -s ' ' 這樣就可以把空格全部壓縮成一個
2016/02/17
今天在config centos 7的vsftpd
主要几個地方
不允許anonymous
anonymous_enable=NO
限制user只能在自己的home目錄
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
在 /etc/vsftpd 產生一個 chroot_list 檔案
touch chroot_list
改完後 systemctl restart vsftpd
但要登入時發生
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
找了半天資料 罵聲一片
最後才找到新版要再多加一行
allow_writeable_chroot=YES
加完重啟就ok了
無言
主要几個地方
不允許anonymous
anonymous_enable=NO
限制user只能在自己的home目錄
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
在 /etc/vsftpd 產生一個 chroot_list 檔案
touch chroot_list
改完後 systemctl restart vsftpd
但要登入時發生
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
找了半天資料 罵聲一片
最後才找到新版要再多加一行
allow_writeable_chroot=YES
加完重啟就ok了
無言
2016/02/16
2016/02/15
今天本來是要升級OCS
但升到2.2後畫面竟然只有几個數字
而且升級的過程一直不順
想說重裝好了
因為原來是裝在centos 5上
而centos 5 的EOL是2017年3 月
所以試看看裝在centos 7 會不會比較沒問題
查了一下
現在在centos 7 上裝很簡單了
稍微記錄一下
最小安裝後改一下hosts.allow hosts.deny 及selinux
關掉filewalld
systemctl stop firewalld
systemctl disable firewalld
再裝一下net-tools及 epel-release
epel-release是用來加入額外repo
安裝mariadb
yum install mariadb-server -y
systemctl start mariadb
systemctl enable mariadb
修改mariadb的root密碼及一些安全設定
mysql_secure_installation
再來安裝ocs
yum install -y ocsinventory-server ocsinventory-reports
因為加入了epel-release 所以系統會把所有相依性的套件一次裝好
啟動httpd服務
systemctl start httpd
sytemctl enable httpd
接下來就可以進入web介面 依畫面指示進行接下來的安裝動作了
http://ocs-server-ip/ocsreports/
預設登入帳號密碼是 admin/admin 記得要改
修改server ip 使用文字化圖形介面指令
nmtui
目前的版本是2.1.2
再等一陣子看看 應該會直接升到 2.2 到時直接使用yum update就好了
但升到2.2後畫面竟然只有几個數字
而且升級的過程一直不順
想說重裝好了
因為原來是裝在centos 5上
而centos 5 的EOL是2017年3 月
所以試看看裝在centos 7 會不會比較沒問題
查了一下
現在在centos 7 上裝很簡單了
稍微記錄一下
最小安裝後改一下hosts.allow hosts.deny 及selinux
關掉filewalld
systemctl stop firewalld
systemctl disable firewalld
再裝一下net-tools及 epel-release
epel-release是用來加入額外repo
安裝mariadb
yum install mariadb-server -y
systemctl start mariadb
systemctl enable mariadb
修改mariadb的root密碼及一些安全設定
mysql_secure_installation
再來安裝ocs
yum install -y ocsinventory-server ocsinventory-reports
因為加入了epel-release 所以系統會把所有相依性的套件一次裝好
啟動httpd服務
systemctl start httpd
sytemctl enable httpd
接下來就可以進入web介面 依畫面指示進行接下來的安裝動作了
http://ocs-server-ip/ocsreports/
預設登入帳號密碼是 admin/admin 記得要改
修改server ip 使用文字化圖形介面指令
nmtui
目前的版本是2.1.2
再等一陣子看看 應該會直接升到 2.2 到時直接使用yum update就好了
2016/01/11
昨天看到這個工具還不錯 fastnetmon
https://github.com/pavel-odintsov/fastnetmon
可以使用netflow sflow port mirror的資料來計算pps mbps 及flow數
當到達指定的上限時
可以發出告警或執行特定動作
安裝很簡單
裝好centos 7後
wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/fastnetmon_install.pl -Ofastnetmon_install.pl
perl fastnetmon_install.pl
會自動把需要的套件補齊
裝好後依需求修改 /etc/fastnetmon.conf
另外在/tmp找到notify_about_attack.sh
cp到/usr/local/bin/ 一樣依需求修改內容
如果使用port mirror 要把網卡的 promisc打開
寫入 /etc/rc.local
/usr/sbin/ifconfig eth1 promisc
再來設定開机執行 fastnetmon
systemctl enable fastnetmon
以下的程式可以觀看即時的狀況
/opt/fastnetmon/fastnetmon_client
https://github.com/pavel-odintsov/fastnetmon
可以使用netflow sflow port mirror的資料來計算pps mbps 及flow數
當到達指定的上限時
可以發出告警或執行特定動作
安裝很簡單
裝好centos 7後
wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/fastnetmon_install.pl -Ofastnetmon_install.pl
perl fastnetmon_install.pl
會自動把需要的套件補齊
裝好後依需求修改 /etc/fastnetmon.conf
另外在/tmp找到notify_about_attack.sh
cp到/usr/local/bin/ 一樣依需求修改內容
如果使用port mirror 要把網卡的 promisc打開
寫入 /etc/rc.local
/usr/sbin/ifconfig eth1 promisc
再來設定開机執行 fastnetmon
systemctl enable fastnetmon
以下的程式可以觀看即時的狀況
/opt/fastnetmon/fastnetmon_client
標籤:
centos 7,
fastnetmon,
netflow,
port mirror,
promiscuous,
sflow,
systemctl
2015/12/14
最近因為要SDN的POC
廠商要求測試的主机要有二張網卡
一張要開啟promiscuous mode 用來聽所有對外的封包
本來是想放在vm上
但之前要把snort及其他網管軟体移進vm時也一直在找相關的資料
那時就沒找到要如何解決
因為在guest裡就是看不到所有的封包
上週也到proxmox的官方forum上去問
過了好几天也沒人回文
昨天終於找到解決方法了
原來這麼解單
把網卡的bridge設為HUB mode就好了
指令如下
brctl setageing vmbr1 0
順便來去官網自我回文
廠商要求測試的主机要有二張網卡
一張要開啟promiscuous mode 用來聽所有對外的封包
本來是想放在vm上
但之前要把snort及其他網管軟体移進vm時也一直在找相關的資料
那時就沒找到要如何解決
因為在guest裡就是看不到所有的封包
上週也到proxmox的官方forum上去問
過了好几天也沒人回文
昨天終於找到解決方法了
原來這麼解單
把網卡的bridge設為HUB mode就好了
指令如下
brctl setageing vmbr1 0
順便來去官網自我回文
20240301 修正
以上所述下指令的方式在proxmox 8版沒作用了
要修改以下檔案
重開才能生效
/etc/network/interfaces
把listen的介面加上
bridge_ageing 0
範例如下
auto vmbr1
iface vmbr1 inet manual
bridge-ports ens1f1
bridge-stp off
bridge-fd 0
bridge_ageing 0
重開才能生效
2015/12/10
2015/12/04
最近開始直接向各國回報攻擊我們的ip
今天終於有一個國家回信 是日本
好感動
請我再提供log的時區及純文字檔
snort base 無法直接匯出
記錄一下sql語法
select event.cid,signature,sig_name,inet_ntoa(iphdr.ip_src),tcphdr.tcp_sport,inet_ntoa(iphdr.ip_dst),tcphdr.tcp_dport,timestamp from iphdr,event,signature,tcphdr where event.signature=signature.sig_id and event.cid=iphdr.cid and event.cid=tcphdr.cid and event.timestamp like '2015-12-04%' and inet_ntoa(iphdr.ip_src)="133.208.26.134" into outfile '/tmp/133.208.26.134.log';
事件的唯一值是 event裡的cid 其他table都要參考這個值
iphdr 放的是ip資料
tcphdr 放的是tcp的相關port 資料
udphdr 放的是udp的相關port 資料
今天終於有一個國家回信 是日本
好感動
請我再提供log的時區及純文字檔
snort base 無法直接匯出
記錄一下sql語法
select event.cid,signature,sig_name,inet_ntoa(iphdr.ip_src),tcphdr.tcp_sport,inet_ntoa(iphdr.ip_dst),tcphdr.tcp_dport,timestamp from iphdr,event,signature,tcphdr where event.signature=signature.sig_id and event.cid=iphdr.cid and event.cid=tcphdr.cid and event.timestamp like '2015-12-04%' and inet_ntoa(iphdr.ip_src)="133.208.26.134" into outfile '/tmp/133.208.26.134.log';
事件的唯一值是 event裡的cid 其他table都要參考這個值
iphdr 放的是ip資料
tcphdr 放的是tcp的相關port 資料
udphdr 放的是udp的相關port 資料
2015/12/02
2015/11/19
2015/10/29
2015/10/26
2015/10/21
今天在思考一個問題
要不要把google的ip全部設成白名單
但首先要取得google的全部ip
指令如下
nslookup -q=TXT _netblocks.google.com 8.8.8.8
目前得到的資料如下
nslookup -q=TXT _netblocks.google.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
_netblocks.google.com text = "v=spf1 ip4:64.18.0.0/20 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:207.126.144.0/20 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all"
http://itindex.net/detail/50310-google-ip-%E6%96%B9%E6%B3%95
要不要把google的ip全部設成白名單
但首先要取得google的全部ip
指令如下
nslookup -q=TXT _netblocks.google.com 8.8.8.8
目前得到的資料如下
nslookup -q=TXT _netblocks.google.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
_netblocks.google.com text = "v=spf1 ip4:64.18.0.0/20 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:207.126.144.0/20 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all"
http://itindex.net/detail/50310-google-ip-%E6%96%B9%E6%B3%95
2015/10/20
2015/10/14
為了上win10的kms
今天把kms從win7移到win server 2012 r2
測試了原來在win7 win8上使用的bat檔可以直接用沒問題
再來就是office 2016
不管怎麼寫就是會有問題
上網找了一下
有些人說是編碼的問題
有些人說是編輯器的問題
最後試的結果是
word notepad都不行 不管用什麼編碼
notepad++不管用什麼編碼都沒問題
XD
office 2016 kms認証bat檔內容如下
需要的自行取用
記得要改kms server的ip
@echo off
set OfficePath="C:\Program Files\Microsoft Office\Office16\"
if exist "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" set OfficePath="C:\Program Files (x86)\Microsoft Office\Office16\"
cscript %OfficePath%ospp.vbs /sethst:1.2.3.4
cscript %OfficePath%ospp.vbs /setprt:1688
cscript %OfficePath%ospp.vbs /act
echo active is success when you see "<Product activation successful>"
pause
2015/10/07
proxmox 4.0 經過很久的beta 終於 release了
主要有三個功能
bash這個因為我一直都使用ssh 所以沒啥感覺
再來是用LXC取代openvz了
因為我之前也不用openvz
試了一下LXC 感覺上真的快很多
但有個問題
backup目前不能使用snapshot
意思就是備份時要停机
這個我就有點意見了 雖然官方說會改進
再來就是HA的config更簡便了
這個我之前也沒在用
升級之後應該會有這個需求
最重要的是3.x可以用到什麼時候
The Proxmox VE 3.x family is supported until the end of Debian Wheezy security updates (expected end in April 2016)
還有半年
不過官方的建議升級是backup guest
install 新的 再restore guest
再找看看有沒机器和時間來做了
主要有三個功能
bash這個因為我一直都使用ssh 所以沒啥感覺
再來是用LXC取代openvz了
因為我之前也不用openvz
試了一下LXC 感覺上真的快很多
但有個問題
backup目前不能使用snapshot
意思就是備份時要停机
這個我就有點意見了 雖然官方說會改進
再來就是HA的config更簡便了
這個我之前也沒在用
升級之後應該會有這個需求
最重要的是3.x可以用到什麼時候
The Proxmox VE 3.x family is supported until the end of Debian Wheezy security updates (expected end in April 2016)
還有半年
不過官方的建議升級是backup guest
install 新的 再restore guest
再找看看有沒机器和時間來做了
訂閱:
文章 (Atom)
