-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stakepoold access to MySQL db data without needing to provide MySQL connection params on all stakepoold instances #495
Comments
Might as well move to boltdb then. |
As mentioned on matrix, supplying config through RPC will always get a firm No from me. Servers should be able to run in isolation and should not depend on config values being passed in via RPC from another server. |
The data I'm proposing to supply through RPC are not config values, they're actually currently being passed via RPC when the data changes in the database, but not when dcrstakepool starts up. dcrstakepool/controllers/main.go Line 509 in 625bcd2
dcrstakepool/controllers/main.go Line 528 in 625bcd2
|
I agree with @itswisdomagain This is a good idea. We don't have to expose the db, and it simplifies things. It paves the way for maybe a db change in the future. |
@jholdstock what's your thought on this? I agree with @JoeGruffins that we could just use the opportunity to migrate away from postgres. |
Based on recent conversation on matrix, particularly @jholdstock's message here, it makes sense to continue to allow stakepoold direct access to MySQL, to enable stakepoold run as independently from dcrstakepool as possible. |
I'm surprised we're changing course from this and #134. The matrix link isn't working so I don't know what was discussed. |
stakepoold will never run independently of dcrstakepool, but it can be made to run without connecting to the MySQL server, which only dcrstakepool should talk to. |
After accessing the matrix chat from then, my takeaways are:
What other solutions would allow a stakepoold/dcrwallet instance to run without having it configured in dcrstakepool? |
I just want to give some information about the current structure of dcrstakepool and the complications of running all data through dcrstakepool as appose to having stakepoold fetch their own data. Currently stakepoold need information in the sql database to function. That data is user voting configurations, to vote properly, and redeem scripts to check that wallet has what it needs to vote. There are two ways in which stakepoold can optain this information: stakepoold === mysql or: Point 1: Point 2: Another rpc server could be added to dcrstakepool to alleviate this, but that opens another port on dcrstakepool, and complicates the work flow. Point 3: Point 4: Point 5: |
I agree with @chappjc. We do not want stakepoold to connect directly to the db. The question of whether or not to allow stakepoold run independently of dcrstakepool is also very valid. Consider this scenario: Agreed, stakepoold (in independent mode), periodically queries the db for updates but why shouldn't it just open up a gRPC port to get updates from dcrstakepool realtime? On the other hand, it makes sense to be able to startup stakepoold if there's no actively running dcrstakepool instance (but why wouldn't there be though?). Having stakepoold able to vote on user prefs stored in the db makes sense in this scenario. In any case, even if we decide to allow independent stakepoold runs, it still will be preferred to give stakepoold read-only access to the data it needs, rather than direct access to the database. I do feel the following flow would be better:
|
Is the specific security issue that if any one stakepoold were compromised an attacker would have write permissions to the database? If so could giving stakepoold a read-only db user be viable solution? |
Currently, stakepoold accesses the MySQL db running on the dcrstakepool web server to read user voting preferences and added low fee tickets. This db read op is performed on 2 occasions: when stakepoold starts up and every couple minutes (if stakepoold gRPC server is disabled).
Assuming that stakepoold gRPC server is enabled (shouldn't it always?), we can add a stakepoold gRPC method to supply the above data to all connected stakepoold backends when dcrstakepool starts.
This has the advantage of not needlessly exposing the MySQL db to external IPs (considering that the db would typically sit on the web server, can just keep access to the db local to the running dcrstakepool instance).
It also simplifies the process for setting up a vsp, as vsp admins would have 4 fewer stakepoold config fields to worry about when setting up their backends.
PS: The implication is that the stakepoold
norpclisten
config option will have to be deprecated.dcrstakepool
will currently not even start if the stakepoold backends do not have their rpc servers enabled.The text was updated successfully, but these errors were encountered: