Skip to content

d7561985/PythonAuthserver

 
 

Repository files navigation

This is World of Warcraft authserver written in python.
Author: Kerhong
Thanks to: Midna (for bug fixes and testing)

How to set up on amazon ec2:

1. Create ec2 account

2. Create new instance (I used Amazon Linux AMI 2012.03)
    INSTANCES->Instances->Launch Instance
    Classic Wizard
    Amazon Linux AMI 64bit
    Chose instance type (micro is enough)
    Chose your availability zone (all your infrastructure should be in same zone)
    Press 'Continue' until you reach Key Pair setup
    Create new key pair, and save the private key on your PC
    Create new security group (TCP 22 and 3724 open)
    Launch the instance

3. SSH into your new instance
    If you are using putty, you will need to convert the .pem to .ppk with PuttyGEN
    Use username ec2-user, and the .ppk to authenticate

4. Run this:
    sudo yum -y install python27 mysql mysql-devel python27-devel gcc
    cd ~
    wget http://downloads.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz
    tar -xf ~/MySQL-python-1.2.3.tar.gz
    wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
    sudo sh ~/setuptools-0.6c11-py2.7.egg
    cd ~/MySQL-python-1.2.3
    python27 setup.py build
    sudo python27 setup.py install
    touch ~/onboot.sh
    chmod +x ~/onboot.sh
    sudo runuser -l root -c "echo '@reboot ~/onboot.sh' > /var/spool/cron/ec2-user"
    sudo chmod 600 /var/spool/cron/ec2-user
    sudo chown ec2-user /var/spool/cron/ec2-user
    sudo chgrp ec2-user /var/spool/cron/ec2-user

5. Edit ~/onboot.sh to clone your authserver and launch it (or it's restarter). This script must finish, don't make any infinite loops here.
   You will need to install git or mercurial if you want to use them to get sources. (sudo yum install git) (sudo yum install mercurial)
   !! Run __init__.py using python27 instead of python (Amazon Linux AMI uses python26 as default, this won't work with python26) !!
   Example onboot.sh (assuming you installed mercurial): !! having -l after interpreter is needed to make screen session work !!
        #!/bin/bash -l
        rm -r ~/authserver
        mkdir ~/authserver
        cd ~/authserver
        hg clone https://username:password@bitbucket.org/username/repository ./
        screen -A -m -d -S Authserver python27 ./__init__.py

6. Save this instance as new AMI (Rightclick on instance -> Create Image EBS AMI)(so you don't lose it). Next time when you want to launch another authserver just launch new instance with this AMI.

7a. Assign public IP to your instance.
or
7b. Create elastic load balancer and add as many of same AMI instances to it as you want.

8. ??

9. Profit

MySQL user permissions:
    CREATE USER 'python_realmd'@'%' IDENTIFIED BY '__PASSWORD__GOES__HERE__';
    GRANT USAGE ON *.* TO 'python_realmd'@'%';
    GRANT SELECT  ON `realmd`.* TO 'python_realmd'@'%';
    GRANT SELECT, UPDATE  ON TABLE `realmd`.`account_banned` TO 'python_realmd'@'%';
    GRANT SELECT, DELETE  ON TABLE `realmd`.`ip_banned` TO 'python_realmd'@'%';
    GRANT SELECT(`sessionkey`), UPDATE(`sessionkey`)  ON TABLE `realmd`.`account` TO 'python_realmd'@'%';
    GRANT SELECT(`v`), UPDATE(`v`)  ON TABLE `realmd`.`account` TO 'python_realmd'@'%';
    GRANT SELECT(`last_ip`), UPDATE(`last_ip`)  ON TABLE `realmd`.`account` TO 'python_realmd'@'%';
    GRANT SELECT(`last_login`), UPDATE(`last_login`)  ON TABLE `realmd`.`account` TO 'python_realmd'@'%';
    GRANT SELECT(`locale`), UPDATE(`locale`)  ON TABLE `realmd`.`account` TO 'python_realmd'@'%';
    GRANT SELECT(`operatingSystem`), UPDATE(`operatingSystem`)  ON TABLE `realmd`.`account` TO 'python_realmd'@'%';
    GRANT SELECT(`s`), UPDATE(`s`)  ON TABLE `realmd`.`account` TO 'python_realmd'@'%';
    FLUSH PRIVILEGES;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published