logging and rndc
This commit is contained in:
parent
17fd417d52
commit
055afe70e3
@ -29,6 +29,7 @@ RUN \
|
||||
apt install -y netcat && \
|
||||
echo "include \"/etc/bind/local.key\";" >> /etc/bind/named.conf && \
|
||||
echo "include \"/etc/bind/dynamic/dynamic-zones.conf\";" >> /etc/bind/named.conf && \
|
||||
echo "include \"/etc/bind/named.conf.rndc\";" >> /etc/bind/named.conf && \
|
||||
echo "include \"/etc/bind/named.conf.logging\";" >> /etc/bind/named.conf
|
||||
|
||||
COPY ./server/ $APP_DIR
|
||||
|
@ -1,5 +1,6 @@
|
||||
logging {
|
||||
category default { default_logfile; };
|
||||
category queries { default_logfile; };
|
||||
channel default_logfile {
|
||||
file "/opt/app/var/log/named.log";
|
||||
print-time yes;
|
||||
|
@ -1,25 +1,21 @@
|
||||
import syslog
|
||||
import sys
|
||||
|
||||
|
||||
class Logger(object):
|
||||
@staticmethod
|
||||
def log(data):
|
||||
syslog.syslog(syslog.LOG_INFO, data)
|
||||
if Logger.debugFlag:
|
||||
# print data
|
||||
sys.stderr.write(data)
|
||||
with open(Logger.filename, 'a') as f:
|
||||
f.write(data)
|
||||
|
||||
@staticmethod
|
||||
def debug(data):
|
||||
if Logger.debugFlag:
|
||||
syslog.syslog(syslog.LOG_DEBUG, data)
|
||||
# print data
|
||||
sys.stderr.write(data)
|
||||
with open(Logger.filename, 'a') as f:
|
||||
f.write(data)
|
||||
|
||||
@staticmethod
|
||||
def openlog():
|
||||
syslog.openlog('yadyn', syslog.LOG_PID, syslog.LOG_LOCAL0)
|
||||
def openlog(filename):
|
||||
Logger.filename = filename
|
||||
|
||||
@staticmethod
|
||||
def debugEnable():
|
||||
@ -30,4 +26,4 @@ class Logger(object):
|
||||
Logger.debugFlag = False
|
||||
|
||||
debugFlag = False
|
||||
|
||||
filename = '/tmp/yadyn.log'
|
||||
|
@ -48,6 +48,7 @@ PID_FILE = "/var/run/yadyn.pid"
|
||||
ENTRIES_FILE = "/opt/app/var/data/entries"
|
||||
CUSTOMERS_FILE = "/opt/app/var/data/customers"
|
||||
ACTIONLOG_DIR = "/opt/app/var/log/actionlog"
|
||||
LOG_FILE = "/opt/app/var/log/yadyn.log"
|
||||
ADMIN_PWD = 'test123'
|
||||
DNS_DUMMY = False
|
||||
DEBUG = True
|
||||
@ -69,7 +70,7 @@ if pid:
|
||||
|
||||
|
||||
|
||||
Logger.openlog()
|
||||
Logger.openlog(LOG_FILE)
|
||||
if DEBUG:
|
||||
Logger.debugEnable()
|
||||
|
||||
|
@ -5,10 +5,10 @@ echo "Generating tsig key ..."
|
||||
KEY=`cat /etc/bind/local.key | awk -F\" '/secret/ {print $2}'`
|
||||
sed -i "s,KEYVALUE,$KEY," /opt/app/yadyn
|
||||
|
||||
# echo "Generating rndc key ..."
|
||||
# /usr/sbin/rndc-confgen > /etc/bind/rndc.conf
|
||||
# KEY=`cat /etc/bind/rndc.conf | egrep "^\s*secret" | awk -F\" '{print $2}'`
|
||||
# sed -i "s,RNDCKEY,$KEY," /etc/bind/named.conf.rndc
|
||||
echo "Generating rndc key ..."
|
||||
/usr/sbin/rndc-confgen -a
|
||||
KEY=`cat /etc/bind/rndc.key | awk -F\" '/secret/ {print $2}'`
|
||||
sed -i "s,RNDCKEY,$KEY," /etc/bind/named.conf.rndc
|
||||
|
||||
echo "Starting named ..."
|
||||
/usr/sbin/named
|
||||
|
Loading…
x
Reference in New Issue
Block a user