wip
This commit is contained in:
parent
cc4d55288d
commit
e765209ee3
29
zx
29
zx
@ -1151,7 +1151,7 @@ prompt_keygen() ->
|
|||||||
ok = io:format("Bad key name ~tp. Try again.~n", [KeyName]),
|
ok = io:format("Bad key name ~tp. Try again.~n", [KeyName]),
|
||||||
prompt_keygen();
|
prompt_keygen();
|
||||||
{false, false} ->
|
{false, false} ->
|
||||||
ok = io:format("NUTS! Both the key and realm names are illegal. Try again.~n"),
|
ok = io:format("NUTS! Both key and realm names are illegal. Try again.~n"),
|
||||||
prompt_keygen()
|
prompt_keygen()
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -1165,7 +1165,7 @@ create_keypair() ->
|
|||||||
KeyID = prompt_keygen(),
|
KeyID = prompt_keygen(),
|
||||||
case generate_rsa(KeyID) of
|
case generate_rsa(KeyID) of
|
||||||
{ok, _, _} -> halt(0);
|
{ok, _, _} -> halt(0);
|
||||||
Error -> error_exit("create_keypair/0 failed with ~tp", [Error], ?FILE, ?LINE)
|
Error -> error_exit("create_keypair/0 error: ~tp", [Error], ?FILE, ?LINE)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
@ -1406,8 +1406,8 @@ create_realm() ->
|
|||||||
Instructions =
|
Instructions =
|
||||||
"~n"
|
"~n"
|
||||||
" Enter a name for your new realm.~n"
|
" Enter a name for your new realm.~n"
|
||||||
" Valid names can contain only lower-case letters, numbers and the underscore.~n"
|
" Names can contain only lower-case letters, numbers and the underscore.~n"
|
||||||
" Valid names must begin with a lower-case letter.~n",
|
" Names must begin with a lower-case letter.~n",
|
||||||
ok = io:format(Instructions),
|
ok = io:format(Instructions),
|
||||||
Realm = get_input(),
|
Realm = get_input(),
|
||||||
case valid_lower0_9(Realm) of
|
case valid_lower0_9(Realm) of
|
||||||
@ -1440,6 +1440,7 @@ create_realm(Realm) ->
|
|||||||
{error, einval} -> HostString
|
{error, einval} -> HostString
|
||||||
end,
|
end,
|
||||||
PortInstructions =
|
PortInstructions =
|
||||||
|
"~n"
|
||||||
" Enter the port number the host will be listening on.~n"
|
" Enter the port number the host will be listening on.~n"
|
||||||
" The port can be any number from 1 to 65535.~n"
|
" The port can be any number from 1 to 65535.~n"
|
||||||
" [Press enter for the default: 11311]~n",
|
" [Press enter for the default: 11311]~n",
|
||||||
@ -1468,8 +1469,8 @@ create_realm(Realm, Prime) ->
|
|||||||
Instructions =
|
Instructions =
|
||||||
"~n"
|
"~n"
|
||||||
" Enter a username for the realm sysop.~n"
|
" Enter a username for the realm sysop.~n"
|
||||||
" Valid names can contain only lower-case letters, numbers and the underscore.~n"
|
" Names can contain only lower-case letters, numbers and the underscore.~n"
|
||||||
" Valid names must begin with a lower-case letter.~n",
|
" Names must begin with a lower-case letter.~n",
|
||||||
ok = io:format(Instructions),
|
ok = io:format(Instructions),
|
||||||
UserName = get_input(),
|
UserName = get_input(),
|
||||||
case valid_lower0_9(UserName) of
|
case valid_lower0_9(UserName) of
|
||||||
@ -1510,7 +1511,7 @@ create_realm(Realm, Prime, UserName) ->
|
|||||||
create_realm(Realm, Prime, UserName, Email) ->
|
create_realm(Realm, Prime, UserName, Email) ->
|
||||||
Instructions =
|
Instructions =
|
||||||
"~n"
|
"~n"
|
||||||
" Enter the real name (or whatever name people will recognize) for the sysop.~n"
|
" Enter the real name (or whatever name people recognize) for the sysop.~n"
|
||||||
" There are no rules for this one. Any valid UTF-8 printables are legal.~n",
|
" There are no rules for this one. Any valid UTF-8 printables are legal.~n",
|
||||||
ok = io:format(Instructions),
|
ok = io:format(Instructions),
|
||||||
RealName = get_input(),
|
RealName = get_input(),
|
||||||
@ -1531,13 +1532,13 @@ create_realm(Realm, Prime, UserName, Email) ->
|
|||||||
halt(0);
|
halt(0);
|
||||||
false ->
|
false ->
|
||||||
{ok, _} = file:copy(From, To),
|
{ok, _} = file:copy(From, To),
|
||||||
log(info, "Copying ~tp to the local directory", [From])
|
log(info, "Copying to local directory: ~ts", [From])
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
Drop =
|
Drop =
|
||||||
fun(File) ->
|
fun(File) ->
|
||||||
ok = file:delete(File),
|
ok = file:delete(File),
|
||||||
log(info, "Deleting ~tp", [File])
|
log(info, "Deleting ~ts", [File])
|
||||||
end,
|
end,
|
||||||
DangerousKeys = [PackageKey, SysopKey],
|
DangerousKeys = [PackageKey, SysopKey],
|
||||||
ok = lists:foreach(Copy, AllKeys),
|
ok = lists:foreach(Copy, AllKeys),
|
||||||
@ -1546,11 +1547,11 @@ create_realm(Realm, Prime, UserName, Email) ->
|
|||||||
"~n"
|
"~n"
|
||||||
" All of the keys generated have been moved to the current directory.~n"
|
" All of the keys generated have been moved to the current directory.~n"
|
||||||
" MAKE AND SECURELY STORE COPIES OF THESE KEYS.~n"
|
" MAKE AND SECURELY STORE COPIES OF THESE KEYS.~n"
|
||||||
" The private package key and private sysop login key have been deleted from the~n"
|
" The private package and sysop login keys have been deleted from the~n"
|
||||||
" zomp key directory. These should only exist on your local system, not a prime.~n"
|
" key directory. These should only exist on your local system, not a prime.~n"
|
||||||
" realm server (particularly if other services are run on that machine).~n"
|
" realm server (particularly if other services are run on that machine).~n"
|
||||||
" Your package and sysop keys will need to be copied to the ~~/.zomp/keys/~p/~n"
|
" The package and sysop keys will need to be copied to the ~~/.zomp/keys/~p/~n"
|
||||||
" directory on your personal or dev machine.",
|
" directory on your personal or dev machine.~n",
|
||||||
ok = io:format(Message, [Realm]),
|
ok = io:format(Message, [Realm]),
|
||||||
Timestamp = calendar:now_to_universal_time(erlang:timestamp()),
|
Timestamp = calendar:now_to_universal_time(erlang:timestamp()),
|
||||||
UserRecord = {{UserName, Realm}, [SysopPub], Email, RealName, 1, Timestamp},
|
UserRecord = {{UserName, Realm}, [SysopPub], Email, RealName, 1, Timestamp},
|
||||||
@ -1563,7 +1564,7 @@ create_realm(Realm, Prime, UserName, Email) ->
|
|||||||
{sysops, [UserRecord]},
|
{sysops, [UserRecord]},
|
||||||
{realm_keys, [RealmPub]},
|
{realm_keys, [RealmPub]},
|
||||||
{package_keys, [PackagePub]}],
|
{package_keys, [PackagePub]}],
|
||||||
ok = log(info, "Would be writing ~tp", [RealmMeta]),
|
ok = log(info, "Would be writing~n ~tp", [RealmMeta]),
|
||||||
halt(0).
|
halt(0).
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user