InitStratumAllowList only works with single IP #270

Closed
opened 1 year ago by fekt · 4 comments
fekt commented 1 year ago
Collaborator

User reported stratum no longer works in 3.9.3. I did some testing and it appears to only work when specifying a single IP now. CIDR and netmask don't seem to work. There were some changes to this function in BIP155 PR:
5184b4483f/src/stratum.cpp (L114)

I usually start stratum like this:
./hushd -stratum -stratumallowip=192.168.1.0/24 -stratumaddress=taddr -debug=stratum

I get Rejected connection from disallowed subnet: 192.168.1.103 in debug.log, even though the IP connecting is within range.
https://git.hush.is/hush/hush3/src/branch/master/src/stratum.cpp#L1560

Setting -stratumallowip=192.168.1.0/255.255.255.0 has the same result. Setting to a single IP works fine. Not setting -stratumallowip allows no connections except maybe from the local machine.

User reported stratum no longer works in 3.9.3. I did some testing and it appears to only work when specifying a single IP now. CIDR and netmask don't seem to work. There were some changes to this function in BIP155 PR: https://git.hush.is/hush/hush3/src/commit/5184b4483fc57f64af9fd0d08487a37d1182f52d/src/stratum.cpp#L114 I usually start stratum like this: `./hushd -stratum -stratumallowip=192.168.1.0/24 -stratumaddress=taddr -debug=stratum` I get `Rejected connection from disallowed subnet: 192.168.1.103` in debug.log, even though the IP connecting is within range. https://git.hush.is/hush/hush3/src/branch/master/src/stratum.cpp#L1560 Setting `-stratumallowip=192.168.1.0/255.255.255.0` has the same result. Setting to a single IP works fine. Not setting -stratumallowip allows no connections except maybe from the local machine.
fekt commented 1 year ago
Poster
Collaborator

I think the problem may be with this:
LookupHost(strAllow.c_str(), netaddr, false);

LookupHost seems to expect a single IP, not a CIDR or netmask range. I am testing reverting back to how it was with CSubNet subnet(strAllow);

I think the problem may be with this: `LookupHost(strAllow.c_str(), netaddr, false);` LookupHost seems to expect a single IP, not a CIDR or netmask range. I am testing reverting back to how it was with `CSubNet subnet(strAllow);`
fekt referenced this issue from a commit 1 year ago
fekt commented 1 year ago
Poster
Collaborator

Reverting old code didn't compile but found there was LookupSubNet that seems to work as expected. This worked with single IP, CIDR, and netmask when I tested, while rejecting IPs out of range. Others may want to test though.

Committed to dev branch: 883e598994

Reverting old code didn't compile but found there was `LookupSubNet` that seems to work as expected. This worked with single IP, CIDR, and netmask when I tested, while rejecting IPs out of range. Others may want to test though. Committed to dev branch: https://git.hush.is/hush/hush3/commit/883e598994d84b5649bbb6ba70a8b6622a426cde
duke commented 1 year ago
Owner

@fekt thanks for fixing this

@fekt thanks for fixing this
duke commented 1 year ago
Owner

Just wanted to comment here that one possible workaround is specifying -stratumallowip multiple times instead of using a netmask.

Fixed on dev, closing

Just wanted to comment here that one possible workaround is specifying `-stratumallowip` multiple times instead of using a netmask. Fixed on dev, closing
duke closed this issue 1 year ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.