MOSSi - MOSSinstaller

Discussions About MOSS (Myst Online Server Software)

Moderator: a'moaca'

User avatar
Lyrositor
Member
Posts: 156
Joined: Sun Feb 05, 2012 10:58 pm
Contact:

MOSSi - MOSSinstaller

Post by Lyrositor » Tue Feb 14, 2012 2:36 am

Setting up MOSS right now is already quite easy, but it's rather long, tedious, boring and headache-inducing (at least in my case, although I freely admit I'm not overly familiar with such installations). Thus was MOSSi born.

MOSSi is an automated installer for the MOSS server software for the game Uru. It requires a fresh installation of Ubuntu 10.04.3 (other systems might work; not tested; must be Debian-based... for now). A proper guide will be written shortly. For now, simply follow the directives below.

Planned updates: multi-Linux compatability, init script for startup, more flexible installation system, improved configurability, other management scripts (user account manager, configuration editor).

Requirements
Here are a few standard requirements:
* Computer or server connected to the Internet,
* Basic Linux and computer skills.
This installer does NOT configure a Cyan content-serving server. Neither does it create a client that can connect to the installed server.

1. Install Ubuntu 10.04 LTS
So far, MOSSi has only been tested with Ubuntu 10.04 LTS (current version: 10.04.3). Visit the Ubuntu website and download the server version.

Install it on the computer you wish to set up MOSS. A fresh installation is recommended. Make sure your computer is connected to the Internet (in Ubuntu 10.04 LTS, wired connections should be detected and configured automatically).

2. Download MOSSi
After starting your operating system, type the following command in your terminal:

Code: Select all

cd ~
wget http://www.lyros.net/uru/moss_i.sh
chmod 700 ~/moss_i.sh
This will download MOSS to your home directory and make it executable.

3. Install MOSS
Here we go. Type:

Code: Select all

~/moss_i.sh
And just wait for it to finish (a rather long process). You might occasionally be prompted for your password or some other parameter. Simply type it and press Enter.

4. Done
All done. MOSS is installed and running under ~/moss. Enjoy!

Note: to start MOSS if you reboot your computer, enter the following commands :

Code: Select all

cd ~/moss
bin/moss_backend
bin/moss
Source
Source code for MOSSi is available here. Version: 0.0.1, code-named please-Yahvo-make-it-work.

Code: Select all

#!/bin/bash

##################################################################
# MOSS installer                                                 #
# Author: Lyrositor                                              #
# Version: 0.0.1                                                 #
# Description: Automated MOSS installation script for deployment #
# on Ubuntu 10.04 LTS machines. Not tested on other systems.     #
##################################################################

# Introduction.
echo "MOSSi - MOSS installer"
echo "By Lyrositor."
echo ""
sudo -p "Enter your password:" echo ""

# Installing programs.
echo "Installing programs..."
sudo apt-get -yqq install libssl-dev postgresql postgresql-server-dev-8.4 libpqxx-dev g++ autoconf automake libtool mercurial unzip > /dev/null 2>&1

# Cloning of repository.
echo "Cloning repository..."
cd ~
hg -q clone https://foundry.openuru.org/hg/MOSS 

# Configuring and installing.
echo "Configuring..."
cd MOSS
./bootstrap.sh > /dev/null 2>&1
./configure --enable-fast-download --prefix ~/moss > /dev/null 2>&1
echo "Installing..."
make -s > /dev/null 2>&1
make -s install > /dev/null 2>&1
cd ~

# Setting up database.
echo "Setting up database..."
cd ~/MOSS/postgresql
make -s > /dev/null 2>&1
sudo make -s install > /dev/null 2>&1
sudo service postgresql-8.4 restart > /dev/null 2>&1
sudo -u postgres createuser -lsdr $USER > /dev/null 2>&1
read -s -p "Enter database user's password (thrice): " db_password # TODO: automate process; password should only be entered once.
echo -en "\n"
createuser -lSDRP moss
createdb -E UTF-8 -O moss moss > /dev/null 2>&1
psql moss -f moss.sql > /dev/null 2>&1
cd ~

