예제 #1
0
 def __init__(self, clu_nid):
     self.cluster = None
     self.salt_token = None
     self.logger = log_setting("salt_client")
     self.login_url = None
     self.action_url = None
     self.username = None
     self.password = None
     self.minion = None
     self.eauth = 'pam'
     self.verify = False
     self.ssl_dir = '/alidata1/conf/tengine/ssl/'
     self.site_dir = '/alidata1/conf/tengine/vhost/'
     self.waf_conf_path = '/alidata1/app/aegis_waf_iv/config.json'
     self.ngx_path = '/alidata1/app/tengine/sbin/nginx'
     self.load_data(clu_nid)
예제 #2
0
#!/usr/bin/env python
# encoding: utf-8
import re
import subprocess
import os
import hashlib
from modules import Cert
from utils.log import log_setting
from utils.nginx.redis_lock import deco, RedisLock

logger = log_setting(app_name="aegis_waf_4.0")

# def test_ngx(web):
#     result = {'success': True, 'info': ''}
#     return result


@deco(RedisLock("112255"))
def test_ngx(web):
    result = {'success': False, 'info': ''}
    try:
        ssl_dir = '/alidata1/app/aegis-waf3/utils/nginx/conf/ssl/'
        site_dir = '/alidata1/app/aegis-waf3/utils/nginx/conf/vhost/'
        # site_dir = '/usr/local/nginx/conf.d/'
        # waf_conf_path = '/alidata1/app/aegis_waf_iii/config.json'
        ngx_path = '/alidata1/app/tengine/sbin/nginx'
        # ngx_path = '/alidata1/app/tengine/nginx/sbin/nginx'

        # 本地同步所有证书
        certs = Cert.get_all(status=1)
        for cert_ in certs:
예제 #3
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import ansible.playbook
import ansible.inventory
import ansible.runner
from utils.log import log_setting
from ansible import callbacks
from ansible import utils

logger = log_setting("asb")


def ansble_adhoc_run(ans_mod, ans_host, ans_user, module_args):

    inventory = ansible.inventory.Inventory()
    print inventory.basedir()
    logger.info("Executing Ansible Runner on %s with module %s" %
                (ans_host, ans_mod))
    run_adhoc = ansible.runner.Runner(
        module_name=ans_mod,
        module_args=module_args,
        pattern=ans_host,
        inventory=inventory,
        remote_user=ans_user,
    ).run()
    logger.info("Executing Ansible Runner on %s with module %s" %
                (ans_host, ans_mod))
    logger.info("Runner execution completed with Result: %s" % run_adhoc)
    return run_adhoc

예제 #4
0
 def __init__(self):
     self.client = Mongodb()
     self.db = self.client.conn()
     self.logger = log_setting('average_strategy')
예제 #5
0
 def __init__(self):
     self.client = Mongodb()
     self.db = self.client.conn()
     self.logger = log_setting('trading_loader')
예제 #6
0
import json
import hashlib
import sys
import datetime as dt
from datetime import datetime
from app import db
from config import ENV, ERROR_COUNT, AUTH_SPAN_TIME
from utils.log import log_setting
from utils.tools import get_key, get_hash, get_uuid
from sqlalchemy import or_
from base_models import CompatibleModel
reload(sys)
sys.setdefaultencoding('utf-8')

logger = log_setting(app_name="aegis_waf_4.0_mysql")

cluster_admin = db.Table(
    'cluster_admin', db.Model.metadata,
    db.Column('cluster_id', db.Integer, db.ForeignKey('cluster.id')),
    db.Column('admin_id', db.Integer, db.ForeignKey('admin.id')),
    db.Column('id', db.Integer, primary_key=True))

cluster_white = db.Table(
    'cluster_white', db.Model.metadata,
    db.Column('cluster_id', db.Integer, db.ForeignKey('cluster.id')),
    db.Column('white_id', db.Integer, db.ForeignKey('white_list.id')),
    db.Column('id', db.Integer, primary_key=True))


class Admin(db.Model):
예제 #7
0
 def __init__(self):
     self.client = Mongodb()
     self.db = self.client.conn()
     self.logger = log_setting('week_data')