mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-09-10 12:25:58 -05:00
Set up the Wii U Chat server
There seems to be a problem with the compatability of the authentication and secure servers.
This commit is contained in:
28
compose.yml
28
compose.yml
@@ -225,6 +225,34 @@ services:
|
||||
networks:
|
||||
internal:
|
||||
|
||||
wiiu-chat-authentication:
|
||||
build: ./repos/wiiu-chat-authentication
|
||||
depends_on:
|
||||
- account
|
||||
- mongodb
|
||||
ports:
|
||||
- 6002:6002/udp
|
||||
env_file:
|
||||
- ./environment/wiiu-chat.env
|
||||
- ./environment/wiiu-chat.local.env
|
||||
dns: 172.20.0.2
|
||||
networks:
|
||||
internal:
|
||||
|
||||
wiiu-chat-secure:
|
||||
build: ./repos/wiiu-chat-secure
|
||||
depends_on:
|
||||
- account
|
||||
- mongodb
|
||||
ports:
|
||||
- 6003:6003/udp
|
||||
env_file:
|
||||
- ./environment/wiiu-chat.env
|
||||
- ./environment/wiiu-chat.local.env
|
||||
dns: 172.20.0.2
|
||||
networks:
|
||||
internal:
|
||||
|
||||
volumes:
|
||||
mitmproxy-pretendo-data:
|
||||
mongodb-database:
|
||||
|
||||
6
environment/wiiu-chat.env
Normal file
6
environment/wiiu-chat.env
Normal file
@@ -0,0 +1,6 @@
|
||||
PN_WIIU_CHAT_MONGO_URI=mongodb://mongodb:27017/pretendo_account?replicaSet=rs
|
||||
PN_WIIU_CHAT_MONGO_DATABASE=pretendo_account
|
||||
PN_WIIU_CHAT_AUTHENTICATION_SERVER_PORT=6002
|
||||
PN_WIIU_CHAT_SECURE_SERVER_PORT=6003
|
||||
PN_WIIU_CHAT_FRIENDS_GRPC_HOST=friends
|
||||
PN_WIIU_CHAT_FRIENDS_GRPC_PORT=5001
|
||||
20
patches/wiiu-chat-authentication/dockerize.patch
Normal file
20
patches/wiiu-chat-authentication/dockerize.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
diff --git c/Dockerfile i/Dockerfile
|
||||
new file mode 100644
|
||||
index 0000000..0f18fe9
|
||||
--- /dev/null
|
||||
+++ i/Dockerfile
|
||||
@@ -0,0 +1,14 @@
|
||||
+FROM golang:alpine AS builder
|
||||
+WORKDIR /build
|
||||
+
|
||||
+COPY go.* ./
|
||||
+RUN go mod download
|
||||
+
|
||||
+COPY . ./
|
||||
+RUN go build -v -o server
|
||||
+
|
||||
+FROM alpine:latest AS runner
|
||||
+WORKDIR /app
|
||||
+
|
||||
+COPY --from=builder /build/server /app/server
|
||||
+CMD ["/app/server"]
|
||||
@@ -0,0 +1,49 @@
|
||||
diff --git i/main.go w/main.go
|
||||
index 97dcb04..7dcb42d 100644
|
||||
--- i/main.go
|
||||
+++ w/main.go
|
||||
@@ -18,7 +18,7 @@ func main() {
|
||||
Minor: 4,
|
||||
Patch: 2,
|
||||
})
|
||||
- nexServer.SetKerberosPassword(os.Getenv("KERBEROS_PASSWORD"))
|
||||
+ nexServer.SetKerberosPassword(os.Getenv("PN_WIIU_CHAT_KERBEROS_PASSWORD"))
|
||||
nexServer.SetAccessKey("e7a47214")
|
||||
|
||||
nexServer.On("Data", func(packet *nex.PacketV1) {
|
||||
@@ -34,8 +34,8 @@ func main() {
|
||||
|
||||
secureStationURL := nex.NewStationURL("")
|
||||
secureStationURL.SetScheme("prudps")
|
||||
- secureStationURL.SetAddress(os.Getenv("SECURE_SERVER_LOCATION"))
|
||||
- secureStationURL.SetPort(os.Getenv("SECURE_SERVER_PORT"))
|
||||
+ secureStationURL.SetAddress(os.Getenv("PN_WIIU_CHAT_SECURE_SERVER_LOCATION"))
|
||||
+ secureStationURL.SetPort(os.Getenv("PN_WIIU_CHAT_SECURE_SERVER_PORT"))
|
||||
secureStationURL.SetCID("1")
|
||||
secureStationURL.SetPID("2")
|
||||
secureStationURL.SetSID("1")
|
||||
@@ -46,5 +46,5 @@ func main() {
|
||||
authenticationProtocol.SetBuildName("Pretendo WiiU Chat Auth")
|
||||
authenticationProtocol.SetPasswordFromPIDFunction(passwordFromPID)
|
||||
|
||||
- nexServer.Listen(":60004")
|
||||
+ nexServer.Listen(":" + os.Getenv("PN_WIIU_CHAT_AUTHENTICATION_SERVER_PORT"))
|
||||
}
|
||||
diff --git i/database.go w/database.go
|
||||
index abae4c2..05f1527 100644
|
||||
--- i/database.go
|
||||
+++ w/database.go
|
||||
@@ -16,11 +16,11 @@ var mongoDatabase *mongo.Database
|
||||
var mongoCollection *mongo.Collection
|
||||
|
||||
func connectMongo() {
|
||||
- mongoClient, _ = mongo.NewClient(options.Client().ApplyURI(os.Getenv("MONGO_URI")))
|
||||
+ mongoClient, _ = mongo.NewClient(options.Client().ApplyURI(os.Getenv("PN_WIIU_CHAT_MONGO_URI")))
|
||||
mongoContext, _ = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
_ = mongoClient.Connect(mongoContext)
|
||||
|
||||
- mongoDatabase = mongoClient.Database("pretendo")
|
||||
+ mongoDatabase = mongoClient.Database(os.Getenv("PN_WIIU_CHAT_MONGO_DATABASE"))
|
||||
mongoCollection = mongoDatabase.Collection("nexaccounts")
|
||||
}
|
||||
|
||||
20
patches/wiiu-chat-secure/dockerize.patch
Normal file
20
patches/wiiu-chat-secure/dockerize.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
diff --git c/Dockerfile i/Dockerfile
|
||||
new file mode 100644
|
||||
index 0000000..0f18fe9
|
||||
--- /dev/null
|
||||
+++ i/Dockerfile
|
||||
@@ -0,0 +1,14 @@
|
||||
+FROM golang:alpine AS builder
|
||||
+WORKDIR /build
|
||||
+
|
||||
+COPY go.* ./
|
||||
+RUN go mod download
|
||||
+
|
||||
+COPY . ./
|
||||
+RUN go build -v -o server
|
||||
+
|
||||
+FROM alpine:latest AS runner
|
||||
+WORKDIR /app
|
||||
+
|
||||
+COPY --from=builder /build/server /app/server
|
||||
+CMD ["/app/server"]
|
||||
@@ -0,0 +1,24 @@
|
||||
diff --git i/nex/server.go w/nex/server.go
|
||||
index 3d15725..03531d1 100644
|
||||
--- i/nex/server.go
|
||||
+++ w/nex/server.go
|
||||
@@ -35,5 +35,5 @@ func StartNEXServer() {
|
||||
registerCommonProtocols()
|
||||
registerNEXProtocols()
|
||||
|
||||
- globals.NEXServer.Listen(":60005")
|
||||
+ globals.NEXServer.Listen(":" + os.Getenv("PN_WIIU_CHAT_SECURE_SERVER_PORT"))
|
||||
}
|
||||
diff --git i/database/connect_mongo.go w/database/connect_mongo.go
|
||||
index 580fa98..1090679 100644
|
||||
--- i/database/connect_mongo.go
|
||||
+++ w/database/connect_mongo.go
|
||||
@@ -27,7 +27,7 @@ func connectMongo() {
|
||||
mongoContext, _ = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
_ = mongoClient.Connect(mongoContext)
|
||||
|
||||
- accountDatabase = mongoClient.Database("pretendo")
|
||||
+ accountDatabase = mongoClient.Database(os.Getenv("PN_WIIU_CHAT_MONGO_DATABASE"))
|
||||
pnidCollection = accountDatabase.Collection("pnids")
|
||||
nexAccountsCollection = accountDatabase.Collection("nexaccounts")
|
||||
|
||||
@@ -52,14 +52,20 @@ friends_kerberos_password=$(generate_password 32)
|
||||
echo "PN_FRIENDS_CONFIG_KERBEROS_PASSWORD=$friends_kerberos_password" >>./friends.local.env
|
||||
friends_api_key=$(generate_password 32)
|
||||
echo "PN_FRIENDS_CONFIG_GRPC_API_KEY=$friends_api_key" >>./friends.local.env
|
||||
echo "PN_WIIU_CHAT_FRIENDS_GRPC_API_KEY=$friends_api_key" >>./wiiu-chat.local.env
|
||||
friends_aes_key=$(generate_hex 64)
|
||||
echo "PN_FRIENDS_CONFIG_AES_KEY=$friends_aes_key" >>./friends.local.env
|
||||
|
||||
# Generate a Kerberos password for the Wii U Chat server
|
||||
chat_kerberos_password=$(generate_password 32)
|
||||
echo "PN_WIIU_CHAT_KERBEROS_PASSWORD=$chat_kerberos_password" >>./wiiu-chat.local.env
|
||||
|
||||
# Get the computer IP address
|
||||
printf "What is your computer's IP address? It must be accessible to your consoles: "
|
||||
read -r computer_ip
|
||||
echo "COMPUTER_IP=$computer_ip" >>./system.local.env
|
||||
echo "PN_FRIENDS_SECURE_SERVER_HOST=$computer_ip" >>./friends.local.env
|
||||
echo "PN_WIIU_CHAT_SECURE_SERVER_LOCATION=$computer_ip" >>./wiiu-chat.local.env
|
||||
|
||||
# Get the Wii U IP address
|
||||
printf "Enter your Wii U's IP address: "
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
#! /bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
null_aes_key=""
|
||||
for _ in $(seq 1 64); do
|
||||
null_aes_key="${null_aes_key}0"
|
||||
done
|
||||
|
||||
git_base=$(git rev-parse --show-toplevel)
|
||||
. "$git_base/environment/system.local.env"
|
||||
. "$git_base/environment/friends.env"
|
||||
. "$git_base/environment/friends.local.env"
|
||||
. "$git_base/environment/wiiu-chat.env"
|
||||
. "$git_base/environment/wiiu-chat.local.env"
|
||||
|
||||
docker compose up -d account
|
||||
|
||||
@@ -13,4 +21,7 @@ docker compose exec account node /app/dist/create-server-in-database.js reset
|
||||
docker compose exec account node /app/dist/create-server-in-database.js nex \
|
||||
"Friend List" "00003200" "0005001010001C00" "$COMPUTER_IP" \
|
||||
"$PN_FRIENDS_AUTHENTICATION_SERVER_PORT" "prod" "$PN_FRIENDS_CONFIG_AES_KEY"
|
||||
|
||||
# Wii U Chat server doesn't seem to care about the AES key
|
||||
docker compose exec account node /app/dist/create-server-in-database.js nex \
|
||||
"Wii U Chat" "1005A000" "000500101005A100" "$COMPUTER_IP" \
|
||||
"$PN_WIIU_CHAT_AUTHENTICATION_SERVER_PORT" "prod" "$null_aes_key"
|
||||
|
||||
Reference in New Issue
Block a user