bumped network version and main version, lots of test work and some stability improvements
This commit is contained in:
parent
e77d422fc2
commit
572e29f5d5
24 changed files with 243 additions and 33 deletions
|
@ -11,6 +11,7 @@ from . import uicheck, inserttest, stresstest
|
|||
from . import ownnode
|
||||
from .webpasstest import webpass_test
|
||||
from .osver import test_os_ver_endpoint
|
||||
from .clearnettor import test_clearnet_tor_request
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,7 +33,8 @@ RUN_TESTS = [uicheck.check_ui,
|
|||
ownnode.test_own_node,
|
||||
stresstest.stress_test_block_insert,
|
||||
webpass_test,
|
||||
test_os_ver_endpoint
|
||||
test_os_ver_endpoint,
|
||||
test_clearnet_tor_request
|
||||
]
|
||||
|
||||
SUCCESS_FILE = os.path.dirname(os.path.realpath(__file__)) + '/../../tests/runtime-result.txt'
|
||||
|
|
61
src/runtests/clearnettor.py
Normal file
61
src/runtests/clearnettor.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
"""Onionr - Private P2P Communication.
|
||||
|
||||
Ensure that clearnet cannot be reached
|
||||
"""
|
||||
from threading import Thread
|
||||
|
||||
from onionrutils.basicrequests import do_get_request
|
||||
from onionrutils import localcommand
|
||||
import logger
|
||||
import config
|
||||
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
|
||||
def test_clearnet_tor_request(testmanager):
|
||||
"""Ensure that Tor cannot request clearnet address.
|
||||
|
||||
Does not run if Tor is being reused
|
||||
"""
|
||||
|
||||
config.reload()
|
||||
leak_result = ""
|
||||
|
||||
if config.get('tor.use_existing_tor', False):
|
||||
logger.warn(
|
||||
"Can't ensure Tor reqs to clearnet won't happen when reusing Tor")
|
||||
return
|
||||
|
||||
|
||||
socks_port = localcommand.local_command('/gettorsocks')
|
||||
|
||||
# Don't worry, this request isn't meant to go through,
|
||||
# but if it did it would be through Tor
|
||||
|
||||
try:
|
||||
leak_result: str = do_get_request(
|
||||
'https://onionr.net/404',
|
||||
port=socks_port, ignoreAPI=True).lower()
|
||||
except AttributeError:
|
||||
leak_result = ""
|
||||
except Exception as e:
|
||||
logger.warn(str(e))
|
||||
try:
|
||||
if 'not found' in leak_result:
|
||||
logger.error('Tor was able to request a clearnet site')
|
||||
raise ValueError('Tor was able to request a clearnet site')
|
||||
except TypeError:
|
||||
pass
|
|
@ -11,7 +11,7 @@ def _check_remote_node(testmanager):
|
|||
|
||||
def insert_bin_test(testmanager):
|
||||
data = os.urandom(32)
|
||||
b_hash = onionrblocks.insert(data, )
|
||||
b_hash = onionrblocks.insert(data)
|
||||
|
||||
if not b_hash in coredb.blockmetadb.get_block_list():
|
||||
logger.error(str(b_hash) + 'is not in bl')
|
||||
|
|
|
@ -25,14 +25,16 @@ from onionrutils import localcommand
|
|||
|
||||
|
||||
def test_own_node(test_manager):
|
||||
return
|
||||
socks_port = localcommand.local_command('/gettorsocks')
|
||||
if config.get('general.security_level', 0) > 0:
|
||||
return
|
||||
own_tor_address = gettransports.get()[0]
|
||||
if 'this is an onionr node' \
|
||||
not in basicrequests.do_get_request('http://' + own_tor_address,
|
||||
port=socks_port, ignoreAPI=True).lower():
|
||||
logger.warn('Own node not reachable in test')
|
||||
port=socks_port,
|
||||
ignoreAPI=True).lower():
|
||||
logger.warn(f'Own node not reachable in test {own_tor_address}')
|
||||
raise ValueError
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue