-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Character migrate/backup/import and Web API #1390
Conversation
…equired for Microsoft.AspNetCore.App, so that fresh restores will work updated database update script filenames
moved landblockStatus endpoint to authenticated section changed ACE.Server startup to only initialize CryptoManager if the WebApi configuration requires it
…l WebApi omission
… one for signing character transfers, and one for WebApi updated documentation added interface and port settings for WebApi added uptime to ServerInfo WebApi resource
add comments to Config.json.example documentation
…the ability to embed comments, Backwards compatible, ACE.Server project pre-build renames Config.json to Config.js when needed, but if that never happens it's still OK and falls back to the old filename. DouglasCrockford.JsMin Nuget package added to ACE.Common project Changed startup batch files to determine what the current directory should be and change to it before starting ACE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of great stuff. Left some notes where I think changes should be made.
I think the config.json -> config.js should be in a separate PR.
Also, if the start_server.bat changes are to be committed, they too should be in a separate PR. These are both very big changes that should be isolated.
Character Backup/Export/Import:[Definitions]Player - Person that exists in real life Backup - Action involving a user storing a local copy of a character [Objectives]
[Facts]A server maintains a private RSA key and distributes their public RSA key.
A server can maintain separate options for import vs export.
[Character Snapshot Format]
[Requirements]
[Backup]
Configured by:
Process:
[Export/Import]
Configured by:
Process inside trust:
Process outside trust (untrust):
Difference between trust and untrust: |
addressing several problems raised in PR
added KeepMigrationsForDays transfer configuration setting
fixed webapi prebuild script webhost fails more gracefully when the webapi key and certificate bundle is unavailable renamed CryptoManager to CertificateManager
TO-DO:
|
Re-cloning ACE because I broke my old one. Copied all of these comments and backed up the branches I want to restore. Closing this. I will open a new one for webapi after the initial commit. |
Authentication:
The Web API uses basic access authentication and to access some of the data resources requires a valid account username and password for the underlying ACEmulator server.
If using CURL then the
-k
option is needed since certificates are self-signed. For authenticated resources CURL needs-u myusername:mypassword
.If a resource is marked Anonymous then authorization isn't needed. If you attempt to access a resource that isn't marked Anonymous without supplying valid credentials then you will get a
401 Unauthorized
response.Authenticated requests assume the accesslevel of the account authenticated as a series of claims.
If a resource is marked
Requires: [Admin]
, that means unless your account includes theAdmin
claim then you won't be able to access the resource and you will get a403 Forbidden
response.If a resource is marked
RequiresAny: [Admin,Advocate,Developer,Envoy,Player,Sentinel]
then unless your authenticated account claims at least one of the required claims you won't be able to access the resource and you will get a403 Forbidden
response.Web API
documentation
The Web API server listens at the base ACE port + 2, TCP, TLS, HTTPS, JSON, REST, depends on CryptoManager within ACE.Server project that Generates and saves self-signed certificates when it can't find them. One for WebApi, and one for signing character transfers, in
C:\Users\<user>\AppData\Roaming\ACEmulator_<WorldName>\Certificates
on Windows or/home/<user>/.config/ACEmulator_<WorldName>/Certificates
on Linux. Place or replace webapi.pfx with a "valid" web server certificate if needed. Self-Hosting using NancyFX/OWIN/Kestrel in its own project that depends on and wraps around ACE.Server. WebSockets is a future possibility. To run ACE with web API capability start the batch file:\Source\ACE.Server.WebApi\bin\x64\Debug\netcoreapp2.1\start_server+webapi.bat
To enable and run ACEmulator with WebAPI:
start_server+webapi.bat
in the output folder, which should be located somewhere like:\Source\ACE.WebApiServer\bin\x64\Debug\netcoreapp2.1
A postman collection is included in the source:
WebApi.postman_collection.json
- just import that into postman for a working test suite.Warning
If the world name in the server configuration is changed then the current transfers and certificate are lost unless the files are moved to the new location. To mitigate this move or copy the contents of
C:\Users\<user>\AppData\Roaming\ACEmulator_<OldWorldName>\
toC:\Users\<user>\AppData\Roaming\ACEmulator_<NewWorldName>\
replacing<user>
with the applicable username, and<OldWorldName>
and<NewWorldName>
with applicable names. For linux the path will usually be:/home/<user>/.config/ACEmulator_<WorldName>/
. If your world name contains special characters then the folder names will have them stripped out, allowed world name to folder name characters are:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
.Migrations:
Note: Allowing migrations from itself enables cross account transfers and character renaming.
Backups:
Via Web API, a request is made to backup a character.
Character snapshot is packaged and returned in the response to the requester.
Imports:
with imports enabled the exploitation flood gates are essentially open
requester makes a request to the target server API including in the request the snapshot package encoded in base64 and the new character name.
target server adds the character to the requester's account.
Recommended settings for flawless contract groups:
allow backup: yes
allow migrate: yes
allow import: no
Limitations:
Disclaimer
The migration feature requires the assumption that all server operators involved are non defectors. A defector is someone in the trust group who does malicious or negligent action of any kind. Providing a system that works for flawless trust groups is easy, but as soon as an attempt is made to eliminate the human element and commission the possibility of defectors the entire system breaks. Manual approval process and/or central "antivirus" server may be something that someone might want to come up with in the future, but that's NOT what this is meant for. As a server operator, DO NOT blame anyone but yourself upon defection(s) when using this system. NOBODY BUT YOURSELF IS LIABLE