diff --git a/conf/gns3_server.conf b/conf/gns3_server.conf index a5864c5a5..c260ba6cc 100644 --- a/conf/gns3_server.conf +++ b/conf/gns3_server.conf @@ -1,3 +1,18 @@ +[Controller] + +; Options for JWT tokens (user authentication) +jwt_secret_key = efd08eccec3bd0a1be2e086670e5efa90969c68d07e072d7354a76cea5e33d4e +jwt_algorithm = HS256 +jwt_access_token_expire_minutes = 1440 + +; Initial default super admin username +; It cannot be changed once the controller has started once +default_admin_username = admin + +; Initial default super admin password +; It cannot be changed once the controller has started once +default_admin_password = admin + [Server] ; What protocol the server uses (http or https) @@ -57,20 +72,10 @@ udp_end_port_range = 30000 ; uBridge executable location, default: search in PATH ;ubridge_path = ubridge -; Option to enable HTTP authentication. -enable_http_auth = False -; Username for HTTP authentication. -user = gns3 -; Password for HTTP authentication. -password = gns3 - -; Initial default super admin username -; It cannot be changed once the server has started once -default_admin_username = "admin" - -; Initial default super admin password -; It cannot be changed once the server has started once -default_admin_password = "admin" +; Username for compute HTTP authentication. +compute_username = gns3 +; Password for compute HTTP authentication. +compute_password = gns3 ; Only allow these interfaces to be used by GNS3, for the Cloud node for example (Linux/OSX only) ; Do not forget to allow virbr0 in order for the NAT node to work @@ -80,12 +85,6 @@ allowed_interfaces = eth0,eth1,virbr0 ; Default is virbr0 on Linux (requires libvirt) and vmnet8 for other platforms (requires VMware) default_nat_interface = vmnet10 -[Controller] -; Options for JWT tokens (user authentication) -jwt_secret_key = efd08eccec3bd0a1be2e086670e5efa90969c68d07e072d7354a76cea5e33d4e -jwt_algorithm = HS256 -jwt_access_token_expire_minutes = 1440 - [VPCS] ; VPCS executable location, default: search in PATH ;vpcs_path = vpcs diff --git a/gns3server/db/models/users.py b/gns3server/db/models/users.py index e6bc53f4b..0c85ccbeb 100644 --- a/gns3server/db/models/users.py +++ b/gns3server/db/models/users.py @@ -56,8 +56,8 @@ class User(BaseTable): def create_default_super_admin(target, connection, **kw): config = Config.instance().settings - default_admin_username = config.Server.default_admin_username - default_admin_password = config.Server.default_admin_password.get_secret_value() + default_admin_username = config.Controller.default_admin_username + default_admin_password = config.Controller.default_admin_password.get_secret_value() hashed_password = auth_service.hash_password(default_admin_password) stmt = target.insert().values( username=default_admin_username, diff --git a/gns3server/schemas/config.py b/gns3server/schemas/config.py index cbcf12752..759af0bc4 100644 --- a/gns3server/schemas/config.py +++ b/gns3server/schemas/config.py @@ -24,6 +24,8 @@ class ControllerSettings(BaseModel): jwt_secret_key: str = None jwt_algorithm: str = "HS256" jwt_access_token_expire_minutes: int = 1440 # 24 hours + default_admin_username: str = "admin" + default_admin_password: SecretStr = SecretStr("admin") class Config: validate_assignment = True @@ -133,8 +135,6 @@ class ServerSettings(BaseModel): ubridge_path: str = "ubridge" compute_username: str = "admin" compute_password: SecretStr = SecretStr("") - default_admin_username: str = "admin" - default_admin_password: SecretStr = SecretStr("admin") allowed_interfaces: List[str] = Field(default_factory=list) default_nat_interface: str = None allow_remote_console: bool = False