Ejemplo n.º 1
0
def get_unmanaged_servers(request):
    launcher = EC2InstanceAdmin(region = "us-east-1")
    chef = ChefClient()
    iaas_instance_names = launcher.get_all_running_instance_names()
    chef_nodes = chef.get_all_nodes()
    unmanaged_nodes = []
    for ec2_instance in iaas_instance_names:
       if ec2_instance not in chef_nodes:
             unmanaged_nodes.append(ec2_instance)
    response_key_value = {"Unmanaged" : unmanaged_nodes}
    return HttpResponse(json.dumps(response_key_value), content_type="application/json")
Ejemplo n.º 2
0
#!/usr/bin/python

__author__ = 'nirv'

from Chef.ConfigurationManagement import ChefClient
from AWS.EC2 import EC2

def get_menu():
    return ("\n----- Secure Cloud Management Console -----\n"
            "1. Launch secure instance\n"
            "2. Locate not managed instances\n"
            "3. Exit\n"
            "Your choise: ")

ec2 = EC2(False, "us-east-1")
chef = ChefClient()

while True:
    response = raw_input(get_menu())
    if response == '1':
        ec2.create_secure_instance("ami-c65be9ae","t1.micro","Secure Instance") # ami-c65be9ae is Ubuntu 14
    elif response == '2':
        ec2_instances = ec2.get_all_running_instance_names()
        chef_nodes = chef.get_all_nodes()
        print "Not managed nodes list: "
        for ec2_instance in ec2_instances:
            if ec2_instance not in chef_nodes:
                print ec2_instance
    else:
        exit()
Ejemplo n.º 3
0
#!/usr/bin/python

__author__ = 'nirv'

from Chef.ConfigurationManagement import ChefClient
from NessusScanner.VulnerabilityAssessment import Scanner
from CloudServices.Common.Exceptions import RemediationException,GenericException
from CloudServices.IaaS.Instances import EC2Instance
from CloudServices.Common.Logger import Logger

ec2 = EC2Instance()

try:
    chef_client = ChefClient()
    chef_client.verify_management()

    nessus = Scanner()
    nessus.run_scan()

    ec2.move_current_instance_to_production_group()
    ec2.strict_current_instance_role_permissions()

except RemediationException as re:
    ## ec2.strict_current_instance_role_permissions() ## Depends on the business, it can be added.
    exit()

except GenericException as ge:
    exit()

except Exception as ex:
    Logger.log("error", ex.message)