Posts Tagged ‘ CentOS

如何停用 SSH Server 不安全的加密演算法: ARCFOUR、CBC、HMAC-MD5、HMAC-RIPEMD160

弱點掃瞄

弱點 1: SSH Supports Weak Cipher

The SSH server is configured to support either Arcfour or Cipher Block Chaining (CBC) mode cipher algorithms. SSH can be configured to use Counter (CTR) mode encryption instead of CBC. The use of Arcfour algorithms should be disabled.

  • Severity: Medium
  • Risk: A weak cipher has been detected.
  • Recommendation: Configure the SSH server to disable Arcfour and CBC ciphers.

弱點 2: SSH Supports Weak MAC

The SSH server is configured to support MD5 algorithm. The cryptographic strength depends upon the size of the key and algorithm that is used. A Modern MAC algorithms such as SHA1 or SHA2 should be used instead.

  • Severity: Medium
  • Risk: A weak Message Authentication Code (MAC) algorithm has been detected.
  • Recommendation: Configure the SSH server to disable the use of MD5.

Read more

CentOS 5/6 改為可用的 yum 套件庫來源 (2022)

若執行 yum 出現:

http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article

表示系統預設的 yum 套件庫可能已經不存在!

我們可以在 vault.centos.org 找到可用的套件庫來源:

  • vault.centos.org: http
  • archive.kernel.org: http - rsync (rsync://archive.kernel.org::centos-vault/)
  • linuxsoft.cern.ch: http - rsync (rsync://linuxsoft.cern.ch/centos-vault/)
  • mirror.nsc.liu: http - rsync (rsync://mirror.nsc.liu.se::centos-store/)

Read more

Centos 6.x 如何停用 IPv6

為什麼要停用 IPv6?

  1. 不熟、抗拒學習
  2. IPv6 也要設 IP 反解 PTR
  3. Gmail 會擋沒有設 IPv6 反解的郵件

Read more

CentOS 如何加入第三方 Yum 套件庫: EPEL

EPEL 的全稱為「Extra Packages for Enterprise Linux」,是由 Fedora 社群打造,為 RHEL 及衍生發行版如 CentOS、Scientific Linux、Rocky Linux、Oracle Linux...等提供高品質套件庫的專案。裝了 EPEL 之後,等於添加了一個資源豐富的第三方套件庫。

Read more

CentOS 5/6 快速安裝 VPN Server (PPTP)

「VPN」是一種常用於中、大型企業或團體與團體間的私人網路的通訊方法。藉由 VPN 所建立的加密通道,可以讓你從外部存取公司內部的資源,或透過連線到 VPN 的 Server 當跳板,去存取被限制的外部資源 (俗稱「翻牆」)。

在使用 VPN 之前,你得先有一台提供服務的 VPN Server,現在滿多人會去租用國外的 VPS 當 Server,要架站兼翻牆,Linode 是不錯的選擇。

以下把握幾個重點即可快速完成 Linux 的 PPTP 的 VPN Server 架設:

  • PPP - 點對點協定 (Point-to-Point Protocol)
  • PPTP - 點對點通道協定 (Point-to-Point Tunneling Protocol)
  • iptables - 設定封包轉發規則

安裝步驟

1. 判斷 ppp 是否可用:

$ cat /dev/ppp
cat: /dev/ppp: No such device or address

如果出現跟上面一樣的訊息「No such device or address」,那不用擔心,這表示 ppp 是可用的,可以正常架設 pptp。

如果出現的是「Permission denied」,表示 ppp 是關閉的,下面的步驟就可以不用再看了。
Read more

如何解決 yum 安裝 glibc-headers 失敗的問題

最近我用 yum 在安裝套件時,突然出現這些錯誤訊息:

---> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
--> Finished Dependency Resolution
Error: Package: glibc-headers-2.12-1.107.el6.x86_64 (base)
           Requires: kernel-headers >= 2.2.1
Error: Package: glibc-headers-2.12-1.107.el6.x86_64 (base)
           Requires: kernel-headers
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

錯誤訊息有提到跟 "kernel" 有關!!

原來是我當初為了不讓 yum 自動更新 Kernel,所以我在 "/etc/yum.conf" 加了這一行:

exclude=kernel*

把這一行刪除就好了。之後如果遇到有關 Kernel 的失敗狀況,應該都是這個問題。

解決無法讀取 mcrypt 模組的問題

明明已經用 yum 安裝 php-mcrypt 了,在登入 phpMyAdmin 時,卻出現了錯誤訊息:

無法讀取 mcrypt 模組, 請檢查 PHP 設定

執行 php -v ,也出現:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/module.so' - /usr/lib64/php/modules/module.so: cannot open shared object file: No such file or directory in Unknown on line 0
; Enable mcrypt extension module

依照錯誤訊息,到 /usr/lib64/php/modules/ 查看,確實沒有「module.so」,倒是有一個 「mcrypt.so」。
Read more

CentOS 安裝 VMware Workstation / VMware Player

下載網址

下載回來的,是一個副檔名為「.bundle」的檔案。

安裝 (以 VMware Workstation 為例)

你必須先登入 GNOME 或 KDE 桌面來進行安裝。
Read more

CentOS 5/6 安裝 GNOME 與 KDE 桌面環境

最近開始接觸 LinodeDigitalOcean 這兩家的 VPS,裡面提供的 Linux 系統都是採「最小安裝」,於是我就想試試看是否能安裝 GNOME 桌面,再以 xrdp 連接遠端桌面

GroupInstall

yum 本身就提供 groupinstall 的方式來安裝套件組,先以下列指令查看有哪些套件組:

$ yum grouplist | more

CentOS 5.x 與 6.x 套件組的名稱不太一樣,例如桌面環境套件:

CentOS 5.x:

  • GNOME: GNOME Desktop Environment
  • KDE: KDE (K Desktop Environment)

CentOS 6.x:

  • GNOME: Desktop
  • KDE: KDE Desktop

以下的步驟是以 CentOS 6.x 來做安裝,如果你是用 CentOS 5.x,請自行替換這兩個套件組的名稱。

Read more

CentOS 安裝 vsftpd FTP Server

為什麼這次要安裝 vsftpd,而不安裝 proftpd 呢? 其實只有一個原因,就是 vsftpd 直接支援 UTF8,並且會自動轉換為 Client 端 FTP 軟體的語系。

1. 安裝 vsftpd:

yum -y install vsftpd
touch /etc/vsftpd/chroot_list
chkconfig vsftpd on

2. 安裝完後讓防火牆可以通過 21 Port:

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
service iptables save

3. 編輯 "/etc/vsftpd/vsftpd.conf",找到:

anonymous_enable=YES

將 YES 改成 NO。
如要限制用戶只能在自己的家目錄,則在檔案加入:

# 限制用戶只能在家目錄 (/etc/vsftpd/chroot_list 的用戶可不受限制)
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

如果沒有 /etc/vsftpd/chroot_list,你仍須建立這個空白檔案,否則 ftp 會連不上。

如要 ftp 的檔案列表可以看到跟 Server 上同樣的時間,請在檔案加入:

# 使用本地時區
use_localtime=YES

4. 啟動 vsftpd:

service vsftpd start

return top