1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Change default config settings

This commit is contained in:
grossmj 2021-12-17 12:26:02 +10:30
parent c5a6cd8d33
commit d1d36ce254
3 changed files with 23 additions and 24 deletions

View File

@ -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] [Server]
; What protocol the server uses (http or https) ; 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 executable location, default: search in PATH
;ubridge_path = ubridge ;ubridge_path = ubridge
; Option to enable HTTP authentication. ; Username for compute HTTP authentication.
enable_http_auth = False compute_username = gns3
; Username for HTTP authentication. ; Password for compute HTTP authentication.
user = gns3 compute_password = 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"
; Only allow these interfaces to be used by GNS3, for the Cloud node for example (Linux/OSX only) ; 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 ; 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 is virbr0 on Linux (requires libvirt) and vmnet8 for other platforms (requires VMware)
default_nat_interface = vmnet10 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]
; VPCS executable location, default: search in PATH ; VPCS executable location, default: search in PATH
;vpcs_path = vpcs ;vpcs_path = vpcs

View File

@ -56,8 +56,8 @@ class User(BaseTable):
def create_default_super_admin(target, connection, **kw): def create_default_super_admin(target, connection, **kw):
config = Config.instance().settings config = Config.instance().settings
default_admin_username = config.Server.default_admin_username default_admin_username = config.Controller.default_admin_username
default_admin_password = config.Server.default_admin_password.get_secret_value() default_admin_password = config.Controller.default_admin_password.get_secret_value()
hashed_password = auth_service.hash_password(default_admin_password) hashed_password = auth_service.hash_password(default_admin_password)
stmt = target.insert().values( stmt = target.insert().values(
username=default_admin_username, username=default_admin_username,

View File

@ -24,6 +24,8 @@ class ControllerSettings(BaseModel):
jwt_secret_key: str = None jwt_secret_key: str = None
jwt_algorithm: str = "HS256" jwt_algorithm: str = "HS256"
jwt_access_token_expire_minutes: int = 1440 # 24 hours jwt_access_token_expire_minutes: int = 1440 # 24 hours
default_admin_username: str = "admin"
default_admin_password: SecretStr = SecretStr("admin")
class Config: class Config:
validate_assignment = True validate_assignment = True
@ -133,8 +135,6 @@ class ServerSettings(BaseModel):
ubridge_path: str = "ubridge" ubridge_path: str = "ubridge"
compute_username: str = "admin" compute_username: str = "admin"
compute_password: SecretStr = SecretStr("") compute_password: SecretStr = SecretStr("")
default_admin_username: str = "admin"
default_admin_password: SecretStr = SecretStr("admin")
allowed_interfaces: List[str] = Field(default_factory=list) allowed_interfaces: List[str] = Field(default_factory=list)
default_nat_interface: str = None default_nat_interface: str = None
allow_remote_console: bool = False allow_remote_console: bool = False