mirror of
https://github.com/jtesta/ssh-audit.git
synced 2025-07-15 05:02:17 +02:00
Now prints a more user-friendly error message when installed as a Snap package and permission errors are encountered. Updated the Snap build process as well.
This commit is contained in:
@ -30,6 +30,7 @@ from datetime import date
|
||||
from ssh_audit import exitcodes
|
||||
from ssh_audit.ssh2_kex import SSH2_Kex # pylint: disable=unused-import
|
||||
from ssh_audit.banner import Banner # pylint: disable=unused-import
|
||||
from ssh_audit.globals import SNAP_PACKAGE, SNAP_PERMISSIONS_ERROR
|
||||
|
||||
|
||||
# Validates policy files and performs policy testing
|
||||
@ -122,6 +123,13 @@ class Policy:
|
||||
except FileNotFoundError:
|
||||
print("Error: policy file not found: %s" % policy_file)
|
||||
sys.exit(exitcodes.UNKNOWN_ERROR)
|
||||
except PermissionError as e:
|
||||
# If installed as a Snap package, print a more useful message with potential work-arounds.
|
||||
if SNAP_PACKAGE:
|
||||
print(SNAP_PERMISSIONS_ERROR)
|
||||
else:
|
||||
print("Error: insufficient permissions: %s" % str(e))
|
||||
sys.exit(exitcodes.UNKNOWN_ERROR)
|
||||
|
||||
lines = []
|
||||
if policy_data is not None:
|
||||
|
Reference in New Issue
Block a user