2022-09-07 11:49:42 +00:00
|
|
|
from django.db import models
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
|
|
|
|
|
|
class StrategyChoice(models.TextChoices):
|
|
|
|
push = 'push', _('Push')
|
|
|
|
verify = 'verify', _('Verify')
|
|
|
|
collect = 'collect', _('Collect')
|
2022-10-13 09:47:29 +00:00
|
|
|
change_secret = 'change_secret', _('Change password')
|
2022-09-07 11:49:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SSHKeyStrategy(models.TextChoices):
|
|
|
|
add = 'add', _('Append SSH KEY')
|
|
|
|
set = 'set', _('Empty and append SSH KEY')
|
|
|
|
set_jms = 'set_jms', _('Replace (The key generated by JumpServer) ')
|
|
|
|
|
|
|
|
|
|
|
|
class PasswordStrategy(models.TextChoices):
|
|
|
|
custom = 'custom', _('Custom password')
|
|
|
|
random_one = 'random_one', _('All assets use the same random password')
|
|
|
|
random_all = 'random_all', _('All assets use different random password')
|
|
|
|
|
|
|
|
|
|
|
|
string_punctuation = '!#$%&()*+,-.:;<=>?@[]^_~'
|
|
|
|
DEFAULT_PASSWORD_LENGTH = 30
|
|
|
|
DEFAULT_PASSWORD_RULES = {
|
|
|
|
'length': DEFAULT_PASSWORD_LENGTH,
|
|
|
|
'symbol_set': string_punctuation
|
|
|
|
}
|
2022-12-19 10:04:11 +00:00
|
|
|
|
|
|
|
|
2023-01-18 10:03:33 +00:00
|
|
|
class CreateMethods(models.TextChoices):
|
|
|
|
blank = 'blank', _('Blank')
|
|
|
|
vcs = 'vcs', _('VCS')
|
|
|
|
|
|
|
|
|
2022-12-19 10:04:11 +00:00
|
|
|
class Types(models.TextChoices):
|
|
|
|
adhoc = 'adhoc', _('Adhoc')
|
|
|
|
playbook = 'playbook', _('Playbook')
|
|
|
|
|
|
|
|
|
|
|
|
class RunasPolicies(models.TextChoices):
|
|
|
|
privileged_only = 'privileged_only', _('Privileged Only')
|
|
|
|
privileged_first = 'privileged_first', _('Privileged First')
|
|
|
|
skip = 'skip', _('Skip')
|
|
|
|
|
|
|
|
|
|
|
|
class Modules(models.TextChoices):
|
|
|
|
shell = 'shell', _('Shell')
|
|
|
|
winshell = 'win_shell', _('Powershell')
|
2022-12-27 08:06:21 +00:00
|
|
|
python = 'python', _('Python')
|
2022-12-19 10:04:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
class JobStatus(models.TextChoices):
|
|
|
|
running = 'running', _('Running')
|
|
|
|
success = 'success', _('Success')
|
2022-12-27 08:06:21 +00:00
|
|
|
timeout = 'timeout', _('Timeout')
|
2022-12-19 10:04:11 +00:00
|
|
|
failed = 'failed', _('Failed')
|
2023-01-16 11:02:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
# celery 日志完成之后,写入的魔法字符,作为结束标记
|
|
|
|
CELERY_LOG_MAGIC_MARK = b'\x00\x00\x00\x00\x00'
|