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