Skip to content

Commit

Permalink
Update font xnb, some solution cleanup.
Browse files Browse the repository at this point in the history
Readme for server is now in FSO.Server.Core.
  • Loading branch information
riperiperi committed Jun 13, 2020
1 parent 2ef694a commit 6862a4d
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 6,807 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Volcanic is an extension of FreeSO that allows users to view, modify and save ga
You can contribute to FreeSO by testing cutting edge features in the latest releases, filing bugs, and joining in the discussion on our forums!

* [Getting Started](https://github.com/riperiperi/FreeSO/wiki)
* [Project Structure](https://github.com/riperiperi/FreeSO/wiki/Project-structure)
* [Coding Standards](https://github.com/riperiperi/FreeSO/wiki/Coding-standards)
* [Pull Requests](https://github.com/riperiperi/FreeSO/pulls): [Open](https://github.com/riperiperi/FreeSO/pulls)/[Closed](https://github.com/riperiperi/FreeSO/issues?q=is%3Apr+is%3Aclosed)
* [Translation](http://forum.freeso.org/forums/translations.32/)
Expand All @@ -40,12 +41,11 @@ You can contribute to FreeSO by testing cutting edge features in the latest rele

Looking for something to do? Check out the issues tagged as [help wanted](https://github.com/riperiperi/FreeSO/labels/help%20wanted) to get started.

Regarding translations, full object and UI translations should currently be released on the forums. An improved system for distribution and organisation will be set up in a month or two. Stay tuned!
Regarding translations, full object and UI translations should currently be released on the forums. This is far from perfect and is due to be reworked. Stay tuned!

## Prerequisites
* [Visual Studio 2015](https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx)
* [Visual Studio 2019](https://visualstudio.microsoft.com/vs/)
* [MonoGame](http://www.monogame.net): 3.5 for the iOS and Android VS2015 project types. (optional)
* [Xamarin for Visual Studio](https://www.xamarin.com/visual-studio): For iOS and Android builds. (optional)

# License
> This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
Expand Down
144 changes: 144 additions & 0 deletions TSOClient/FSO.Server.Core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Getting started #
## Prerequisites ##
1. MySQL database server (preferrably MariaDB)
2. .NET Core 2.2 SDK or Runtime

## Configure database ##
Create a database within your MySQL server. You can use an existing database (tables are namespaced) but making a new one is recommended.

CREATE DATABASE `fso`

Create a user on the database server with full access to the new database. Make sure you change the password for a production system.

CREATE USER 'fsoserver'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON fso.* TO 'fsoserver'@'localhost';

Setup config.json to connect to the new database. It should look something like this (with your updated password).

{
"database": {
"connectionString": "server=127.0.0.1;uid=fsoserver;pwd=password;database=fso;"
}
}

Finally, install the fso tables and database scripts. There is a tool built into the server that automates this process. Never do this manually unless you know what you are doing. Run the following command:

dotnet exec FSO.Server.Core.dll db-init

The tool will show you the differences between your database and the expected structure. Press Y to install all the tables and scripts.

You can use this tool to update your database as new features are added. It will only apply the changes. In these cases you should backup your database first.

The server itself can be run with the following command

dotnet exec FSO.Server.Core.dll run

Note that there are a few other useful tools in there, such as import-nhood and restore-lots. You can find more information on these on the wiki.

## Configure api ##
The API is a http web server which provides the following services:

1. Authentication - Consistent with Maxis protocol
2. Shard (city) selection - Consistent with Maxis protocol
3. User registration
4. System administration

This API can be used with fso and with the original tso game (with host file entries and after trusting a self signed CA).

### SSL configuration for the server (currently disabled) ###
Ingame communications are currently done entirely in plaintext, so the following information is outdated. The game server will run correctly with However, if you would like to revive the SSL mode, you should use the below information to help set it all up.

Note that this does *NOT* mean that you should run the API server on plain HTTP - the current recommended method is to use a nginx or IIS reverse proxy with letsencrypt, which is the easiest way to

#### SSL with self signed certificates (Windows) ####
This approach is the easiest for development and has a side benefit of allowing the original TSO game client to connect to this API (with host file entries). NOTE: This wont work for other people unless they install your certificates into their trust stores.

First you will need to make sure you have the makecert command. It is available in the Visual Studio command prompt.

Next you need to create a self signed certificate authority cert. Below is an example command you can run:

makecert -r -pe -n "CN=My Root Authority" -ss CA -sr CurrentUser -a sha1 -sky signature -cy authority -sv CA.pvk CA.cer

This should produce two files, CA.cer and CA.pvk.

Next, you need to issue the certificate itself. For compatibility with the original TSO game use a CN value of auth.east.ea.com.

makecert -pe -n "CN=auth.east.ea.com" -a sha1 -sky Exchange ^
-eku 1.3.6.1.5.5.7.3.1 -ic CA.cer -iv CA.pvk ^
-sp "Microsoft RSA SChannel Cryptographic Provider" ^
-sy 12 -sv auth.east.ea.com.pvk auth.east.ea.com.cer

Convert the certificate into a pfx file.

pvk2pfx -pvk auth.east.ea.com.pvk -spc auth.east.ea.com.cer -pfx auth.east.ea.com.pfx

Install the CA.cer into your trusted root certificate authorities.

1. Double click on CA.cer
2. Click Install certificate
3. Click Next
4. Choose "Place all certificates in the following store". Browse and select "Trusted Root Certificate Authorities".

Install auth.east.ea.com.pfx onto your PC

1. Run mmc.exe
2. Go to File => Add / Remove snap in. Add the Certificates snap in choosing Computer Account.
3. Navigate to Personal / Certificates.
4. Right click on the Certificates folder in the tree and run All Tasks => Import.
5. Follow the wizard to import your pfx file (it may not have a password).

Configure windows to use this certificate on port 443 for fso server.

1. Get the thumbprint of the certificate you just generated. Instructions can be found [here](https://msdn.microsoft.com/en-us/library/ms734695(v=vs.110).aspx). When you copy the value paste ti into notepad, press home and press delete twice and reenter the first character. The certificate GUI tool adds non-printable characters which break the next step.
2. Run the command below, replacing the certhash with your hash. The app id refers to the Assembly id found in AssemblyInfo.cs in FSO.server. You do not need to change this.

Example command:

netsh http add sslcert ipport=0.0.0.0:443 certhash=c28d66a5d109e9a44afe47cd3d529d9a87ee7a75 appid={8f125201-fdf0-4a13-886f-19662707d34d}

You should now be able to update your config.json so the API has the following bindings:

"bindings": ["https://*:443/"],

Finally, add a host file entry for auth.east.ea.com pointing to 127.0.0.1.

#### SSL with real certificates (Windows) ####
Install your certificate into the computer's personal certificates.

1. Run mmc.exe
2. Go to File => Add / Remove snap in. Add the Certificates snap in choosing Computer Account.
3. Navigate to Personal / Certificates.
4. Right click on the Certificates folder in the tree and run All Tasks => Import.
5. Follow the wizard to import your pfx file (it may not have a password).

Configure windows to use this certificate on port 443 for fso server.

1. Get the thumbprint of the certificate you just generated. Instructions can be found [here](https://msdn.microsoft.com/en-us/library/ms734695(v=vs.110).aspx). When you copy the value paste it into notepad, press home and press delete twice and reenter the first character. The certificate GUI tool adds non-printable characters which break the next step.
2. Run the command below, replacing the certhash with your hash. The app id refers to the Assembly id found in AssemblyInfo.cs in FSO.server. You do not need to change this.

Example command:

netsh http add sslcert ipport=0.0.0.0:443 certhash=c28d66a5d109e9a44afe47cd3d529d9a87ee7a75 appid={8f125201-fdf0-4a13-886f-19662707d34d}

You should now be able to update your config.json so the API has the following bindings:

"bindings": ["https://*:443/"],


If you want to use this setup with the original TSO game you will need to update the config files within TSO to repoint them.

Update TSOClient\sys\gameentry.ini so that Server=yourserver.com

Also update TSOClient\sys\cityselector.ini so that ServerName = yourserver.com

#### SSL with letsencrypt.org ####
TODO

### HTTP only ###
Running in a HTTP only mode as your main endpoint is strongly discouraged. However there are circumstances where this is valid and thus it is a supported option.

Specifically, you can put another tool such as NGINX, IIS or an Amazon Load Balancer in front of the API to handle SSL. In these cases the tool in front would provide SSL and make HTTP requests to the API. For the first two, there are many methods to set up free letsencrypt certificates with periodic renewals.

For this configuration, set the API bindings to something like this:

"bindings": ["http://*:8080/"],
5 changes: 4 additions & 1 deletion TSOClient/FSO.Server/FSO.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8F125201-FDF0-4A13-886F-19662707D34D}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FSO.Server</RootNamespace>
<AssemblyName>server</AssemblyName>
Expand Down Expand Up @@ -66,6 +66,9 @@
<PropertyGroup>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
Expand Down
134 changes: 3 additions & 131 deletions TSOClient/FSO.Server/README.md
Original file line number Diff line number Diff line change
@@ -1,133 +1,5 @@
# Getting started #
## Prerequisites ##
1. MySQL database server
2. .NET or Mono runtime
# Migration Note #

## Configure database ##
Create a database within your MySQL server. You can use an existing database (tables are namespaced) but making a new one is recommended.
Please see FSO.Server.Core for the full information on how to run the server.

CREATE DATABASE `fso`

Create a user on the database server with full access to the new database. Make sure you change the password for a production system.

CREATE USER 'fsoserver'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON fso.* TO 'fsoserver'@'localhost';

Setup config.json to connect to the new database. It should look something like this (with your updated password).

{
"database": {
"connectionString": "server=127.0.0.1;uid=fsoserver;pwd=password;database=fso;"
}
}

Finally, install the fso tables and database scripts. There is a tool built into the server that automates this process. Never do this manually unless you know what you are doing. Run the following command:

server.exe db-init

The tool will show you the differences between your database and the expected structure. Press Y to install all the tables and scripts.

You can use this tool to update your database as new features are added. It will only apply the changes. In these cases you should backup your database first.

## Configure api ##
The API is a http web server which provides the following services:

1. Authentication - Consistent with Maxis protocol
2. Shard (city) selection - Consistent with Maxis protocol
3. User registration
4. System administration

This API can be used with fso and with the original tso game (with host file entries and after trusting a self signed CA).

### SSL with self signed certificates (Windows) ###
This approach is the easiest for development and has a side benefit of allowing the original TSO game client to connect to this API (with host file entries). NOTE: This wont work for other people unless they install your certificates into their trust stores.

First you will need to make sure you have the makecert command. It is available in the Visual Studio command prompt.

Next you need to create a self signed certificate authority cert. Below is an example command you can run:

makecert -r -pe -n "CN=My Root Authority" -ss CA -sr CurrentUser -a sha1 -sky signature -cy authority -sv CA.pvk CA.cer

This should produce two files, CA.cer and CA.pvk.

Next, you need to issue the certificate itself. For compatibility with the original TSO game use a CN value of auth.east.ea.com.

makecert -pe -n "CN=auth.east.ea.com" -a sha1 -sky Exchange ^
-eku 1.3.6.1.5.5.7.3.1 -ic CA.cer -iv CA.pvk ^
-sp "Microsoft RSA SChannel Cryptographic Provider" ^
-sy 12 -sv auth.east.ea.com.pvk auth.east.ea.com.cer

Convert the certificate into a pfx file.

pvk2pfx -pvk auth.east.ea.com.pvk -spc auth.east.ea.com.cer -pfx auth.east.ea.com.pfx

Install the CA.cer into your trusted root certificate authorities.

1. Double click on CA.cer
2. Click Install certificate
3. Click Next
4. Choose "Place all certificates in the following store". Browse and select "Trusted Root Certificate Authorities".

Install auth.east.ea.com.pfx onto your PC

1. Run mmc.exe
2. Go to File => Add / Remove snap in. Add the Certificates snap in choosing Computer Account.
3. Navigate to Personal / Certificates.
4. Right click on the Certificates folder in the tree and run All Tasks => Import.
5. Follow the wizard to import your pfx file (it may not have a password).

Configure windows to use this certificate on port 443 for fso server.

1. Get the thumbprint of the certificate you just generated. Instructions can be found [here](https://msdn.microsoft.com/en-us/library/ms734695(v=vs.110).aspx). When you copy the value paste ti into notepad, press home and press delete twice and reenter the first character. The certificate GUI tool adds non-printable characters which break the next step.
2. Run the command below, replacing the certhash with your hash. The app id refers to the Assembly id found in AssemblyInfo.cs in FSO.server. You do not need to change this.

Example command:

netsh http add sslcert ipport=0.0.0.0:443 certhash=c28d66a5d109e9a44afe47cd3d529d9a87ee7a75 appid={8f125201-fdf0-4a13-886f-19662707d34d}

You should now be able to update your config.json so the API has the following bindings:

"bindings": ["https://*:443/"],

Finally, add a host file entry for auth.east.ea.com pointing to 127.0.0.1.

### SSL with real certificates (Windows) ###
Install your certificate into the computer's personal certificates.

1. Run mmc.exe
2. Go to File => Add / Remove snap in. Add the Certificates snap in choosing Computer Account.
3. Navigate to Personal / Certificates.
4. Right click on the Certificates folder in the tree and run All Tasks => Import.
5. Follow the wizard to import your pfx file (it may not have a password).

Configure windows to use this certificate on port 443 for fso server.

1. Get the thumbprint of the certificate you just generated. Instructions can be found [here](https://msdn.microsoft.com/en-us/library/ms734695(v=vs.110).aspx). When you copy the value paste ti into notepad, press home and press delete twice and reenter the first character. The certificate GUI tool adds non-printable characters which break the next step.
2. Run the command below, replacing the certhash with your hash. The app id refers to the Assembly id found in AssemblyInfo.cs in FSO.server. You do not need to change this.

Example command:

netsh http add sslcert ipport=0.0.0.0:443 certhash=c28d66a5d109e9a44afe47cd3d529d9a87ee7a75 appid={8f125201-fdf0-4a13-886f-19662707d34d}

You should now be able to update your config.json so the API has the following bindings:

"bindings": ["https://*:443/"],


If you want to use this setup with the original TSO game you will need to update the config files within TSO to repoint them.

Update TSOClient\sys\gameentry.ini so that Server=yourserver.com

Also update TSOClient\sys\cityselector.ini so that ServerName = yourserver.com

### SSL with letsencrypt.org ###
The service is not live yet. However, when it is live this will be the easiest way for people to setup their servers.

### HTTP only ###
Running in a HTTP only mode is strongly discouraged. However there are circumstances where this is valid and thus it is a supported option.

Specifically, you can put another tool such as NGINX or an Amazon Load Balancer in front of the API to handle SSL. In these cases the tool in front would provide SSL and make HTTP requests to the API.

For this configuration, set the API bindings to something like this:

"bindings": ["http://*:8080/"],
The server software is currently being migrated to run on .NET Core. Due to framework version restrictions (and target OS support), most projects are still in .NET framework, including the majority of the server. In future, shared projects will use .NET Standard and will be easily shared between the .NET Framework client project and .NET Core server, but that day is not today.
1 change: 1 addition & 0 deletions TSOClient/FSOFacadeWorker/FacadeConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class FacadeConfig
public string Api_Url;
public string User;
public string Password;
public string Game_Path;
public int Limit = 2000;
public int Sleep_Time = 30000;
}
Expand Down
2 changes: 1 addition & 1 deletion TSOClient/FSOFacadeWorker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static void Main(string[] args)
GameThread.NoGame = true;
GameThread.UpdateExecuting = true;

var path = gameLocator.FindTheSimsOnline();
var path = Config.Game_Path ?? gameLocator.FindTheSimsOnline();

if (path != null)
{
Expand Down
Loading

0 comments on commit 6862a4d

Please sign in to comment.