Skip to content
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

Ported rncp allow files to rnx #599

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion RNS/Utilities/rnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,25 @@ def listen(configdir, identitypath = None, verbosity = 0, quietness = 0, allowed
except Exception as e:
print(str(e))
exit(1)

try:
allowed_file_name = "allowed_identities"
allowed_file = None
if os.path.isfile(os.path.expanduser("/etc/rnx/"+allowed_file_name)):
allowed_file = os.path.expanduser("/etc/rnx/"+allowed_file_name)
elif os.path.isfile(os.path.expanduser("~/.config/rnx/"+allowed_file_name)):
allowed_file = os.path.expanduser("~/.config/rnx/"+allowed_file_name)
elif os.path.isfile(os.path.expanduser("~/.rnx/"+allowed_file_name)):
allowed_file = os.path.expanduser("~/.rnx/"+allowed_file_name)
if allowed_file != None:
with open(allowed_file, "r") as af_handle:
allowed_by_file = af_handle.read().replace("\r", "").split("\n")
for allowed_ID in allowed_by_file:
if len(allowed_ID) == (RNS.Reticulum.TRUNCATED_HASHLENGTH//8)*2:
allowed_identity_hashes.append(bytes.fromhex(allowed_ID))
except Exception as e:
print(str(e))
exit(1)

if len(allowed_identity_hashes) < 1 and not disable_auth:
print("Warning: No allowed identities configured, rncx will not accept any commands!")

Expand Down
Loading