2017年3月16日 星期四

Yum install 時出現process 被lock問題



有時執行yum 安裝時會出現yum 在更新 導致yum 的process被占用



範例: 執行yum install dovecot 出現如下圖警訊

裡面有提到pid與 Application is :PackageKit


這時 我們可以使用指令

ps aux |grep PackageKit

則會show 出目前此程式的pid為11406

如要強制停止此process使用指令

kill -9 11406

在執行yum install dovecot 則lock警訊消失了,能正常安裝.




2017年3月15日 星期三

升級openssl 1.0.1e-->1.1.0e


升級openssl 1.0.1e-->1.1.0e

環境:

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@localhost ~]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

首先先到https://www.openssl.org/source/下載最新的openssl版本

目前最新版本為openssl-1.1.0e.tar.gz

[root@localhost ~]# cd /tmp
[root@localhost tmp]# wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz


[root@localhost tmp]# tar -xzvf openssl-1.1.0e.tar.gz
[root@localhost openssl-1.1.0e]# cd openssl-1.1.0e

查看安裝相關資料
[root@localhost openssl-1.1.0e]# cat README
[root@localhost openssl-1.1.0e]# cat INSTALL

[root@localhost openssl-1.1.0e]# ./config
[root@localhost openssl-1.1.0e]# make
[root@localhost openssl-1.1.0e]# make install


查詢版本還是發現是舊版沒更新

[root@localhost ~]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

[root@localhost openssl-1.1.0e]# reboot
重開之後再查詢發現出現錯誤

openssl :error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such
file or directory


看來是openssl libraries 找不到位置(從剛剛cat INSTALL可得知預設是裝在/usr/local底下)





執行ls來進行link

ln-s /剛安裝來源  /要產生link目的地
執行下面兩行指令

ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

這時在查詢openssl 則會顯示升級到1.1.0e版了

2017年3月13日 星期一

CVE-2016-2183 webmin 弱點修補

環境:

[root@localhost etc]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

[root@localhost etc]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

[root@localhost etc]# rpm -q webmin
webmin-1.831-1.noarch




使用Nessus掃出webmin弱點如下



SSL Medium Strength Cipher Suites Supported

說明:The remote host supports the use of SSL ciphers that offer medium
strength encryption. Nessus regards medium strength as any encryption
that uses key lengths at least 64 bits and less than 112 bits, or else
that uses the 3DES encryption suite.
Note that it is considerably easier to circumvent medium strength
encryption if the attacker is on the same physical network.

此弱點顯示密碼加密長度不足,並建議不要使用3DES

因此漏洞掃出來是顯示為10000 Port,所以針對webmin來進行修補


1.到webmin改設定


方法1

路徑:Webmin-->Webmin Configuration-->SSL Encyption
Allowed SSL ciphers這點選Listed ciphers

並輸入加密方式:
ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS;













方法2
路徑:Webmin-->Webmin Configuration-->SSL Encyption
Allowed SSL ciphers這點選Only strong PCI-compliant ciphers並儲存





下指令vi /etc/webmin/miniserv.conf




 將
ssl_cipher_list=ECDHE-RSA-AES256-SHA384:AES256-SHA256:AES256-SHA256:RC4:HIGH:MEDIUM:+TLSv1:+TLSv1.1:+TLSv1.2:!MD5:!ADH:!aNULL:!eNULL:!NULL:!DH:!ADH:!EDH:!AESGCM

修改為

ssl_cipher_list=ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS;






















2017年3月8日 星期三

設定簡單的OSPF路由


首先有三台設備分別名為IOU1,IOU2,IOU3,實驗目的為 IOU1能Ping到IOU3





設定參數如下

IOU1 e0/0 IP:192.168.1.10

IOU2 e0/0 IP:192.168.1.20

IOU2 e0/1 IP:172.16.1.20

IOU3 e0/0 IP:192.168.1.30



指令如下

IOU1
IOU1(config)#int e0/0
IOU1(config-if)#ip address 192.168.1.10 255.255.255.0
IOU1(config-if)#no shutdown
*Mar  8 08:17:03.883: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar  8 08:17:04.889: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

IOU2
IOU2(config)#int e0/0
IOU2(config-if)#ip address 192.168.1.20 255.255.255.0
IOU2(config-if)#no shutdown
*Mar  8 08:18:44.548: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
IOU2(config-if)#
*Mar  8 08:18:45.551: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

IOU2(config)#int e0/1
IOU2(config-if)#ip address 172.16.1.20 255.255.255.0
IOU2(config-if)#no shutdown
*Mar  8 08:20:00.967: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up
*Mar  8 08:20:01.980: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up


