echoCTF / echoCTF.RED

A platform to develop, run and administer CTF competitions. The online echoCTF.RED platform user interfaces and codebase
https://echoCTF.RED/
BSD 2-Clause "Simplified" License
114 stars 24 forks source link

Issues installing #66

Closed harperaa closed 4 years ago

harperaa commented 4 years ago

I followed the instructions in the installation doc. I ran into several issues, I worked around... here are my notes. Installed on Ubuntu LTS 18.04

  1. composer command gave several dependency errors, had to use following. composer install –ignore-platform-reqs

  2. yii command is migrate, not migration... had to run as below.

root@ubuntu:/var/www/echoCTF.RED/backend# ./yii migrate --interactive=0 Yii Migration Tool (based on Yii v2.0.32)

  1. output from first run of yii is below, notice database name error... had to edit the below files and fix the database name.

Exception 'yii\db\Exception' with message 'SQLSTATE[HY000] [1049] Unknown database 'echoCTF_dev''

in /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/db/Connection.php:635

Stack trace:

0 /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/db/Connection.php(1015): yii\db\Connection->open()

1 /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/db/Connection.php(1002): yii\db\Connection->getMasterPdo()

#

  1. See the location of the _dev database name below...

root@ubuntu:/var/www/echoCTF.RED/backend# grep -nr "echoCTF_dev" . ./config/db-sample.php:5: 'dsn' => 'mysql:host=localhost;dbname=echoCTF_dev', ./config/db.php:5: 'dsn' => 'mysql:host=localhost;dbname=echoCTF_dev', ./runtime/logs/app.log:1:2020-03-06 22:57:49 [-][-][-][error][yii\db\Exception] PDOException: SQLSTATE[HY000] [1049] Unknown database 'echoCTF_dev' in /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/db/Connection.php:698 ./runtime/logs/app.log:28:Next yii\db\Exception: SQLSTATE[HY000] [1049] Unknown database 'echoCTF_dev' in /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/db/Connection.php:635 root@ubuntu:/var/www/echoCTF.RED/backend#

  1. had to remove that tag and set to echoCTF only in these two files.

root@ubuntu:/var/www/echoCTF.RED/backend# vi config/db-sample.php root@ubuntu:/var/www/echoCTF.RED/backend# vi config/db.php root@ubuntu:/var/www/echoCTF.RED/backend# ./yii migrate --interactive=0 Yii Migration Tool (based on Yii v2.0.32)

Total 6 new migrations to be applied: m200207_093104_version_bump_v0_10 …

... that worked.

then, when trying to run the index.php I kept running into server errors and figured out that memcached was not installed...

errors can be seen in cat /var/log/apache2/error.log

to fix, installed memcached

add-apt-repository ppa:ondrej/php sudo apt-get install -y php php-dev php-pear libapache2-mod-php apt-get install -y php-memcached

  1. had to add to sites-available

root@ubuntu:/var/www/echoCTF.RED/backend# cat /etc/apache2/sites-available/echoCTF.RED.conf <VirtualHost :80> ServerAdmin webmaster@localhost ServerName echoCTF.RED ServerAlias www.your_domain DocumentRoot /var/www/echoCTF.RED/frontend/web/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined DirectoryIndex index.php <VirtualHost :80> ServerName backend.echoCTF.RED DocumentRoot "/var/www/echoCTF.RED/backend/web/" DirectoryIndex index.php ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined

then restart apache2

systemctl reload apache2

I got the website to comeup, but now it appears the controller is not working, as any clicks on links send 404 errors, it seems as the controller is not routing to the sub pages and forms... please advise how to start controller or any other guidance needed to operate the system.

When, I goto backend.echoCTF.RED (using /etc/hosts file for DNS to 127.0.0.1), that web page throws many errors as follows....

Invalid Configuration – yii\base\InvalidConfigException The directory is not writable by the Web process: /var/www/echoCTF.RED/backend/web/assets

1. in /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/web/AssetManager.php at line 459
450451452453454455456457458459460461462463464465466467468

        if (isset($this->_published[$path])) {
            return $this->_published[$path];
        }

        if (!is_string($path) || ($src = realpath($path)) === false) {
            throw new InvalidArgumentException("The file or directory to be published does not exist: $path");
        }

        if (!is_writable($this->basePath)) {
            throw new InvalidConfigException("The directory is not writable by the Web process: {$this->basePath}");
        }

        if (is_file($src)) {
            return $this->_published[$path] = $this->publishFile($src);
        }

        return $this->_published[$path] = $this->publishDirectory($src, $options);
    }

2. in /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/web/AssetBundle.php at line 185 – yii\web\AssetManager::publish('/var/www/echoCTF.RED/backend/ven...', [])
3. in /var/www/echoCTF.RED/backend/vendor/yiisoft/yii2/web/AssetManager.php at line 266 – yii\web\AssetBundle::publish(yii\web\AssetManager)

Please advise how to proceed and troubleshoot further if needed.

proditis commented 4 years ago

Hi there,

Thank you so so much for your extensive report and I am terribly sorry you had to suffer through our lack of documentation for the installation.

Regarding last problem create the folders frontend/web/assets and backend/web/assets and make sure they are writable from www-data or whatever the user of your web server is.

I will update the documentation to address your issues :)

proditis commented 4 years ago

@harperaa Can you please provide the error output from composer install without the –ignore-platform-reqs if possible, so that I can investigate this as well?

harperaa commented 4 years ago

@harperaa Can you please provide the error output from composer install without the –ignore-platform-reqs if possible, so that I can investigate this as well?

Here you go, for both backend and frontend... I tried to resolve the issues but ended up in a mess... thus the ignore command... root@ubuntu:/var/www/echoCTF.RED/backend# composer install Do not run Composer as root/super user! See https://getcomposer.org/root for details Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Your requirements could not be resolved to an installable set of packages.

Problem 1

proditis commented 4 years ago

If you are willing to give it another try here is an update Linux specific guide

https://github.com/echoCTF/echoCTF.RED/blob/master/docs/INSTALL-LINUX.md

Make sure you have an updated echoCTF.RED repo since a lot of changes have taken place.

proditis commented 4 years ago

I think we're passed all these issues so we can safely close this.