Esempio n. 1
0
    def __init__(self, debug):
        handlers = [
            (r"/?", RootHandler),
            (r"/login/?", LoginHandler),
            (r"/logout/?", LogoutHandler),
            #(r"/ws/?", WebSocketHandler),
            (r"/adminForm", AdminHandler),

            ##### User and Groups API
            (r"/api/user/?", GetUserApi),
            (r"/api/users/?", GetUsersApi),
            (r"/api/users/create/?", CreateUserApi),
            (r"/api/users/delete/?", DeleteUserApi),
            (r"/api/users/edit/?", ModifyUserApi),
            (r"/api/groups/?", GetGroupApi),
            (r"/api/groups/create", AddGroupApi),
            (r"/api/groups/delete", DeleteGroupApi),
            (r"/api/groups/edit", ModifyGroupApi),

            ##### Notification API
            (r"/api/v1/notifications?", NotificationsHandler),
            (r"/api/v1/notification/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?",
             NotificationHandler),
            (r"/api/v1/notifications/get_valid_fields/?",
             GetAllValidFieldsForNotifications),
            (r"/api/permissions/?", GetPermissionsApi),

            ##### Customers API
            (r"/api/customers/?", GetCustomerHandler),
            (r"/api/customers/create/?", AddCustomerHandler),
            (r"/api/customers/delete/?", DeleteCustomerHandler),
            (r"/api/customers/edit/?", ModifyCustomerHandler),

            ##### Monitoring Api
            (r"/api/monitor/memory/?", GetMemoryStats),
            (r"/api/monitor/filesystem/?", GetFileSystemStats),
            (r"/api/monitor/cpu/?", GetCpuStats),
            (r"/api/monitor/?", GetAllStats),

            ##### RA Api
            (r"/api/ra/rd/password/?", SetPassword),
            (r"/api/ra/rd/([^/]+)/?", RDSession),
            (r"/ws/ra/status/?", RDStatusQueue),

            ##### Email API Handlers
            (r"/api/email/config/create?", CreateEmailConfigHandler),
            (r"/api/email/config/list?", GetEmailConfigHandler),

            ##### Logger API Handlers
            (r"/api/logger/modifyLogging?", LoggingModifyerHandler),
            (r"/api/logger/getParams?", LoggingListerHandler),

            ##### Scheduler API Handlers
            (r"/api/v1/schedules?", ScheduleListerHandler),
            (r"/api/v1/schedule/([A-Za-z0-9_ ]+.*)?",
             ScheduleAppDetailHandler),
            (r"/api/v1/schedules/recurrent/none?",
             SchedulerDateBasedJobHandler),
            (r"/api/v1/schedules/recurrent/daily?",
             SchedulerDailyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/monthly?",
             SchedulerMonthlyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/yearly?",
             SchedulerYearlyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/weekly?",
             SchedulerWeeklyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/custom?",
             SchedulerCustomRecurrentJobHandler),

            ##### Reports Api
            (r"/api/v1/reports/osdetails?", AgentsOsDetailsHandler),
            (r"/api/v1/reports/hardwaredetails?",
             AgentsHardwareDetailsHandler),
            (r"/api/v1/reports/cpudetails?", AgentsCPUDetailsHandler),
            (r"/api/v1/reports/memorydetails?", AgentsMemoryDetailsHandler),
            (r"/api/v1/reports/diskdetails?", AgentsDiskDetailsHandler),
            (r"/api/v1/reports/networkdetails?", AgentsNetworkDetailsHandler),

            ##### Agent API Handlers
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?",
             AgentHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/bar/severity?",
             AgentSeverityHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/column/range/apps/os?",
             AgentOsAppsOverTimeHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/tag?",
             TagsAgentHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/os?",
             AgentIdOsAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/remediationvault?",
             AgentIdAgentAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/custom?",
             AgentIdCustomAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/supported?",
             AgentIdSupportedAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/operations?",
             AgentOperationsHandler),

            ##### Agents API Handlers
            (r"/api/v1/agents", AgentsHandler),

            ##### Tag API Handlers
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?",
             TagHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/bar/severity?",
             TagSeverityHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/column/range/apps/os?",
             TagOsAppsOverTimeHandler),
            #(r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/linear/severity?",TagPackageSeverityOverTimeHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/os?",
             TagIdOsAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/remediationvault?",
             TagIdAgentAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/supported?",
             TagIdSupportedAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/custom?",
             TagIdCustomAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/operations?",
             TagOperationsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/stats_by_os?",
             TagStatsByOsHandler),

            ##### Tags API Handlers
            (r"/api/v1/tags", TagsHandler),

            ##### FileData API Handlers
            (r'/api/v1/apps/info?', FileInfoHandler),

            ##### MightyMouse API Handlers
            (r'/api/v1/relay/([A-Za-z0-9:,"_ ]+.*)?', RelayServerHandler),
            (r"/api/v1/relay", RelayServersHandler),

            ##### Os Apps API Handlers
            (r"/api/v1/app/os/([0-9A-Za-z]{64})?", AppIdOsAppsHandler),
            (r"/api/v1/app/os/([0-9A-Za-z]{64})/agents?",
             GetAgentsByAppIdHandler),
            (r"/api/v1/apps/os", OsAppsHandler),

            ##### Custom Apps API Handlers
            (r"/api/v1/app/custom/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?",
             AppIdCustomAppsHandler),
            (r"/api/v1/app/custom/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/agents?",
             GetAgentsByCustomAppIdHandler),
            (r"/api/v1/apps/custom?", CustomAppsHandler),
            (r"/api/v1/apps/custom/upload/finalize?",
             ThirdPartyPackageUploadHandler),
            (r"/api/v1/apps/custom/upload/data?", ThirdPartyUploadHandler),
            (r"/upload/package?", ThirdPartyPackageUploadHandler),
            (r"/api/v1/apps/custom/upload/uuid?", GetThirdPartyUuidHandler),

            ##### Supported Apps API Handlers
            (r"/api/v1/app/supported/([0-9A-Za-z]{64})?",
             AppIdSupportedAppsHandler),
            (r"/api/v1/app/supported/([0-9A-Za-z]{64})/agents?",
             GetAgentsBySupportedAppIdHandler),
            (r"/api/v1/apps/supported?", SupportedAppsHandler),

            ##### Agent Apps API Handlers
            (r"/api/v1/app/remediationvault/([0-9A-Za-z]{64})?",
             AppIdAgentAppsHandler),
            (r"/api/v1/app/remediationvault/([0-9A-Za-z]{64})/agents?",
             GetAgentsByAgentAppIdHandler),
            (r"/api/v1/apps/remediationvault?", AgentAppsHandler),

            ##### Dashboard API Handlers
            (r"/api/v1/dashboard/graphs/bar/severity?", CustomerSeverityHandler
             ),
            #(r"/api/v1/dashboard/graphs/linear/severity?",PackageSeverityOverTimeHandler),
            (r"/api/v1/dashboard/graphs/bar/stats_by_os?",
             CustomerStatsByOsHandler),
            (r"/api/v1/dashboard/graphs/column/range/apps/os?",
             OsAppsOverTimeHandler),
            (r"/api/v1/dashboard/widgets/unique_count?", WidgetHandler),
            (r"/api/v1/dashboard/widgets/top_needed?", TopAppsNeededHandler),
            (r"/api/v1/dashboard/widgets/recently_released?",
             RecentlyReleasedHandler),

            ##### Operations API Handlers
            (r"/api/v1/operations?", GetTransactionsHandler),
            (r"/api/v1/operation/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?",
             OperationHandler),

            ##### Generic API Handlers
            (r"/api/v1/supported/operating_systems?",
             FetchSupportedOperatingSystems),
            (r"/api/v1/supported/production_levels?",
             FetchValidProductionLevels),
            #(r"/api/package/getDependecies?", GetDependenciesHandler),

            ##### File system access whitelist
            (r"/css/(.*?)", tornado.web.StaticFileHandler, {
                "path": "wwwstatic/css"
            }),
            (r"/font/(.*?)", tornado.web.StaticFileHandler, {
                "path": "wwwstatic/font"
            }),
            (r"/img/(.*?)", tornado.web.StaticFileHandler, {
                "path": "wwwstatic/img"
            }),
            (r"/js/(.*?)", tornado.web.StaticFileHandler, {
                "path": "wwwstatic/js"
            }),
            (r"/packages/*/(.*?)", tornado.web.StaticFileHandler, {
                "path": "/opt/TopPatch/var/packages"
            })
        ]

        template_path = "/opt/TopPatch/tp/templates"
        settings = {
            "cookie_secret":
            base64.b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes),
            "login_url":
            "/login",
        }
        self.scheduler = start_scheduler()
        initialize_indexes_and_create_tables()
        hierarchy_db.init()

        tornado.web.Application.__init__(self,
                                         handlers,
                                         template_path=template_path,
                                         debug=debug,
                                         **settings)
