Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
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
36 changes: 30 additions & 6 deletions nminit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import glob

import optparse
# embedded here. Is this really the right thing to do?
justinpubkey = {'e':22599311712094481841033180665237806588790054310631222126405381271924089573908627143292516781530652411806621379822579071415593657088637116149593337977245852950266439908269276789889378874571884748852746045643368058107460021117918657542413076791486130091963112612854591789518690856746757312472362332259277422867, 'n':12178066700672820207562107598028055819349361776558374610887354870455226150556699526375464863913750313427968362621410763996856543211502978012978982095721782038963923296750730921093699612004441897097001474531375768746287550135361393961995082362503104883364653410631228896653666456463100850609343988203007196015297634940347643303507210312220744678194150286966282701307645064974676316167089003178325518359863344277814551559197474590483044733574329925947570794508677779986459413166439000241765225023677767754555282196241915500996842713511830954353475439209109249856644278745081047029879999022462230957427158692886317487753201883260626152112524674984510719269715422340038620826684431748131325669940064404757120601727362881317222699393408097596981355810257955915922792648825991943804005848347665699744316223963851263851853483335699321871483966176480839293125413057603561724598227617736944260269994111610286827287926594015501020767105358832476708899657514473423153377514660641699383445065369199724043380072146246537039577390659243640710339329506620575034175016766639538091937167987100329247642670588246573895990251211721839517713790413170646177246216366029853604031421932123167115444834908424556992662935981166395451031277981021820123445253}

Expand Down Expand Up @@ -73,8 +74,8 @@


# This is the public key of the person who will control most of the resources.
controllerpubkey = {'e': 1515278400394037168869631887206225761783197636247636149274740854708478416229147500580877416652289990968676310353790883501744269103521055894342395180721167L, 'n': 8811850224687278929671477591179591903829730117649785862652866020803862826558480006479605958786097112503418194852731900367494958963787480076175614578652735061071079458992502737148356289391380249696938882025028801032667062564713111819847043202173425187133883586347323838509679062142786013585264788548556099117804213139295498187634341184917970175566549405203725955179602584979965820196023950630399933075080549044334508921319264315718790337460536601263126663173385674250739895046814277313031265034275415434440823182691254039184953842629364697394327806074576199279943114384828602178957150547925812518281418481896604655037L}

#controllerpubkey = {'e': 1515278400394037168869631887206225761783197636247636149274740854708478416229147500580877416652289990968676310353790883501744269103521055894342395180721167L, 'n': 8811850224687278929671477591179591903829730117649785862652866020803862826558480006479605958786097112503418194852731900367494958963787480076175614578652735061071079458992502737148356289391380249696938882025028801032667062564713111819847043202173425187133883586347323838509679062142786013585264788548556099117804213139295498187634341184917970175566549405203725955179602584979965820196023950630399933075080549044334508921319264315718790337460536601263126663173385674250739895046814277313031265034275415434440823182691254039184953842629364697394327806074576199279943114384828602178957150547925812518281418481896604655037L}
controllerpubkey = {}


offcutresourcedata ="""# BUG: How do we come up with these values dynamically?
Expand Down Expand Up @@ -292,7 +293,7 @@ def initialize_state():

# NOTE: I chose these randomly (they will be uniform across all NMs)...
# Was this wise?
configuration['ports'] = [<nodemanager_port>, 2888, 9625, 10348, 39303, 48126, 52862, 57344, 64310]
configuration['ports'] = [2888, 9625, 10348, 39303, 48126, 52862, 57344, 64310]

print "Generating key..."
keys = rsa_gen_pubpriv_keys(100)
Expand Down Expand Up @@ -328,8 +329,31 @@ def initialize_state():
# write out the vessel dictionary...
persist.commit_object(vesseldict,"vesseldict")



def main():
# Parse the options provided.
helpstring = "python nminit.py [-s] <controllerpubkey>"
parser = optparse.OptionParser(usage=helpstring)

parser.add_option("-s", "--specifyfiles", action = "store_true",
dest="specify_files", default=False,
help="specifying the files from which public keys should be read")

(options, args) = parser.parse_args()
if len(args) == 1:
controllerpubkeypath = os.path.realpath(args[0])
else:
print "Please input user public key"+" <usage> "+helpstring
return 0

#Set variables according to the provided options.
specify = options.specify_files

if specify:
controllerpubkey = rsa_file_to_publickey(controllerpubkeypath)
else:
print helpstring
return 0
initialize_state()



Expand All @@ -338,4 +362,4 @@ def initialize_state():


if __name__ == '__main__':
initialize_state()
main()