欢迎来到至成科技_西安服务器托管_西安服务器租用_西安域名注册
029-89390727
时间:2013-10-16  来源:至成科技  作者:SEOR  点击次数:1569

更新服务器

既然你是访问服务器的先进用户,你就不用担心黑客鬼鬼祟祟进入,再次正常呼吸。当有一些针对你服务器的更新时,正是修补的机会,所以动手吧,就现在。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$ sudo apt-get update
...
Hit http://ca.archive.ubuntu.com precise-updates/universe Translation-en_CA
Hit http://ca.archive.ubuntu.com precise-updates/universe Translation-en
Hit http://ca.archive.ubuntu.com precise-backports/main Translation-en
Hit http://ca.archive.ubuntu.com precise-backports/multiverse Translation-en
Hit http://ca.archive.ubuntu.com precise-backports/restricted Translation-en
Hit http://ca.archive.ubuntu.com precise-backports/universe Translation-en
Fetched 3,285 kB in 5s (573 kB/s)
Reading package lists... Done
  
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  linux-headers-generic-lts-quantal linux-image-generic-lts-quantal
The following packages will be upgraded:
  accountsservice apport apt apt-transport-https apt-utils aptitude bash ...
73 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 61.0 MB of archives.
After this operation, 151 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
...
Setting up libisc83 (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up libdns81 (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up libisccc80 (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up libisccfg82 (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up libbind9-80 (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up liblwres80 (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up bind9-host (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up dnsutils (1:9.8.1.dfsg.P1-4ubuntu0.6) ...
Setting up iptables (1.4.12-1ubuntu5) ...
...


安装防火墙

有销售西安虚拟主机的公司,在不同的系统中都会做好相关的安全防护,来数据的安全,如果是西安VPS主机呢,例如是LINUX服务器,就需要手动安装防火墙,并配置相关规则。

安装现在正较流行的防火墙软件?好,行动吧。那就配置一个防火墙。之后你总是可以增加另一个异常,几分钟额外的工作并不会折腾死你。Iptables在Ubuntu里预装了,所以去设置一些规则吧。

1
$ sudo mkdir /etc/iptables

/etc/iptables/rules

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
  
# Accept any related or established connections
-I INPUT  1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-I OUTPUT 1 -m state --state RELATED,ESTABLISHED -j ACCEPT
  
# Allow all traffic on the loopback interface
-A INPUT  -i lo -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
  
# Allow outbound DHCP request - Some hosts (Linode) automatically assign the primary IP
#-A OUTPUT -p udp --dport 67:68 --sport 67:68 -j ACCEPT
  
# Outbound DNS lookups
-A OUTPUT -o eth0 -p udp -m udp --dport 53 -j ACCEPT
  
# Outbound PING requests
-A OUTPUT -p icmp -j ACCEPT
  
# Outbound Network Time Protocol (NTP) request
-A OUTPUT -p udp --dport 123 --sport 123 -j ACCEPT
  
# SSH
-A INPUT  -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
  
# Outbound HTTP
-A OUTPUT -o eth0 -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m tcp --dport 443 -m state --state NEW -j ACCEPT
  
COMMIT

通过 iptables-apply 命令为规则集生效。如果你丢失连接,修补你的规则,在继续之前再试一下

1
2
3
4
$ sudo iptables-apply /etc/iptables/rules
Applying new ruleset... done.
Can you establish NEW connections to the machine? (y/N) y
... then my job is done. See you next time.

创建文件 /etc/network/if-pre-up.d/iptables,然后写入下面内容。当你启动服务器的时候,将自动载入你的iptables规则。

西安网站建设-至成科技光放微信

相关阅读:

陕西本土非营利性IDC互联网接入商/  Shanxi Local nonprofit IDC Internet access provider

公司地址:西安市经开区凤城四路西安国际企业中心B座23层06-10室

全国咨询热线(TEL): 029-89390727

7*24小时售前咨询电话 :
029-89390727   029-63390892   029-63390961
029-68090209

7*24小时售后服务电话 : 029-89393039

Top