Files
CyberPanel/plogical/dnsUtilities.pyc

93 lines
8.1 KiB
Plaintext
Raw Normal View History

2017-12-14 06:56:27 -05:00
<03>
2018-03-02 18:13:26 +05:00
<EFBFBD>T2Zc@sGddlZddlZddlZddlZddd<00><00>YZdS(i<><69><EFBFBD><EFBFBD>NtDNScBs<>eZdZdZdZed<00><00>Zed<00><00>Zed<00><00>Zed<00><00>Z ed<00><00>Z
2017-12-14 06:56:27 -05:00
ed<00><00>Z ed <00><00>Z ed
<00><00>Z ed <00><00>Zed <00><00>Zed <00><00>ZRS(s/etc/nsd/nsd.confs/usr/local/lsws/conf/zones/s/usr/local/lsws/conf/zonesc
CsyyDtjjtj<00>s+tjtj<00>ntj|}|d}ttjd<00>j <00>}tj
||<00>dkr*tj|<00>t|d<00>}tj ||<00>dkrtj ||<00>dkrtj |||||<00>dkr<>tj<00>|j<00>dS|j<00>dSq'|j<00>dSqC|j<00>dSntjj|<00>s<>tj|<00>t|d<00>}tj ||<00>dkr<>tj |||||<00>dkr<>tj<00>|j<00>dS|j<00>dSq!|j<00>dSnVt|d<00>}tj |||||<00>dkrtj<00>|j<00>dS|j<00>dS|j<00>tjjdd<17>dSWn.tk
rt} tjjt| <00>d <17>dSXdS(
Ns
/zone.conftritwitas*Zone file for virtualhost already exists. s[createNameServer]s [addEntryInMainZone](tostpathtexistsRtzones_base_dirtmkdirtcreate_zone_dirtopentnsd_baset readlinestcheckIfZoneExiststaddEntryInMainZonetperVirtualHostZoneFilet addNSRecordt
restartNSDtclosetloggingtCyberCPLogFileWritert writeToFiletIOErrortstr(
tvirtualHostNametfirstNSt firstNSIPtsecondNSt
secondNSIPtzonePatht zoneFilePathtdatatzoneFileToWritetmsg((s+/usr/local/CyberCP/plogical/dnsUtilities.pytcreateNameServer s^ 
 !




 !



!



  cCs.x'|D]}|j|<00>dkrdSqWdS(Ni<4E><69><EFBFBD><EFBFBD>ii(tfind(RRtitems((s+/usr/local/CyberCP/plogical/dnsUtilities.pyR Vs c
Csgd }d|d}d|dd}yttjd<00>}d}d}x<>|D]<5D>}|jd<00>dkr<>|dkr<>|j|<00>|j|<00>|j|<00>|jd<00>|j|<00>d }d }qN|j|<00>qNW|dkr|j|<00>|j|<00>|j|<00>|jd<00>n|j<00>dSWn8tk
rb} |j<00>tjj t
| <00>d
<17>d SXdS( Nszone:s
s
name: s zonefile: s
/zone.confRii<><69><EFBFBD><EFBFBD>is [addEntryInMainZone]szone:
( R
RR R#t
writelinesRRRRRR(
RRtzonetzoneNametzoneFilet mainZoneFilet zoneChecktnoZonesR$R!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyR^s8 !          

cCs<>d|dd}d}y?|j|<00>|j|<00>|jd<00>tj||<00>dSWn.tk
r<>}tjjt|<00>d<17>dSXdS( Ns$ORIGIN t.s
s
$TTL 86400is [perVirtualHostZoneFile]is $TTL 86400
(R%RtcreateSOARecordt BaseExceptionRRRR(RR torigintttlR!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyR<00>s   c
Cs<>d|dd}d }d}d}d}d}d}y}|jd<00>|j|<00>|j|<00>|j|<00>|j|<00>|j|<00>|j|<00>|j|<00>|jd<00>d
SWn.tk
r<>} tjjt| <00>d <17>d SXdS(Ns@ IN SOA ns1 admin@s (s
s 2012082703s 28800s 1400s 864000s 86400s )is [createSOARecord]is 2012082703
s 28800
s 1400
s 864000
s 86400
s )
(R%RRRRR(
Rt
fileHandletsoat serialNumbert refreshRatet retryRatetexpirytminTTLtendSOAR!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyR-<00>s*         c
Cs<>|jd<00>d}|jd<00>d}d |d}d|d}yu|jd<00>|jd<00>|j|<00>|j|<00>tj|d||<00>tj|d||<00>|jd<00>d SWn.tk
r<>} tjjt| <00>d
<17>dSXdS(NR,is tNSs s.
s
tAis [addRecord]s NSs NS s NSs NS ( tsplitR%Rt addRecordRRRRR(
t nsRecordOneRt nsRecordTwoRR1t NSARecordOnet NSARecordTwotNS1tNS2R!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyR<00>s      cCs<>|ddd|d|}y/|jd<00>|j|<00>|jd<00>dSWn.tk
r}}tjjt|<00>d<17>dSXdS(Ns tINs
is [addRecord]i(R%RRRRR(t recordValuet
recordTypetrecordIPR1t recordStringR!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyR<<00>s   cCs<>y<>g}|jd<00>|jd<00>|jd<00>tj|<00>}|dkrndGHdGHdGHtjjd<00>dSdGHd GHdGHdSWn.tk
r<>}tjjt|<00>d
<17>dSXdS( Nt systemctltrestarttnsdis/###############################################s/ Could restart NSD s[Failed to restart NSD]is/ NSD Restarted s [restartNSD](tappendt
subprocesstcallRRRtOSErrorR(tcmdtresR!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyR<00>s&    cCs$y<>tjjtj|<17>r3tjtj|<17>nttjd<00>j <00>}ttjd<00>}d}xa|D]Y}|j
|<00>dkr<>y%||d=||d=||d=WnPnXPn|d}qjWx|D]}|j |<00>q<>W|j <00>Wn-t k
r}tjjt|<00>d<17>nXdS(NRRii<><69><EFBFBD><EFBFBD>is [deleteZone](RRRRRtshutiltrmtreeR
R R R#R%RRNRRRR(tvirtualHostnameRtwriteDataToFiletindexR$R!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyt
deleteZone s*    cCs<>y<>tjjtj<00>s+tjtj<00>nttjd<00>j <00>}tj|}|d}tj
||<00>dkr<>tj ||<00>tj|<00>t|d<00>}tj ||<00>tj |d||<00>n<>tjj|<00>setj|<00>t|d<00>}tj ||<00>dkrTtj |d||<00>dkrCtj<00>|j<00>dS|j<00>dSq<53>|j<00>dSnSt|d<00>}tj |d||<00>dkr<>tj<00>|j<00>dS|j<00>dSWn-tk
r<>}tjjt|<00>d<17>nXdS( NRs
/zone.confiRR:iRs [addARecord](RRRRRRR R
R R R RRR<RRR.RRRR(RRDRFRRRR R!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyt
addARecord.sB 
  






c
Cs<>y<>tj|}|d}t|d<00>j<00>}t|d<00>}x`|D]X}|j|<00>dkr<>|j|<00>dkr<>|j|<00>dkr<>qEqE|j|<00>qEW|j<00>dSWn.tk
r<>} tj j
t | <00>d<17>dSXdS(Ns
/zone.confRRi<><69><EFBFBD><EFBFBD>is [addRecord]i( RRR
R R#R%RRRRRR(
RDRERFRRRRRTR$R!((s+/usr/local/CyberCP/plogical/dnsUtilities.pyt deleteRecordgs 
 ?
(t__name__t
__module__R RR t staticmethodR"R RRR-RR<RRVRWRX(((s+/usr/local/CyberCP/plogical/dnsUtilities.pyRsJ'$ !9((RRRRLRQR(((s+/usr/local/CyberCP/plogical/dnsUtilities.pyt<module>s