Security hardening, multi-site portability, and a documentation and API-surface sweep
This commit is contained in:
@@ -19,14 +19,17 @@ import json
|
||||
|
||||
from . import ntlars as ntlarscodec
|
||||
|
||||
# Default root of the opaque-backup tree on the SFLD share. Connected PCs write
|
||||
# here directly (they need SFLD creds - a SYSTEM process hitting a UNC path
|
||||
# Root of the opaque-backup tree on the site's file share. Connected PCs write
|
||||
# here directly (they need share creds - a SYSTEM process hitting a UNC path
|
||||
# without them gets an access-denied that Test-Path reports as "not found").
|
||||
#
|
||||
# This is the WEST JEFFERSON path and is only a DEFAULT: the live value is the
|
||||
# backups_shareroot setting, because a bundled plugin in a multi-site product
|
||||
# must not hardcode one site's file server.
|
||||
DEFAULTSHAREROOT = r'\\tsgwp00525.wjs.geaerospace.net\shared\dt\shopfloor\backups'
|
||||
# EMPTY BY DESIGN (ADR-015). This used to ship one site's own file server
|
||||
# as the default, which put one site's internal topology in a bundled plugin and
|
||||
# in the public mirror, and silently pointed a second site at a server it cannot
|
||||
# reach. The live value is the backups_shareroot setting; unset, the share kinds
|
||||
# have no conventional location to offer and say so rather than composing a path
|
||||
# from somebody else's hostname.
|
||||
DEFAULTSHAREROOT = ''
|
||||
|
||||
|
||||
def canonicalhash(projection):
|
||||
@@ -150,10 +153,16 @@ class BackupKind:
|
||||
Advisory only - the authoritative path is the sharepath the collector
|
||||
reports, since the PC is what actually wrote the file. This builds the
|
||||
conventional location for display and for validating a reported path.
|
||||
|
||||
Returns '' when no share root is configured. A path built on an empty
|
||||
root is not a lesser answer, it is a wrong one - it would render as a
|
||||
relative path and validate a reported path against nothing.
|
||||
"""
|
||||
root = shareroot or DEFAULTSHAREROOT
|
||||
if not root:
|
||||
return ''
|
||||
return '{}\\{}\\{}\\{}'.format(
|
||||
shareroot or DEFAULTSHAREROOT,
|
||||
machinetype or 'unknown', identifier or 'unknown', self.key)
|
||||
root, machinetype or 'unknown', identifier or 'unknown', self.key)
|
||||
|
||||
|
||||
class NtlarsKind(BackupKind):
|
||||
|
||||
Reference in New Issue
Block a user