# Creating directories.
echo "Creating directories..."
mkdir ~/moss/auth
mkdir ~/moss/auth/default
mkdir ~/moss/etc
mkdir ~/moss/file
mkdir ~/moss/game
mkdir ~/moss/game/age
mkdir ~/moss/game/SDL
mkdir ~/moss/game/SDL/common
mkdir ~/moss/log

# Populating directories.
echo "Populating directories..."
cd ~/moss/file
wget -q http://www.lyros.net/uru/Files.zip
unzip -qq Files.zip
rm Files.zip
cd ~
wget -q http://assets.openuru.org/cyan/AuthFiles.zip
unzip -qq AuthFiles.zip
cp -r AuthFiles/893/* moss/auth/default
rm AuthFiles.zip
rm -r AuthFiles
echo "Python\python.pak" > ~/moss/auth/default/Python.txt
echo -e "SDL/ahnonaycathedral.sdl
SDL/ahnonay.sdl
SDL/animation.sdl
SDL/avatar.sdl
SDL/ayoheek.sdl
SDL/BaronCityOffice.sdl
SDL/city.sdl
SDL/Cleft.sdl
SDL/cloneMessage.sdl
SDL/clothing.sdl
SDL/Dereno.sdl
SDL/Descent.sdl
SDL/EderDelin.sdl
SDL/EderTsogal.sdl
SDL/ErcanaCitySilo.sdl
SDL/Ercana.sdl
SDL/Garden.sdl
SDL/Garrison.sdl
SDL/Gira.sdl
SDL/GreatTreePub.sdl
SDL/GreatZero.sdl
SDL/grsnTrnCtrDoors.sdl
SDL/Jalak.sdl
SDL/Kadish.sdl
SDL/Kveer.sdl
SDL/Minkata.sdl
SDL/morph.sdl
SDL/Myst.sdl
SDL/Negilahn.sdl
SDL/Neighborhood02.sdl
SDL/Neighborhood.sdl
SDL/Nexus.sdl
SDL/particle.sdl
SDL/Payiferen.sdl
SDL/PelletBahroCave.sdl
SDL/Personal.sdl
SDL/PhilRelto.sdl
SDL/physical.sdl
SDL/responder.sdl
SDL/RestorationGuild.sdl
SDL/sound.sdl
SDL/SpyRoom.sdl
SDL/Teledahn.sdl
SDL/Tetsonot.sdl
SDL/tldnPwrTwrPeriscope.sdl
SDL/tldnVaporScope.sdl
SDL/tldnWRCCBrain.sdl
SDL/x2wayLever.sdl
SDL/xButtonLeverSwitchPowered.sdl
SDL/xChatChannel.sdl
SDL/xConcentration.sdl
SDL/xHighLevelStarTrekDoor.sdl
SDL/xPassiveIndicatorLight.sdl
SDL/xPowerLightSwitch.sdl
SDL/xPowerStarTrekDoor.sdl
SDL/xregion.sdl
SDL/xStateToggler.sdl
SDL/xTelescope.sdl" > ~/moss/auth/default/SDL.txt
perl ~/MOSS/support/make-mbam.pl ~/moss/auth/default/Python.txt
perl ~/MOSS/support/make-mbam.pl ~/moss/auth/default/SDL.txt
wget -q http://assets.openuru.org/cyan/Scripts.zip
unzip -qq ~/Scripts.zip
cp -r ~/Scripts/SDL ~/moss/game
cp ~/Scripts/dat/*.age ~/moss/game/age
cp ~/moss/game/SDL/*.sdl ~/moss/game/SDL/common
rm ~/moss/game/SDL/*.sdl
rm ~/Scripts.zip
rm -r ~/Scripts

# Generating keys.
echo "Generating keys..."
~/moss/bin/make_cyan_dh -g 41 -s ~/moss/etc/auth_key.der -C pnNbAuthKey.hpp
~/moss/bin/make_cyan_dh -g 73 -s ~/moss/etc/game_key.der -C pnNbGameKey.hpp
~/moss/bin/make_cyan_dh -g 4 -s ~/moss/etc/gatekeeper_key.der -C pnNbGatekeeperKey.hpp
chmod 400 ~/moss/etc/*

# Setting up configuration files.
echo "Setting up configuration files..."
cp ~/MOSS/main.cfg ~/moss/etc/moss.cfg
cp ~/MOSS/backend.cfg ~/moss/etc/moss_backend.cfg
read -p "Enter server external address: " external_address
moss_i=$(cat ~/moss/etc/moss.cfg)
moss_backend_i=$(cat ~/moss/etc/moss_backend.cfg)
moss_f="$moss_i
external_address = $external_address"
moss_backend_f="$moss_backend_i
db_password = $db_password"
echo "$moss_f" > ~/moss/etc/moss.cfg
echo "$moss_backend_f" > ~/moss/etc/moss_backend.cfg

# Adding admin account.
echo "Adding admin account..."
read -s -p "Enter admin password: " password
password=$(echo -n $password | openssl dgst -sha1)
psql moss -c "INSERT INTO accounts (name, hash, id, class, visitor) VALUES ('admin', '$password', uuid(), 'default', 'false');"  > /dev/null 2>&1

# Write licenses.
echo "Python code: http://assets.openuru.org/cyan/Scripts.zip" > ~/moss/licenses.txt

# Starting MOSS.
echo "Starting MOSS..."
cd ~/moss
bin/moss_backend
bin/moss

# Tidying up.
echo "Tidying up..."
~/moss/bin/global_sdl_manager ~/moss/game/SDL < ~/MOSS/support/set_to_moul.txt  > /dev/null 2>&1
rm -r ~/MOSS

# Done.
echo "Installation complete."
Notes: this scripts has only been tested in VirtualBox so far with Ubuntu 10.04. I'm currently setting up a real server which will also integrate a client hopefully so that I can try out my script more thoroughly.
Lyrositor
Explorer #16601888
To D'ni, or not to D'ni. There is no question.
Image

User avatar
Lyrositor
Member
Posts: 156
Joined: Sun Feb 05, 2012 10:58 pm
Contact:

Re: MOSSi - MOSSinstaller

Post by Lyrositor » Wed Feb 22, 2012 10:50 pm

MOSSi HAS BEEN UPDATED!
After further testing, and the successful set-up of various VirtualBox shards and one "real" shard, I have finally updated MOSSi to version 0.0.2. The new homepage is: http://uru.lyros.net/mossi/
New features and/or fixes:
- Manifest creation errors,
- Removed redondant prompts,
- Saner database management (user which will run moss is now also DB role),
- New ~/keys directory containing public keys,
- Renamed various files to correct form (Garrison and Teledahn),
- Correct creation of first account.

Assuming you run Ubuntu 10.04.4 (maybe other versions too), MOSSi 0.0.2 SHOULD WORK FOR YOU. The Lyros Shard has been setup using only MOSSi. It has been tested with the GoW CWE client by using a program to convert the MOSS public keys to a server.ini (not created by me; I would appreciate the sources for this program so that I could integrate it directly into MOSSi).

The next step is creating a user creation program to facilitate adding new accounts (will probably be integrated with a PHP script too).
Lyrositor
Explorer #16601888
To D'ni, or not to D'ni. There is no question.
Image

User avatar
Mac_Fife
Member
Posts: 1229
Joined: Fri Dec 19, 2008 12:38 am
Location: Scotland
Contact:

Re: MOSSi - MOSSinstaller

Post by Mac_Fife » Thu Feb 23, 2012 11:07 am

Lyrositor wrote:The next step is creating a user creation program to facilitate adding new accounts (will probably be integrated with a PHP script too).
A PHP script is all you need to add new accounts to MOSS. You just need to be able to call compute_auth_hash and execute the relevant SQL queries ;)
Mac_Fife
OpenUru.org wiki wrangler

User avatar
Lyrositor
Member
Posts: 156
Joined: Sun Feb 05, 2012 10:58 pm
Contact:

Re: MOSSi - MOSSinstaller

Post by Lyrositor » Thu Feb 23, 2012 11:54 am

Mac_Fife wrote: You just need to be able to call compute_auth_hash and execute the relevant SQL queries
Would this work:

Code: Select all

$pass = system("./compute_auto_hash $email $pass"); 
With compute_auto_hash compiled and put in the same directory as the PHP script?
Lyrositor
Explorer #16601888
To D'ni, or not to D'ni. There is no question.
Image

User avatar
rarified
Member
Posts: 800
Joined: Tue Dec 16, 2008 10:48 pm
Location: Colorado, US

Re: MOSSi - MOSSinstaller

Post by rarified » Thu Feb 23, 2012 2:50 pm

Lyrositor wrote:
Mac_Fife wrote: You just need to be able to call compute_auth_hash and execute the relevant SQL queries
Would this work:

Code: Select all

$pass = system("./compute_auto_hash $email $pass");  
With compute_auto_hash compiled and put in the same directory as the PHP script?
That would be an instant security hole. $email and $pass could contain shell metacharacters that would allow the execution of arbitrary commands.

You need to sanitize $email and $pass and/or enclose them in apostrophes so no shell expansion takes place.

_R
One of the OpenUru toolsmiths... a bookbinder.

User avatar
Lyrositor
Member
Posts: 156
Joined: Sun Feb 05, 2012 10:58 pm
Contact:

Re: MOSSi - MOSSinstaller

Post by Lyrositor » Thu Feb 23, 2012 3:18 pm

Yeah, yeah, of course. I'm gonna mysql_real_escape_string and apply a few other things on them to check for input. But I'm just asking about whether it would succesfully compute the hash.
Lyrositor
Explorer #16601888
To D'ni, or not to D'ni. There is no question.
Image

User avatar
Mac_Fife
Member
Posts: 1229
Joined: Fri Dec 19, 2008 12:38 am
Location: Scotland
Contact:

Re: MOSSi - MOSSinstaller

Post by Mac_Fife » Thu Feb 23, 2012 6:48 pm

Lyrositor wrote:Yeah, yeah, of course. I'm gonna mysql_real_escape_string and apply a few other things on them to check for input. But I'm just asking about whether it would succesfully compute the hash.
Heh! I wouldn't try using a mySQL function on a PostgreSQL database ;). I don't use pg_escape_string either, but I do a lot of checking/cleansing on both the password and email supplied long before I get to the point of putting them through copute_auth_hash (for instance, I check that the email address conforms to the RFCs and I check that there's a valid MX record for the domain - no point sending emails out if they're just going to bounce back). Also there's no particular need to create another instance of compute_auth_hash for the benefit of your PHP script - just make sure that your PHP knows the system path to the MOSS compute_auth_hash and ensure that the user that runs the HTTP server has execute privilege on it.

What you might end up with is something like:

Code: Select all

$hash = exec("/opt/moss/bin/compute_auth_hash '$email' '$pass' "); 
You'll find that quoting the variables is essential to stop certain symbols from being misinterpreted (I fell into that trap :oops: )
Mac_Fife
OpenUru.org wiki wrangler

User avatar
Lyrositor
Member
Posts: 156
Joined: Sun Feb 05, 2012 10:58 pm
Contact:

Re: MOSSi - MOSSinstaller

Post by Lyrositor » Thu Feb 23, 2012 8:38 pm

From what I've seen (read: tried and failed to do), compute_auto_hash doesn't get installed along with MOSS, and can only be compiled with make. Can I have an option to install under /bin?
Lyrositor
Explorer #16601888
To D'ni, or not to D'ni. There is no question.
Image

User avatar
Hoikas
Member
Posts: 286
Joined: Fri Jun 03, 2011 8:38 pm

Re: MOSSi - MOSSinstaller

Post by Hoikas » Thu Feb 23, 2012 8:43 pm

It would be easier to use plain usernames and SHA1, unless MOSS doesn't support that... In which case...... hmmm.... sha0 is a broken algorithm....
Image

User avatar
Mac_Fife
Member
Posts: 1229
Joined: Fri Dec 19, 2008 12:38 am
Location: Scotland
Contact:

Re: MOSSi - MOSSinstaller

Post by Mac_Fife » Thu Feb 23, 2012 8:55 pm

I don't believe there's any reason why MOSS shouldn't be able to support SHA1, but the current scheme is set up to replicate the behaviour of MOULa, including the well known foibles associated with that. The reasoning behind that, I suspect, is that MOSS was originally created to work with a "standard" MOULa client, so needed to emulate what that client would expect (work on MOSS pre-dated the Open Source CWE client).
Mac_Fife
OpenUru.org wiki wrangler

Post Reply

Return to “MOSS”

Who is online

Users browsing this forum: No registered users and 1 guest