-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
339 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
Oops, something went wrong.