我遇到了一个严重的问题,导致我的服务器瘫痪。
由于某些未知原因,尽管我尽力修复日志中发现的问题,但命名仍不再起作用。
每当我尝试运行重建DNS配置(控制面板)
warn [fixrndc] /usr/sbin/rndc status failed: rndc: connect failed: 127.0.0.1#953: connection refused
当我检查命名的状态时:
root@host [/etc]# /etc/init.d/named status
rndc: connect failed: 127.0.0.1#953: connection refused
这是我的 /var/log/messages 尾部
root@host [/etc]# tail /var/log/messages
Nov 24 22:32:25 host named[21687]: listening on IPv4 interface eth1, 108.xx.18.18#53
Nov 24 22:32:25 host named[21687]: listening on IPv4 interface eth1:cp1, 108.xx.18.19#53
Nov 24 22:32:25 host named[21687]: listening on IPv4 interface eth1:cp2, 108.xx.18.20#53
Nov 24 22:32:25 host named[21687]: listening on IPv4 interface eth1:cp3, 108.xx.18.21#53
Nov 24 22:32:25 host named[21687]: listening on IPv4 interface eth1:cp4, 108.xx.18.22#53
Nov 24 22:32:25 host named[21687]: listening on IPv4 interface eth1:cp5, 108.xx.18.23#53
Nov 24 22:32:25 host named[21687]: command channel listening on 127.0.0.1#953
Nov 24 22:32:25 host named[21687]: couldn't open pid file '/var/run/named/named.pid': Permission denied
Nov 24 22:32:25 host named[21687]: exiting (due to early fatal error)
Nov 24 22:32:25 host /etc/init.d/named: named startup succeeded
我的配置被赋予了以下权限:
root@host [/etc]# ls -lh | grep named.conf
-rw-r--r-- 1 named root 4.9K Nov 24 22:11 named.conf
我的named.conf有以下代码:(减去区域)
include "/etc/rndc.key";
controls {
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};
options {
/* make named use port 53 for the source of all queries, to allow
* firewalls to block all ports except 53:
*/
// query-source port 53;
recursion no;
/* We no longer enable this by default as the dns posion exploit
has forced many providers to open up their firewalls a bit */
// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // the default
pid-file "/var/run/named/named.pid";
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
/* memstatistics-file "data/named_mem_stats.txt"; */
allow-transfer { "none"; };
};
rndc 上的权限:
root@host [/etc]# ls -lh | grep rndc
-rw-rw---- 1 named named 479 Nov 24 21:29 rndc.conf
-rw-rw---- 1 named named 479 Nov 24 21:16 rndc.conf.bak
-rw-rw---- 1 named named 77 Nov 24 21:29 rndc.key
我的命名文件夹权限:
ls -lh /var/run/named/
total 8.0K
drwxrwxr-x 2 named named 4.0K Jan 7 2013 ./
drwxrwx--- 22 root root 4.0K Nov 24 22:29 ../
这里有什么突出的东西吗?
感谢您的帮助!
答案1
显然,(a) 基本问题名为无法写入其 pid 文件。想到的可能性有
- passwd 文件中指定用户的冲突条目
- linux系统
关于如何测试这些理论的建议,请见评论。
由于更改 named.conf 中 pid 文件的位置已经修复了问题,因此 /var/run 下的文件夹权限似乎仍然存在问题。