Esempio n. 2
0
    def __init__(self, debug):
        handlers = [
            (r"/?", RootHandler),
            (r"/login/?", LoginHandler),
            (r"/logout/?", LogoutHandler),
            #(r"/ws/?", WebSocketHandler),
            (r"/adminForm", AdminHandler),

            ##### User and Groups API
            (r"/api/user/?", GetUserApi),
            (r"/api/users/?", GetUsersApi),
            (r"/api/users/create/?", CreateUserApi),
            (r"/api/users/delete/?", DeleteUserApi),
            (r"/api/users/edit/?", ModifyUserApi),

            (r"/api/groups/?", GetGroupApi),
            (r"/api/groups/create", AddGroupApi),
            (r"/api/groups/delete", DeleteGroupApi),
            (r"/api/groups/edit", ModifyGroupApi),

            ##### Notification API
            (r"/api/v1/notifications?", NotificationsHandler),
            (r"/api/v1/notification/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?", NotificationHandler),
            (r"/api/v1/notifications/get_valid_fields/?",
                GetAllValidFieldsForNotifications),
            (r"/api/permissions/?", GetPermissionsApi),

            ##### Customers API
            (r"/api/customers/?", GetCustomerHandler),
            (r"/api/customers/create/?", AddCustomerHandler),
            (r"/api/customers/delete/?", DeleteCustomerHandler),
            (r"/api/customers/edit/?", ModifyCustomerHandler),

            ##### Monitoring Api
            (r"/api/monitor/memory/?", GetMemoryStats),
            (r"/api/monitor/filesystem/?", GetFileSystemStats),
            (r"/api/monitor/cpu/?", GetCpuStats),
            (r"/api/monitor/?", GetAllStats),

            ##### RA Api
            (r"/api/ra/rd/password/?", SetPassword),
            (r"/api/ra/rd/([^/]+)/?", RDSession),
            (r"/ws/ra/status/?", RDStatusQueue),

            ##### Email API Handlers
            (r"/api/email/config/create?", CreateEmailConfigHandler),
            (r"/api/email/config/list?", GetEmailConfigHandler),

            ##### Logger API Handlers
            (r"/api/logger/modifyLogging?", LoggingModifyerHandler),
            (r"/api/logger/getParams?", LoggingListerHandler),

            ##### Scheduler API Handlers
            (r"/api/v1/schedules?", ScheduleListerHandler),
            (r"/api/v1/schedule/([A-Za-z0-9_ ]+.*)?", ScheduleAppDetailHandler),
            (r"/api/v1/schedules/recurrent/none?", SchedulerDateBasedJobHandler),
            (r"/api/v1/schedules/recurrent/daily?", SchedulerDailyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/monthly?", SchedulerMonthlyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/yearly?", SchedulerYearlyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/weekly?", SchedulerWeeklyRecurrentJobHandler),
            (r"/api/v1/schedules/recurrent/custom?", SchedulerCustomRecurrentJobHandler),
            
            ##### Reports Api
            (r"/api/v1/reports/osdetails?", AgentsOsDetailsHandler),
            (r"/api/v1/reports/hardwaredetails?",AgentsHardwareDetailsHandler),
            (r"/api/v1/reports/cpudetails?",AgentsCPUDetailsHandler),
            (r"/api/v1/reports/memorydetails?",AgentsMemoryDetailsHandler),
            (r"/api/v1/reports/diskdetails?",AgentsDiskDetailsHandler),
            (r"/api/v1/reports/networkdetails?",AgentsNetworkDetailsHandler),


            ##### Agent API Handlers
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?", AgentHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/bar/severity?",AgentSeverityHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/column/range/apps/os?", AgentOsAppsOverTimeHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/tag?", TagsAgentHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/os?", AgentIdOsAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/remediationvault?", AgentIdAgentAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/custom?", AgentIdCustomAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/supported?", AgentIdSupportedAppsHandler),
            (r"/api/v1/agent/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/operations?", AgentOperationsHandler),

            ##### Agents API Handlers
            (r"/api/v1/agents", AgentsHandler),

            ##### Tag API Handlers
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?", TagHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/bar/severity?",TagSeverityHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/column/range/apps/os?", TagOsAppsOverTimeHandler),
            #(r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/graphs/linear/severity?",TagPackageSeverityOverTimeHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/os?", TagIdOsAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/remediationvault?", TagIdAgentAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/supported?", TagIdSupportedAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/apps/custom?", TagIdCustomAppsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/operations?", TagOperationsHandler),
            (r"/api/v1/tag/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/stats_by_os?", TagStatsByOsHandler),

            ##### Tags API Handlers
            (r"/api/v1/tags", TagsHandler),

            ##### FileData API Handlers
            (r'/api/v1/apps/info?', FileInfoHandler),

            ##### MightyMouse API Handlers
            (r'/api/v1/relay/([A-Za-z0-9:,"_ ]+.*)?', RelayServerHandler),
            (r"/api/v1/relay", RelayServersHandler),

            ##### Os Apps API Handlers
            (r"/api/v1/app/os/([0-9A-Za-z]{64})?", AppIdOsAppsHandler),
            (r"/api/v1/app/os/([0-9A-Za-z]{64})/agents?", GetAgentsByAppIdHandler),
            (r"/api/v1/apps/os", OsAppsHandler),

            ##### Custom Apps API Handlers
            (r"/api/v1/app/custom/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?", AppIdCustomAppsHandler),
            (r"/api/v1/app/custom/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})/agents?", GetAgentsByCustomAppIdHandler),
            (r"/api/v1/apps/custom?", CustomAppsHandler),

            (r"/api/v1/apps/custom/upload/finalize?", ThirdPartyPackageUploadHandler),
            (r"/api/v1/apps/custom/upload/data?",ThirdPartyUploadHandler),
            (r"/upload/package?",ThirdPartyPackageUploadHandler),
            (r"/api/v1/apps/custom/upload/uuid?", GetThirdPartyUuidHandler),

            ##### Supported Apps API Handlers
            (r"/api/v1/app/supported/([0-9A-Za-z]{64})?", AppIdSupportedAppsHandler),
            (r"/api/v1/app/supported/([0-9A-Za-z]{64})/agents?", GetAgentsBySupportedAppIdHandler),
            (r"/api/v1/apps/supported?", SupportedAppsHandler),

            ##### Agent Apps API Handlers
            (r"/api/v1/app/remediationvault/([0-9A-Za-z]{64})?", AppIdAgentAppsHandler),
            (r"/api/v1/app/remediationvault/([0-9A-Za-z]{64})/agents?", GetAgentsByAgentAppIdHandler),
            (r"/api/v1/apps/remediationvault?", AgentAppsHandler),

            ##### Dashboard API Handlers
            (r"/api/v1/dashboard/graphs/bar/severity?",CustomerSeverityHandler),
            #(r"/api/v1/dashboard/graphs/linear/severity?",PackageSeverityOverTimeHandler),
            (r"/api/v1/dashboard/graphs/bar/stats_by_os?", CustomerStatsByOsHandler),
            (r"/api/v1/dashboard/graphs/column/range/apps/os?", OsAppsOverTimeHandler),
            (r"/api/v1/dashboard/widgets/unique_count?", WidgetHandler),
            (r"/api/v1/dashboard/widgets/top_needed?", TopAppsNeededHandler),
            (r"/api/v1/dashboard/widgets/recently_released?", RecentlyReleasedHandler),

            ##### Operations API Handlers
            (r"/api/v1/operations?", GetTransactionsHandler),
            (r"/api/v1/operation/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12})?", OperationHandler),

            ##### Generic API Handlers
            (r"/api/v1/supported/operating_systems?", FetchSupportedOperatingSystems),
            (r"/api/v1/supported/production_levels?", FetchValidProductionLevels),
            #(r"/api/package/getDependecies?", GetDependenciesHandler),

            ##### File system access whitelist
            (r"/css/(.*?)", tornado.web.StaticFileHandler,
                {"path": "wwwstatic/css"}),
            (r"/font/(.*?)", tornado.web.StaticFileHandler,
                {"path": "wwwstatic/font"}),
            (r"/img/(.*?)", tornado.web.StaticFileHandler,
                {"path": "wwwstatic/img"}),
            (r"/js/(.*?)", tornado.web.StaticFileHandler,
                {"path": "wwwstatic/js"}),
            (r"/packages/*/(.*?)", tornado.web.StaticFileHandler,
                {"path": "/opt/TopPatch/var/packages"})
        ]

        template_path = "/opt/TopPatch/tp/templates"
        settings = {
            "cookie_secret": base64.b64encode(uuid.uuid4().bytes +
                                              uuid.uuid4().bytes),
            "login_url": "/login",
        }
        self.scheduler = start_scheduler()
        initialize_indexes_and_create_tables()
        hierarchy_db.init()

        tornado.web.Application.__init__(self, handlers,
                                         template_path=template_path,
                                         debug=debug, **settings)
Esempio n. 3
0
from scheduler.jobManager import start_scheduler, job_exists, remove_job
from plugins.patching.supported_apps.syncer import get_agents_apps, get_supported_apps
from plugins.cve.cve_parser import parse_cve_and_udpatedb
from plugins.cve.bulletin_parser import parse_bulletin_and_updatedb
from plugins.cve.get_all_ubuntu_usns import begin_usn_home_page_processing

from agent.agent_uptime_verifier import all_agent_status

logging.config.fileConfig('/opt/TopPatch/conf/logging.config')
logger = logging.getLogger('rvapi')
get_supported_apps()
get_agents_apps()

if __name__ == '__main__':
   
    sched = start_scheduler(redis_db=11) 
    jobstore_name = 'patching'
    username='******'
    list_of_cron_jobs = [
        {
            'name': 'get_supported_apps',
            'job': get_supported_apps,
            'hour': '0,6,12,18',
            'minute': 0,
            'max_instances': 1,
            'coalesce': True
        },
        {
            'name': 'get_agents_apps',
            'jobstore': jobstore_name,
            'job': get_agents_apps,