diff --git a/.assets/flow-diagram.dot b/.assets/flow-diagram.dot new file mode 100644 index 0000000..eb95f9c --- /dev/null +++ b/.assets/flow-diagram.dot @@ -0,0 +1,65 @@ +digraph { + rankdir=LR; + layout=dot; + node[shape=record]; + + start[label="ssh sshportal";color=blue;fontcolor=blue;fontsize=20]; + + subgraph cluster_sshportal { + graph[fontsize=20;style=dashed;color=purple;fontcolor=purple]; + label="sshportal"; + { + node[color=darkorange;fontcolor=darkorange]; + known_user_key[label="known user key"]; + unknown_user_key[label="unknown user key"]; + invite_manager[label="invite manager"]; + acl_manager[label="ACL manager"]; + } + { + node[color=darkgreen;fontcolor=darkgreen]; + builtin_shell[label="built-in shell"]; + ssh_proxy[label="SSH proxy"]; + learn_key[label="learn key"]; + } + err_and_exit[label="error and exit";color=red;fontcolor=red]; + { rank=same; ssh_proxy; builtin_shell; learn_key; err_and_exit; } + { rank=same; known_user_key; unknown_user_key; } + } + + subgraph cluster_hosts { + label="your hosts"; + graph[fontsize=20;style=dashed;color=purple;fontcolor=purple]; + node[color=blue;fontcolor=blue]; + + host_1[label="root@host1"]; + host_2[label="user@host2:2222"]; + host_3[label="root@host3:1234"]; + } + + { + edge[color=blue]; + start -> known_user_key; + start -> unknown_user_key; + ssh_proxy -> host_1; + ssh_proxy -> host_2; + ssh_proxy -> host_3; + } + { + edge[color=darkgreen;fontcolor=darkgreen]; + known_user_key -> builtin_shell[label="user=admin"]; + acl_manager -> ssh_proxy[label="authorized"]; + invite_manager -> learn_key[label="valid token"]; + } + { + edge[color=darkorange;fontcolor=darkorange]; + known_user_key -> acl_manager[label="user matches an existing host"]; + unknown_user_key -> invite_manager[headlabel="user=invite:"]; + } + { + edge[color=red;fontcolor=red]; + known_user_key -> err_and_exit[label="invalid user"]; + acl_manager -> err_and_exit[label="unauthorized"]; + unknown_user_key -> err_and_exit[label="any other user"]; + invite_manager -> err_and_exit[label="invalid token"]; + } +} \ No newline at end of file diff --git a/.assets/flow-diagram.svg b/.assets/flow-diagram.svg new file mode 100644 index 0000000..89298fd --- /dev/null +++ b/.assets/flow-diagram.svg @@ -0,0 +1,188 @@ + + + + + + +%3 + + +cluster_sshportal + +sshportal + + +cluster_hosts + +your hosts + + + +start + +ssh sshportal + + + +known_user_key + +known user key + + + +start->known_user_key + + + + + +unknown_user_key + +unknown user key + + + +start->unknown_user_key + + + + + +acl_manager + +ACL manager + + + +known_user_key->acl_manager + + +user matches an existing host + + + +builtin_shell + +built-in shell + + + +known_user_key->builtin_shell + + +user=admin + + + +err_and_exit + +error and exit + + + +known_user_key->err_and_exit + + +invalid user + + + +invite_manager + +invite manager + + + +unknown_user_key->invite_manager + + +user=invite:<token> + + + +unknown_user_key->err_and_exit + + +any other user + + + +learn_key + +learn key + + + +invite_manager->learn_key + + +valid token + + + +invite_manager->err_and_exit + + +invalid token + + + +ssh_proxy + +SSH proxy + + + +acl_manager->ssh_proxy + + +authorized + + + +acl_manager->err_and_exit + + +unauthorized + + + +host_1 + +root@host1 + + + +ssh_proxy->host_1 + + + + + +host_2 + +user@host2:2222 + + + +ssh_proxy->host_2 + + + + + +host_3 + +root@host3:1234 + + + +ssh_proxy->host_3 + + + + + diff --git a/Makefile b/Makefile index df9c077..b3a36a6 100644 --- a/Makefile +++ b/Makefile @@ -44,3 +44,4 @@ backup: doc: dot -Tsvg ./.assets/overview.dot > ./.assets/overview.svg dot -Tsvg ./.assets/cluster-mysql.dot > ./.assets/cluster-mysql.svg + dot -Tsvg ./.assets/flow-diagram.dot > ./.assets/flow-diagram.svg diff --git a/README.md b/README.md index 473511e..fb43d50 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,11 @@ To associate this account with a key, use the following SSH user: 'invite:NfHK5a config> ``` -## CLI +## Flow Diagram + +![Flow Diagram](https://raw.github.com/moul/sshportal/master/.assets/flow-diagram.svg?sanitize=true) + +## built-in shell `sshportal` embeds a configuration CLI.