Check for secure mode when getting instance actor key

main
Bob Mottram 2021-09-08 13:07:57 +01:00
parent ac128bb122
commit 26d71b9332
1 changed files with 108 additions and 36 deletions

View File

@ -690,6 +690,8 @@ if args.posts:
proxyType = 'gnunet'
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
getPublicPostsOfPerson(baseDir, nickname, domain, False, True,
proxyType, args.port, httpPrefix, debug,
@ -726,6 +728,8 @@ if args.postDomains:
domainList = []
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
domainList = getPublicPostDomains(None,
baseDir, nickname, domain,
@ -771,6 +775,8 @@ if args.postDomainsBlocked:
domainList = []
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
domainList = getPublicPostDomainsBlocked(None,
baseDir, nickname, domain,
@ -814,6 +820,8 @@ if args.checkDomains:
maxBlockedDomains = 0
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
checkDomains(None,
baseDir, nickname, domain,
@ -837,6 +845,8 @@ if args.socnet:
args.language = 'en'
if not args.domain:
args.domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, args.domain)
dotGraph = instancesGraph(baseDir, args.socnet,
proxyType, args.port,
@ -868,6 +878,8 @@ if args.postsraw:
proxyType = 'gnunet'
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
getPublicPostsOfPerson(baseDir, nickname, domain, False, False,
proxyType, args.port, httpPrefix, debug,
@ -883,6 +895,8 @@ if args.json:
}
if not args.domain:
args.domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, args.domain)
if debug:
print('baseDir: ' + str(baseDir))
@ -1102,6 +1116,8 @@ if args.approve:
personCache = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
manualApproveFollowRequest(session, baseDir,
httpPrefix,
@ -1128,6 +1144,8 @@ if args.deny:
personCache = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
manualDenyFollowRequest(session, baseDir,
httpPrefix,
@ -1219,6 +1237,8 @@ if args.message:
isArticle = False
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending post to ' + args.sendto)
@ -1254,6 +1274,8 @@ if args.announce:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending announce/repeat of ' + args.announce)
@ -1296,6 +1318,8 @@ if args.box:
proxyType = 'gnunet'
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
session = createSession(proxyType)
@ -1355,6 +1379,8 @@ if args.itemName:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending shared item: ' + args.itemName)
@ -1396,6 +1422,8 @@ if args.undoItemName:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending undo of shared item: ' + args.undoItemName)
@ -1456,6 +1484,8 @@ if args.wantedItemName:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending wanted item: ' + args.wantedItemName)
@ -1497,6 +1527,8 @@ if args.undoWantedItemName:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending undo of wanted item: ' + args.undoWantedItemName)
@ -1529,6 +1561,8 @@ if args.like:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending like of ' + args.like)
@ -1560,6 +1594,8 @@ if args.undolike:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending undo like of ' + args.undolike)
@ -1592,6 +1628,8 @@ if args.bookmark:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending bookmark of ' + args.bookmark)
@ -1624,6 +1662,8 @@ if args.unbookmark:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending undo bookmark of ' + args.unbookmark)
@ -1655,6 +1695,8 @@ if args.delete:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending delete request of ' + args.delete)
@ -1698,6 +1740,8 @@ if args.follow:
followHttpPrefix = 'https'
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
sendFollowRequestViaServer(baseDir, session,
@ -1742,6 +1786,8 @@ if args.unfollow:
followHttpPrefix = 'https'
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
sendUnfollowRequestViaServer(baseDir, session,
@ -1775,6 +1821,8 @@ if args.followingList:
followHttpPrefix = httpPrefix
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
followingJson = \
@ -1806,6 +1854,8 @@ if args.followersList:
followHttpPrefix = httpPrefix
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
followersJson = \
@ -1838,6 +1888,8 @@ if args.followRequestsList:
followHttpPrefix = httpPrefix
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
followRequestsJson = \
@ -1888,6 +1940,8 @@ if args.migrations:
session = createSession(proxyType)
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
ctr = migrateAccounts(baseDir, session,
httpPrefix, cachedWebfingers,
@ -1901,6 +1955,8 @@ if args.migrations:
if args.actor:
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
if debug:
print('baseDir: ' + str(baseDir))
@ -1985,6 +2041,8 @@ if args.followers:
nickname = domain
handle = nickname + '@' + domain
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
wfRequest = webfingerHandle(session, handle,
httpPrefix, cachedWebfingers,
@ -2031,6 +2089,8 @@ if args.followers:
asHeader = {
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
followersList = \
downloadFollowCollection(signingPrivateKeyPem,
@ -2286,6 +2346,8 @@ if args.skill:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending ' + args.skill + ' skill level ' +
str(args.skillLevelPercent) + ' for ' + nickname)
@ -2319,6 +2381,8 @@ if args.availability:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending availability status of ' + nickname +
' as ' + args.availability)
@ -2431,6 +2495,8 @@ if args.block:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending block of ' + args.block)
@ -2461,6 +2527,8 @@ if args.mute:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending mute of ' + args.mute)
@ -2491,6 +2559,8 @@ if args.unmute:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending undo mute of ' + args.unmute)
@ -2533,6 +2603,8 @@ if args.unblock:
cachedWebfingers = {}
if not domain:
domain = getConfigParam(baseDir, 'domain')
signingPrivateKeyPem = None
if args.secureMode:
signingPrivateKeyPem = getInstanceActorKey(baseDir, domain)
print('Sending undo block of ' + args.unblock)