You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/assets/const/host.py

107 lines
3.1 KiB

from .base import BaseType
class HostTypes(BaseType):
LINUX = 'linux', 'Linux'
WINDOWS = 'windows', 'Windows'
UNIX = 'unix', 'Unix'
OTHER_HOST = 'other', "Other"
@classmethod
def _get_base_constrains(cls) -> dict:
return {
'*': {
'charset_enabled': True,
'charset': 'utf-8', # default
'domain_enabled': True,
'su_enabled': True,
'su_methods': [
{'name': 'sudo su', 'id': 'sudo su'},
{'name': 'su -', 'id': 'su -'}
],
},
cls.WINDOWS: {
'su_enabled': False,
},
cls.OTHER_HOST: {
'su_enabled': False,
}
}
@classmethod
def _get_protocol_constrains(cls) -> dict:
return {
'*': {
'choices': ['ssh', 'telnet', 'vnc', 'rdp']
},
cls.WINDOWS: {
'choices': ['rdp', 'ssh', 'vnc']
}
}
@classmethod
def _get_automation_constrains(cls) -> dict:
return {
'*': {
'ansible_enabled': True,
'ansible_config': {
'ansible_connection': 'smart',
},
'ping_enabled': True,
'gather_facts_enabled': True,
'gather_accounts_enabled': True,
'verify_account_enabled': True,
'change_secret_enabled': True,
'push_account_enabled': True,
},
cls.WINDOWS: {
'ansible_config': {
'ansible_shell_type': 'cmd',
'ansible_connection': 'ssh',
},
},
}
@classmethod
def internal_platforms(cls):
return {
cls.LINUX: [
{'name': 'Linux'},
{'name': 'Gateway'}
],
cls.UNIX: [
{'name': 'Unix'},
{'name': 'macOS'},
{'name': 'BSD'},
{'name': 'AIX', 'automation': {
'push_account_method': 'push_account_aix',
'change_secret_method': 'push_secret_aix'
}}
],
cls.WINDOWS: [
{'name': 'Windows'},
{
'name': 'Windows-TLS',
'protocols_setting': {
'rdp': {'security': 'tls'},
}
},
{
'name': 'Windows-RDP',
'protocols_setting': {
'rdp': {'security': 'rdp'},
}
},
{
'name': 'RemoteAppHost',
'_protocols': ['rdp', 'ssh'],
'protocols_setting': {
'ssh': {
'required': True
}
}
}
],
cls.OTHER_HOST: []
}