Tag Cloud
Currently Reading
Latest Book Reviews
- Rancher Deep Dive Posted on March 31, 2023
- Leveraging Kustomize for Kubernetes Manifests Posted on March 24, 2023
- Automating Workflows with GitHub Actions Posted on October 13, 2022
- Deep-Dive Terraform on Azure Posted on August 30, 2022
- Effective DevOps Posted on January 5, 2022 All Book Reviews
Latest Posts
- BIND 9.7.3 Gotchas Posted on January 2, 2012
- Logging mod_rewrite redirects Posted on December 22, 2011
- Resetting MySQL root password Posted on December 19, 2011
- Removing blank lines in a text file Posted on December 17, 2011
- Vim - Removing the last character of each line in a file Posted on December 16, 2011
January 2, 2012
BIND 9.7.3 Gotchas
by Alpha01
On my new CentOS 6 powered BIND DNS server, it took a while to figure out why my custom jailed BIND configuration was not able to load any zone data files, even though the zone data files did not had any sort of syntax errors. Of which I verified using the named-checkzone
utility.
Errors
Dec 29 21:29:04 centos6 named[17311]: etc/db.rubysecurity.org:2: ignoring out-of-zone data (rubysecurity.org)
Dec 29 21:29:04 centos6 named[17311]: etc/db.rubysecurity.org:9: ignoring out-of-zone data (rubysecurity.org)
Dec 29 21:29:04 centos6 named[17311]: etc/db.rubysecurity.org:10: ignoring out-of-zone data (rubysecurity.org)
Dec 29 21:29:04 centos6 named[17311]: etc/db.rubysecurity.org:11: ignoring out-of-zone data (rubysecurity.org)
Dec 29 21:29:04 centos6 named[17311]: etc/db.rubysecurity.org:12: ignoring out-of-zone data (www.rubysecurity.org)
Dec 29 21:29:04 centos6 named[17311]: zone db.rubysecurity.org/IN: has 0 SOA records
Dec 29 21:29:04 centos6 named[17311]: zone db.rubysecurity.org/IN: has no NS records
Dec 29 21:29:04 centos6 named[17311]: zone db.rubysecurity.org/IN: not loaded due to errors.
Dec 29 21:29:04 centos6 named[17311]: etc/db.ubuntu:2: ignoring out-of-zone data (ubuntu)
Dec 29 21:29:04 centos6 named[17311]: zone db.ubuntu/IN: has 0 SOA records
Dec 29 21:29:04 centos6 named[17311]: zone db.ubuntu/IN: not loaded due to errors.
I came to realize the issue was within my named.conf master config file. Since I’m using BIND 9.7.3 (and newer versions), it turns out that the zone name needs to have a dot (.
) at the end of the domain name. This was really annoying since it appears that earlier versions didn’t tagged this an error and were able to load up zone files perfectly fine without the addition of the dot character at the end of the zone file name. Luckily, I was able to fix the issue, which by the way, the named-checkconf
utility was not able to detect this problem.
Broken:
zone "rubysecurity.org" IN {
type master;
file "etc/db.rubysecurity.org";
allow-update { key rndc-key; };
allow-query { any; };
};
Fix
zone "rubysecurity.org." IN {
type master;
file "etc/db.rubysecurity.org";
allow-update { key rndc-key; };
allow-query { any; };
};
bind
]
December 22, 2011
Logging mod_rewrite redirects
by Alpha01
Extremely useful for debugging mod_rewrite rules.
# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On
apache
]
December 19, 2011
Resetting MySQL root password
by Alpha01
1). End current mysql process
2). Run MySQL safe daemon with skipping grant tables
mysqld_safe --skip-grant-tables &
3). Login to MySQL as root with no password:
mysql -u root mysql
4). Run UPDATE query to reset the root password. In MySQL command line prompt issue the following two commands:
UPDATE user SET password=PASSWORD("NEWPASSWD") WHERE user="root";
FLUSH PRIVILEGES;
mysql
]
December 17, 2011
Removing blank lines in a text file
by Alpha01
sed '/^$/d' example_file
bash
]
December 16, 2011
Vim - Removing the last character of each line in a file
by Alpha01
In command mode:
:%s/.$//g
vim
]