[UPDATE] Development to Master
This commit is contained in:
commit
486869a1a2
@ -1,3 +1,10 @@
|
||||
1.0.4 (Jun 19th 2015)
|
||||
---------------------
|
||||
* Honor anonymous attribute when sending block finder mails
|
||||
* Display admin warning if no transfer fees are set
|
||||
* Moved admin_checks.php into the admin panel/system/setup
|
||||
* Checks are now loaded individually from pages/admin/checks
|
||||
|
||||
1.0.3 (Apr 29th 2015)
|
||||
---------------------
|
||||
|
||||
|
||||
@ -1,155 +0,0 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
|
||||
if (!include_once(INCLUDE_DIR . '/lib/jsonRPCClient.php')) die('Unable to load libs');
|
||||
$notice = array();
|
||||
$enotice = array();
|
||||
$error = array();
|
||||
|
||||
// setup some basic stuff for checking - getuid/getpwuid not available on mac/windows
|
||||
$apache_user = 'unknown';
|
||||
if (substr_count(strtolower(PHP_OS), 'nix') > 0 || substr_count(strtolower(PHP_OS), 'linux') > 0) {
|
||||
$apache_user = (function_exists('posix_getuid')) ? posix_getuid() : 'unknown';
|
||||
$apache_user = (function_exists('posix_getpwuid')) ? posix_getpwuid($apache_user) : $apache_user;
|
||||
}
|
||||
|
||||
// setup checks
|
||||
// logging
|
||||
if ($config['logging']['enabled']) {
|
||||
if (!is_writable($config['logging']['path'])) {
|
||||
$error[] = "Logging is enabled but we can't write in the logfile path";
|
||||
}
|
||||
}
|
||||
|
||||
// check if fees are 0 and ap/mp tx fees are also set to 0 -> issue #2424
|
||||
if ($config['fees'] == 0 && ($config['txfee_auto'] == 0 || $config['txfee_manual'] == 0)) {
|
||||
$notice[] = "Having your pool fees set to 0 and tx fees also set to 0 can cause a problem where the wallet cannot payout, consider setting the txfee to a very low amount, ie. 0.0001 to avoid this.";
|
||||
}
|
||||
|
||||
// check if memcache isn't available but enabled in config -> error
|
||||
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
|
||||
$error[] = "You have memcached enabled in your config and it's not available as a PHP module. Install the package on your system.";
|
||||
}
|
||||
|
||||
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
|
||||
if (!$config['memcache']['enabled']) {
|
||||
if (PHP_OS == 'WINNT') {
|
||||
require_once(CLASS_DIR . 'memcached.class.php');
|
||||
}
|
||||
if (class_exists('Memcached')) {
|
||||
$memcache_test = @new Memcached();
|
||||
if ($config['memcache']['sasl'] === true) {
|
||||
$memcache_test->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
|
||||
$memcache_test->setSaslAuthData($config['memcache']['sasl']['username'], $config['memcache']['sasl']['password']);
|
||||
}
|
||||
$memcache_test_add = @$memcache_test->addServer($config['memcache']['host'], $config['memcache']['port']);
|
||||
$randmctv = rand(5,10);
|
||||
$memcache_test_set = @$memcache_test->set('test_mpos_setval', $randmctv);
|
||||
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
|
||||
}
|
||||
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
|
||||
$error[] = "You have memcache disabled in the config but it's available and works! Enable it for best performance.";
|
||||
} else {
|
||||
$notice[] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
|
||||
}
|
||||
}
|
||||
|
||||
// check if htaccess exists
|
||||
if (!file_exists(BASEPATH.".htaccess")) {
|
||||
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
|
||||
$notice[] = "You don't seem to have a .htaccess in your public folder, if you're using Apache set it up: $htaccess_link";
|
||||
}
|
||||
|
||||
// check if we can write templates/cache and templates/compile -> error
|
||||
if (!is_writable(TEMPLATE_DIR . '/cache')) {
|
||||
$error[] = "templates/cache folder is not writable for uid {$apache_user['name']}";
|
||||
}
|
||||
if (!is_writable(TEMPLATE_DIR . '/compile')) {
|
||||
$error[] = "templates/compile folder is not writable for uid {$apache_user['name']}";
|
||||
}
|
||||
|
||||
// check if we can write the config files, we should NOT be able to -> error
|
||||
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
|
||||
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
|
||||
$error[] = "Your config files <b>SHOULD NOT be writable to this user</b>!";
|
||||
}
|
||||
|
||||
// check if daemon can connect -> error
|
||||
try {
|
||||
if ($bitcoin->can_connect() !== true) {
|
||||
$error[] = "Unable to connect to coin daemon using provided credentials";
|
||||
}
|
||||
else {
|
||||
// validate that the wallet service is not in test mode
|
||||
if ($bitcoin->is_testnet() == true) {
|
||||
$error[] = "The coin daemon service is running as a testnet. Check the TESTNET setting in your coin daemon config and make sure the correct port is set in the MPOS config.";
|
||||
}
|
||||
|
||||
// if coldwallet is not empty, check if the address is valid -> error
|
||||
if (!empty($config['coldwallet']['address'])) {
|
||||
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
|
||||
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
|
||||
}
|
||||
|
||||
// check if there is more than one account set on wallet
|
||||
$accounts = $bitcoin->listaccounts();
|
||||
if (count($accounts) > 1 && $accounts[''] <= 0) {
|
||||
$error[] = "There are " . count($accounts) . " Accounts set in local Wallet and Default Account has no liquid funds to pay your miners!";
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
// check anti DOS protection, we need memcache for that
|
||||
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
|
||||
$error[] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this";
|
||||
}
|
||||
|
||||
// poke stratum using gettingstarted details -> enotice
|
||||
if (function_exists('socket_create')) {
|
||||
$host = @gethostbyname($config['gettingstarted']['stratumurl']);
|
||||
$port = $config['gettingstarted']['stratumport'];
|
||||
|
||||
if (isset($host) and
|
||||
isset($port) and
|
||||
($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
|
||||
(socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 3, 'usec' => 0))) and
|
||||
(@socket_connect($socket, $host, $port)))
|
||||
{
|
||||
socket_close($socket);
|
||||
} else {
|
||||
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond - ' . socket_strerror(socket_last_error());
|
||||
}
|
||||
} else {
|
||||
// Connect via fsockopen as fallback
|
||||
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'], $config['gettingstarted']['stratumport'], $errCode, $errStr, 1)) {
|
||||
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond';
|
||||
}
|
||||
@fclose($fp);
|
||||
}
|
||||
|
||||
// security checks
|
||||
// salts too short -> notice, salts default -> error
|
||||
if ((strlen($config['SALT']) < 24) || (strlen($config['SALTY']) < 24) || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
if ($config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
$error[] = "You absolutely <u>SHOULD NOT leave your SALT or SALTY default</u> changing them will require registering again";
|
||||
} else {
|
||||
$notice[] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again";
|
||||
}
|
||||
}
|
||||
|
||||
// display the errors
|
||||
foreach ($enotice as $en) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => $en, 'TYPE' => 'alert alert-info');
|
||||
}
|
||||
if (!count($notice) && !count($error)) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'The config options we checked seem OK', 'TYPE' => 'alert alert-success');
|
||||
} else {
|
||||
foreach ($notice as $n) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => $n, 'TYPE' => 'alert alert-warning');
|
||||
}
|
||||
foreach ($error as $e) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => $e, 'TYPE' => 'alert alert-danger');
|
||||
}
|
||||
}
|
||||
}
|
||||
44
include/pages/admin/checks/check_daemon.inc.php
Normal file
44
include/pages/admin/checks/check_daemon.inc.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if daemon can connect -> error
|
||||
try {
|
||||
if ($bitcoin->can_connect() !== true) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Coin daemon";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['description'] = "Unable to connect to coin daemon using provided credentials.";
|
||||
$newerror['configvalue'] = "wallet.*";
|
||||
$newerror['extdesc'] = "We weren't able to connect to your coin daemon using the host/username/password/port given in the config. Check that your coin daemon is running and mpos is configured with the data from your coin daemon config. Your coin daemon may also not yet be fully synced.";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
else {
|
||||
// validate that the wallet service is not in test mode
|
||||
if ($bitcoin->is_testnet() == true) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Coin daemon";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "You may have accidentally mistyped the port, or are running the coin daemon in testnet mode. Check your coin daemon config and MPOS config.";
|
||||
$newerror['description'] = "The coin daemon service is running as a testnet. Check the TESTNET setting in your coin daemon config and make sure the correct port is set in the MPOS config.";
|
||||
$newerror['configvalue'] = "wallet.host";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
// check if there is more than one account set on wallet
|
||||
$accounts = $bitcoin->listaccounts();
|
||||
if (count($accounts) > 1 && $accounts[''] <= 0) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Coin daemon";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "You need at least one account to be able to pay miners! Your coin daemon may not yet be fully synced, see the above link for more details.";
|
||||
$newerror['description'] = "There are " . count($accounts) . " Accounts set in local Wallet and Default Account has no liquid funds to pay your miners!";
|
||||
$newerror['configvalue'] = "wallet.host";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {}
|
||||
15
include/pages/admin/checks/check_fees.inc.php
Normal file
15
include/pages/admin/checks/check_fees.inc.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if fees are 0 and ap/mp tx fees are also set to 0 -> issue #2424
|
||||
if ($config['fees'] == 0 && ($config['txfee_auto'] == 0 || $config['txfee_manual'] == 0)) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Fees and TX Fees 0";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "This is an issue that can only occur with both your fees set to 0 and auto or manual tx fees set to 0 as well. It's best to avoid it if possible though, as it can prevent payouts; set the txfee to a small amount to avoid this.";
|
||||
$newerror['description'] = "Having your pool fees set to 0 and tx fees also set to 0 can cause a problem where the wallet cannot payout, consider setting the txfee to a very low amount, ie. 0.0001 to avoid this.";
|
||||
$newerror['configvalue'] = "fees";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/issues/2424";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
67
include/pages/admin/checks/check_memcache.inc.php
Normal file
67
include/pages/admin/checks/check_memcache.inc.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if memcache isn't available but enabled in config -> error
|
||||
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "You have memcached enabled in your config and it's not available as a PHP module. Install the package on your system.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
|
||||
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
|
||||
if (!$config['memcache']['enabled']) {
|
||||
if (PHP_OS == 'WINNT') {
|
||||
require_once(CLASS_DIR . 'memcached.class.php');
|
||||
}
|
||||
if (class_exists('Memcached')) {
|
||||
$memcache_test = @new Memcached();
|
||||
if ($config['memcache']['sasl'] === true) {
|
||||
$memcache_test->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
|
||||
$memcache_test->setSaslAuthData($config['memcache']['sasl']['username'], $config['memcache']['sasl']['password']);
|
||||
}
|
||||
$memcache_test_add = @$memcache_test->addServer($config['memcache']['host'], $config['memcache']['port']);
|
||||
$randmctv = rand(5,10);
|
||||
$memcache_test_set = @$memcache_test->set('test_mpos_setval', $randmctv);
|
||||
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
|
||||
}
|
||||
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "You have memcache disabled in the config but it's available and works! Enable it for best performance.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
} else {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
}
|
||||
|
||||
// check anti DOS protection, we need memcache for that
|
||||
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Memcache Config";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "Memcache is a service that you run that lets us cache commonly used data and access it quickly. It's highly recommended you <a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#requirements-1'>install the service and php packages</a> for your distro.";
|
||||
$newerror['description'] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this.";
|
||||
$newerror['configvalue'] = "memcache.enabled";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache-rate-limiting";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
55
include/pages/admin/checks/check_permissions.inc.php
Normal file
55
include/pages/admin/checks/check_permissions.inc.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
if ($config['logging']['enabled']) {
|
||||
// checks to see that the logging path is writable
|
||||
if (!is_writable($config['logging']['path'])) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Log path permissions";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "In order to log data, we need to be able to write in the logs folder. See the link above for more details.";
|
||||
$newerror['description'] = "Logging is enabled but we can't write in the logfile path.";
|
||||
$newerror['configvalue'] = "logging.path";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#configuration-1";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
}
|
||||
|
||||
// check if we can write templates/cache and templates/compile -> error
|
||||
if (!is_writable(TEMPLATE_DIR . '/cache')) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "templates/cache permissions";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "In order to cache template data, we need to be able to write in the templates/cache folder. See the link above for more details.";
|
||||
$newerror['description'] = "templates/cache folder is not writable for uid {$apache_user['name']}";
|
||||
$newerror['configvalue'] = "templates/cache folder";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#folder-permissions";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
if (!is_writable(TEMPLATE_DIR . '/compile')) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "templates/compile permissions";
|
||||
$newerror['level'] = 3;
|
||||
$newerror['extdesc'] = "In order to cache compiled template data, we need to be able to write in the templates/compile folder. See the link above for more details.";
|
||||
$newerror['description'] = "templates/compile folder is not writable for uid {$apache_user['name']}";
|
||||
$newerror['configvalue'] = "templates/compile folder";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#folder-permissions";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
|
||||
// check if we can write the config files, we should NOT be able to -> error
|
||||
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
|
||||
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Config permissions";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "For security purposes, the user your webserver runs as should not be able to write to the config files, only read from them. To fix this, check the ownership and permissions of the include/config files.";
|
||||
$newerror['description'] = "Your config files <b>SHOULD NOT be writable by this user</b>!";
|
||||
$newerror['configvalue'] = "global.inc.php and security.inc.php";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide#configuration-1";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
33
include/pages/admin/checks/check_security.inc.php
Normal file
33
include/pages/admin/checks/check_security.inc.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// check if password salts are sane
|
||||
if (strlen($config['SALT']) < 24 || strlen($config['SALTY']) < 24 || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Password Salts";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = "Salts are important because they add a random element and 'padding' to passwords and other hashed strings. They should be changed from the default and should not be too short for increased security.";
|
||||
if ($config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||
$newerror['description'] = "You absolutely <u>SHOULD NOT leave your SALT or SALTY default</u> changing them will require registering again.";
|
||||
} else {
|
||||
$newerror['description'] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again.</p>";
|
||||
}
|
||||
$newerror['configvalue'] = "SALT";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-defines--salts";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
|
||||
// check if htaccess exists
|
||||
if (!file_exists(BASEPATH.".htaccess")) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = ".htaccess";
|
||||
$newerror['level'] = 2;
|
||||
$newerror['extdesc'] = ".htaccess files let you control who/how files are accessed for Apache. If you're using Apache for MPOS, you should be using .htaccess.";
|
||||
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
|
||||
$newerror['description'] = "You don't seem to have a .htaccess in your public folder, if you're using Apache set it up: $htaccess_link";
|
||||
$newerror['configvalue'] = ".htaccess";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
40
include/pages/admin/checks/check_stratum.inc.php
Normal file
40
include/pages/admin/checks/check_stratum.inc.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// poke stratum using gettingstarted details -> enotice
|
||||
if (function_exists('socket_create')) {
|
||||
$host = @gethostbyname($config['gettingstarted']['stratumurl']);
|
||||
$port = $config['gettingstarted']['stratumport'];
|
||||
if (isset($host) and
|
||||
isset($port) and
|
||||
($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
|
||||
(socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 3, 'usec' => 0))) and
|
||||
(@socket_connect($socket, $host, $port)))
|
||||
{
|
||||
socket_close($socket);
|
||||
} else {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Stratum information";
|
||||
$newerror['level'] = 1;
|
||||
$newerror['extdesc'] = "We tried to connect the stratum server that you set in your gettingstarted config, but an error occured somewhere along the way. Your stratum server may not be running currently, your firewall could be blocking the connection, or your coin daemon may not yet be fully synced, etc.";
|
||||
$newerror['description'] = "We tried to poke your Stratum server using your \$config['gettingstarted'] settings but it didn't respond - " . socket_strerror(socket_last_error()) . ".";
|
||||
$newerror['configvalue'] = "gettingstarted";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
} else {
|
||||
// Connect via fsockopen as fallback
|
||||
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'], $config['gettingstarted']['stratumport'], $errCode, $errStr, 1)) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Stratum information";
|
||||
$newerror['level'] = 1;
|
||||
$newerror['extdesc'] = "We tried to connect the stratum server that you set in your gettingstarted config, but an error occured somewhere along the way. Your stratum server may not be running currently, your firewall could be blocking the connection, or your coin daemon may not yet be fully synced, etc.";
|
||||
$newerror['description'] = "We tried to poke your Stratum server using your \$config['gettingstarted'] settings but it didn't respond.";
|
||||
$newerror['configvalue'] = "gettingstarted";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
}
|
||||
@fclose($fp);
|
||||
}
|
||||
38
include/pages/admin/setup.inc.php
Normal file
38
include/pages/admin/setup.inc.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
// Check user to ensure they are admin
|
||||
if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
||||
header("HTTP/1.1 404 Page not found");
|
||||
die("404 Page not found");
|
||||
}
|
||||
|
||||
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
|
||||
if (!include_once(INCLUDE_DIR . '/lib/jsonRPCClient.php')) die('Unable to load libs');
|
||||
$error = array();
|
||||
|
||||
if ($config['skip_config_tests']) {
|
||||
$newerror = array();
|
||||
$newerror['name'] = "Config tests skipped";
|
||||
$newerror['description'] = "Config tests are disabled. Enable them in the global config to run them again.";
|
||||
$newerror['configvalue'] = "skip_config_tests";
|
||||
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-check";
|
||||
$error[] = $newerror;
|
||||
$newerror = null;
|
||||
} else {
|
||||
// setup some basic stuff for checking - getuid/getpwuid not available on mac/windows
|
||||
$apache_user = 'unknown';
|
||||
if (substr_count(strtolower(PHP_OS), 'nix') > 0 || substr_count(strtolower(PHP_OS), 'linux') > 0) {
|
||||
$apache_user = (function_exists('posix_getuid')) ? posix_getuid() : 'unknown';
|
||||
$apache_user = (function_exists('posix_getpwuid')) ? posix_getpwuid($apache_user) : $apache_user;
|
||||
}
|
||||
|
||||
// we want to load anything in checks/ that is check_*.inc.php
|
||||
foreach(glob(__DIR__."/checks/check_*.inc.php") as $file) {
|
||||
include_once($file);
|
||||
}
|
||||
}
|
||||
$smarty->assign("ERRORS", $error);
|
||||
}
|
||||
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||
|
||||
define('MPOS_VERSION', '1.0.3');
|
||||
define('MPOS_VERSION', '1.0.4');
|
||||
define('DB_VERSION', '1.0.1');
|
||||
define('CONFIG_VERSION', '1.0.1');
|
||||
define('HASH_VERSION', 1);
|
||||
|
||||
@ -101,8 +101,8 @@ if (count(@$_SESSION['last_ip_pop']) == 2) {
|
||||
|
||||
// version check and config check if not disabled
|
||||
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
|
||||
if (!@$config['skip_config_tests']) {
|
||||
require_once(INCLUDE_DIR . '/admin_checks.php');
|
||||
if (!@$config['skip_config_tests'] && @$_GET['action'] != 'setup') {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => "You haven't turned off config checks, visit the <b><a href='?page=admin&action=setup'>setup page</a></b> for further information.", 'DISMISS' => 'yes', 'ID' => 'lastlogin', 'TYPE' => 'alert alert-info');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
36
templates/bootstrap/admin/setup/default.tpl
Normal file
36
templates/bootstrap/admin/setup/default.tpl
Normal file
@ -0,0 +1,36 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-question fa-fw"></i> Setup Checks<br />
|
||||
<i>To disable these checks, set skip_config_tests to true in global.inc.php</i>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{if $ERRORS|@count > 0}
|
||||
{section errors $ERRORS}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-{if $ERRORS[errors].level >= 2}danger
|
||||
{elseif $ERRORS[errors].level == 1}warning
|
||||
{elseif $ERRORS[errors].level == 0}info{/if}">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-{if $ERRORS[errors].level >= 2}times-circle
|
||||
{elseif $ERRORS[errors].level == 1}warning
|
||||
{elseif $ERRORS[errors].level == 0}info{/if} fa-fw"></i> <strong>{$ERRORS[errors].name}</strong>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>{$ERRORS[errors].description}</p>
|
||||
<p><pre style='width:35%'>$config.<a href="{$ERRORS[errors].helplink}">{$ERRORS[errors].configvalue}</a></pre></p>
|
||||
<p>{$ERRORS[errors].extdesc}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-lg-12 -->
|
||||
</div>
|
||||
{/section}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-lg-12 -->
|
||||
</div>
|
||||
@ -30,6 +30,7 @@
|
||||
<li {if $smarty.get.action|default:"0" eq "dashboard" || $smarty.get.action|default:"0" eq "monitoring" || $smarty.get.action|default:"0" eq "settings"}class="active"{/if}>
|
||||
<a href="#"><i class="fa fa-linux fa-fw"></i> System <span class="fa arrow"></span></a>
|
||||
<ul class="nav nav-third-level">
|
||||
<li><a href="{$smarty.server.SCRIPT_NAME}?page=admin&action=setup"><i class="fa fa-book fa-fw"></i> Setup</a></li>
|
||||
<li><a href="{$smarty.server.SCRIPT_NAME}?page=admin&action=dashboard"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a></li>
|
||||
<li><a href="{$smarty.server.SCRIPT_NAME}?page=admin&action=monitoring"><i class="fa fa-bell-o fa-fw"></i> Monitoring</a></li>
|
||||
<li><a href="{$smarty.server.SCRIPT_NAME}?page=admin&action=settings"><i class="fa fa-gears fa-fw"></i> Settings</a></li>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user