Server IP : 172.67.216.182 / Your IP : 172.70.189.79 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/panel/class_v2/ |
Upload File : |
# coding: utf-8 # ------------------------------------------------------------------- # aaPanel # ------------------------------------------------------------------- # Copyright (c) 2015-2016 aaPanel(www.aapanel.com) All rights reserved. # ------------------------------------------------------------------- # Author: <[email protected]> # ------------------------------------------------------------------- # ------------------------------ # ssl自动续订定时任务脚本 # ------------------------------ import os, json, sys, time os.chdir("/www/server/panel") if not 'class/' in sys.path: sys.path.insert(0,'class/') import public sys.path.append(".") import panelSSL import panelSite class dict_obj: def __contains__(self, key): return getattr(self, key, None) def __setitem__(self, key, value): setattr(self, key, value) def __getitem__(self, key): return getattr(self, key, None) def __delitem__(self, key): delattr(self, key) def __delattr__(self, key): delattr(self, key) def get_items(self): return self if __name__ == "__main__": get = dict_obj() obj = panelSSL.panelSSL() CertList = obj.GetCertList(get) cmd_list = json.loads(public.ReadFile("/www/server/panel/vhost/crontab.json")) panelSite_=panelSite.panelSite() for i in CertList: timeArray = time.strptime(i['notAfter'], "%Y-%m-%d") timestamp = time.mktime(timeArray) if int(timestamp) - time.time() < 86400 * 30: # 如果证书到期时间小于多少天就续订 subject = i['subject'] for j in cmd_list: if subject == j['siteName']: cmd = j['cmd'] public.ExecShell(cmd) # 保存证书 get.siteName=subject result = panelSite_.save_cert(get) public.serviceReload()