From 9b6b48a7f12bd8173f9090d8755028a017f01a2a Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 6 Aug 2024 19:32:53 +0800 Subject: [PATCH] perf: support only su or sudo --- apps/assets/const/host.py | 2 +- apps/assets/serializers/platform.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/assets/const/host.py b/apps/assets/const/host.py index be8f1d1bf..46bca9c9e 100644 --- a/apps/assets/const/host.py +++ b/apps/assets/const/host.py @@ -19,7 +19,7 @@ class HostTypes(BaseType): 'charset': 'utf-8', # default 'domain_enabled': True, 'su_enabled': True, - 'su_methods': ['sudo', 'su'], + 'su_methods': ['sudo', 'su', 'only_sudo', 'only_su'], }, cls.WINDOWS: { 'su_enabled': False, diff --git a/apps/assets/serializers/platform.py b/apps/assets/serializers/platform.py index 4fb0418c6..93c0e54dd 100644 --- a/apps/assets/serializers/platform.py +++ b/apps/assets/serializers/platform.py @@ -127,6 +127,8 @@ class PlatformSerializer(ResourceLabelsMixin, WritableNestedModelSerializer): SU_METHOD_CHOICES = [ ("sudo", "sudo su -"), ("su", "su - "), + ("only_sudo", "sudo su"), + ("only_su", "su"), ("enable", "enable"), ("super", "super 15"), ("super_level", "super level 15")