IOU3
IOU3(config)#int e0/0
IOU3(config-if)#ip address 172.16.1.30 255.255.255.0
IOU3(config-if)#no shutdown
*Mar  8 08:21:04.171: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar  8 08:21:05.186: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up


IOU1上執行ping IOU2的e0/0 (IP:192.168.1.20)為通的

但ping IOU2的e0/1 (IP:172.16.1.20)則不通

在IOU1上show 路由
IOU1#show ip route
顯示只有L (本地)跟C (直連的)看不到往172.16.1.0的路由



只好開始建立OSPF路由
IOU 1
IOU1(config)#router ospf 10
IOU1(config-router)#network 192.168.1.0 0.0.0.255 area 100


IOU 2

IOU2(config)#router ospf 10
IOU2(config-router)#network 192.168.1.0 0.0.0.255 area 100

IOU2(config)#router ospf 10
IOU2(config-router)#network 172.16.1.0 0.0.0.255 area 100


IOU3
IOU3(config)#route ospf 10
IOU3(config-router)#network 172.16.1.0 0.0.0.255 area 100

建立好OSPF




執行show ip route

發現多了172.16.1.0的路由,執行ping 172.16.1.20與172.16.1.30都能正常ping通





2017年3月7日 星期二

Linksys SFE 2000 Switch console 無法登入問題

某天遇到某設備名為Linksys SFE 200

嘗試了使用一堆console 線都無法連線

預設Putty 的Speed為9600

修改為115200終於登入成功


2017年3月6日 星期一

CentOS 7安裝Webmin

CentOS 7安裝Webmin


1.建立webmin.repo檔案

cd /etc/yum.repos.d 下建立webmin.repo檔案

2.新增webmin.repo內容
vi /etc/yum.repos.d/webmin.repo

貼入以下內容

[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1


3.安裝webmin
sudo yum install webmin


出現GPG KEY錯誤





GPG KEY 為 對下載物件進行簽名,防止被篡改用
指令:rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
執行yum install webmin




但不幸的是又出現錯誤了





這時需要匯入

匯入Webmin 的GPG key指令如下



wget http://www.webmin.com/jcameron-key.asc
sudo rpm --import jcameron-key.asc


接下來就能順利安裝了


4.開啟防火牆10000 port


sudo firewall-cmd --permanent --zone=public --add-port=10000/tcp
sudo firewall-cmd --permanent --zone=public --add-port=10000/udp
sudo firewall-cmd --reload



5.打開網頁輸入https://主機ip:10000





Webmin常用指令

systemctl status webmin.service   #查看是否為Running

systemctl restart webmin.service  #執行重啟Webmin

systemctl stop webmin.service     #停止Webmin服務

systemctl start webmin.service    #啟動webmin服務

systemctl enable httpd.service   #開機啟動httpd

systemctl disable httpd.service  #開機不啟動httpd

sestatus #查看selinux狀態

vi /etc/sysconfig/selinux
將SELINUX改為disabled
SELINUX=disabled #關閉selinux



ZABBIX-Agent 安裝流程

ZABBIX-Agent 安裝流程

1
[[jokerlan@zabbix1 ~]$ sudo vi /etc/yum.repos.d/zabbix.repo
Contents of the file:
1
2
3
4
5
[Zabbix]
name=Zabbix
baseurl=http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/
gpgcheck=1
gpgkey=http://repo.zabbix.com/zabbix-official-repo.key

2.[jokerlan@zabbix1 ~]$sudo yum install yum-utils
3.[jokerlan@zabbix1 ~]$ repoquery -qi zabbix-agent

Name      : zabbix-agent
Version     : 2.4.6
Release     : 1.el7
Architecture: x86_64
Size        : 583620
Packager    : None
Group       : Applications/Internet
URL         : http://www.zabbix.com/
Repository  : Zabbix
Summary     : Zabbix Agent
Source      : zabbix-2.4.6-1.el7.src.rpm
Description :
The Zabbix client agent, to be installed on monitored systems.

4.[jokerlan@zabbix1 ~]$ sudo yum install zabbix-agent

5.[jokerlan@zabbix1 ~]$sudo vi /etc/zabbix/zabbix_agentd.conf

85Server=127.0.0.1  ---------------改為Zabbix Server ip
126ServerActive=127.0.0.1 --------改為Zabbix Server ip
137Hostname=Zabbix serve-------改為Host自己Name
6. [jokerlan@zabbix1 ~]$systemctl enable zabbix-agent ----開機啟動
  [jokerlan@zabbix1 ~]$systemctl start zabbix-agent-------啟動
  [jokerlan@zabbix1 ~]$systemctl status zabbix-agent------查狀態是否為Running