Skip to content

Commit

Permalink
Merge pull request #8968 from u3s/kuba/ssh/server_supervision_tree_ls…
Browse files Browse the repository at this point in the history
…ocket_sup

kuba/ssh/server supervision tree lsocket sup
OTP-19324
  • Loading branch information
u3s authored Oct 25, 2024
2 parents 2164367 + 293f777 commit 783478e
Show file tree
Hide file tree
Showing 18 changed files with 707 additions and 398 deletions.
108 changes: 73 additions & 35 deletions lib/ssh/internal_doc/ssh_notes.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,73 @@
# SSH supervision tree (prototype)
# SSH supervision tree (server side update >= OTP-28)
```mermaid
---
title: SSH supervision tree (prototype)
title: SSH supervision tree
---
flowchart RL
d_sup --> sup[["ssh_sup\n(ssh_app.erl)\n[o4o]"]]
d_sup --> sup[["ssh_sup<br />(ssh_app.erl)<br />[o4o]"]]
c_sup --> sup
subgraph client
connection_sup --> c_sup[["sshc_sup\n(ssh_app.erl)\n[o4o]\nauto_shutdown=never"]]
connection_sup --> c_sup[["sshc_sup<br />(ssh_app.erl)<br />[o4o]<br />auto_shutdown=never"]]
subgraph connection_c
connection_handler["ssh_connection_handler\nSIGNIFICANT"] --> connection_sup[["ssh_connection_sup\n[o4a]\nauto_shutdown=any_significant"]]
channel_sup[["ssh_channel_sup\n[o4o]"]] --> connection_sup
connection_handler["ssh_connection_handler<br />SIGNIFICANT"] --> connection_sup[["ssh_connection_sup<br />[o4a]<br />auto_shutdown=any_significant"]]
channel_sup[["ssh_channel_sup<br />[o4o]"]] --> connection_sup
sftp["ssh_sftp"] --> channel_sup
tcpip_forward_acceptor_sup[["ssh_tcpip_forward_acceptor_sup\n[o4o]"]] --> connection_sup
tcpip_forward_acceptor_sup[["ssh_tcpip_forward_acceptor_sup<br />[o4o]"]] --> connection_sup
ssh_tcpip_forward_acceptor["ssh_tcpip_forward_acceptor"] --> tcpip_forward_acceptor_sup
end
end
subgraph server
lsocket_sup[["ssh_lsocket_sup<br />[simple_one_for_one]"]] --> d_sup
ssh_lsocket_provider --> lsocket_sup
system_sup_s --> d_sup[["sshd_sup<br />(ssh_app.erl)<br />[o4o]"]]
acceptor_sup --> system_sup_s[["ssh_system_sup<br />[o4o]<br />auto_shutdown=all_significant"]]
acceptor["ssh_acceptor"] --> acceptor_sup[["ssh_acceptor_sup<br />[o4o?]<br />SIGNIFICANT"]]
connection_sup_s --> system_sup_s
subgraph connection_s
connection_handler_s["ssh_connection_handler<br />SIGNIFICANT"] --> connection_sup_s[["ssh_connection_sup<br />[o4a]<br />auto_shutdown=any_significant<br />SIGNIFICANT"]]
channel_sup_s[["ssh_channel_sup<br />[o4o]"]] --> connection_sup_s
tcpip_forward_acceptor_sup_s[["ssh_tcpip_forward_acceptor_sup<br />[o4o]"]] --> connection_sup_s
ssh_tcpip_forward_acceptor_s["ssh_tcpip_forward_acceptor"] --> tcpip_forward_acceptor_sup_s
sftd1["ssh_sftpd"] --> channel_sup_s
end
end
```

# SSH supervision tree (client side update since ssh-5.2.3, ssh-5.1.4.3, ssh-4.15.3.7)
```mermaid
---
title: SSH supervision tree
---
flowchart RL
d_sup --> sup[["ssh_sup<br />(ssh_app.erl)<br />[o4o]"]]
c_sup --> sup
subgraph client
connection_sup --> c_sup[["sshc_sup<br />(ssh_app.erl)<br />[o4o]<br />auto_shutdown=never"]]
subgraph connection_c
connection_handler["ssh_connection_handler<br />SIGNIFICANT"] --> connection_sup[["ssh_connection_sup<br />[o4a]<br />auto_shutdown=any_significant"]]
channel_sup[["ssh_channel_sup<br />[o4o]"]] --> connection_sup
sftp["ssh_sftp"] --> channel_sup
tcpip_forward_acceptor_sup[["ssh_tcpip_forward_acceptor_sup<br />[o4o]"]] --> connection_sup
ssh_tcpip_forward_acceptor["ssh_tcpip_forward_acceptor"] --> tcpip_forward_acceptor_sup
end
end
subgraph server
system_sup_s --> d_sup[["sshd_sup\n(ssh_app.erl)\n[o4o]"]]
acceptor_sup --> system_sup_s[["ssh_system_sup\n[o4o]\nauto_shutdown=all_significant"]]
acceptor["ssh_acceptor"] --> acceptor_sup[["ssh_acceptor_sup\n[o4o]\nSIGNIFICANT"]]
system_sup_s --> d_sup[["sshd_sup<br />(ssh_app.erl)<br />[o4o]"]]
acceptor_sup --> system_sup_s[["ssh_system_sup<br />[o4o]<br />auto_shutdown=all_significant"]]
acceptor["ssh_acceptor"] --> acceptor_sup[["ssh_acceptor_sup<br />[o4o]<br />SIGNIFICANT"]]
connection_sup_s --> system_sup_s
subgraph connection_s
connection_handler_s["ssh_connection_handler\nSIGNIFICANT"] --> connection_sup_s[["ssh_connection_sup\n[o4a]\nauto_shutdown=any_significant\nSIGNIFICANT"]]
channel_sup_s[["ssh_channel_sup\n[o4o]"]] --> connection_sup_s
tcpip_forward_acceptor_sup_s[["ssh_tcpip_forward_acceptor_sup\n[o4o]"]] --> connection_sup_s
connection_handler_s["ssh_connection_handler<br />SIGNIFICANT"] --> connection_sup_s[["ssh_connection_sup<br />[o4a]<br />auto_shutdown=any_significant<br />SIGNIFICANT"]]
channel_sup_s[["ssh_channel_sup<br />[o4o]"]] --> connection_sup_s
tcpip_forward_acceptor_sup_s[["ssh_tcpip_forward_acceptor_sup<br />[o4o]"]] --> connection_sup_s
ssh_tcpip_forward_acceptor_s["ssh_tcpip_forward_acceptor"] --> tcpip_forward_acceptor_sup_s
sftd1["ssh_sftpd"] --> channel_sup_s
end
Expand All @@ -41,33 +80,32 @@ flowchart RL
title: SSH supervision tree (OTP >= 24)
---
flowchart RL
d_sup --> sup[["ssh_sup\n(ssh_app.erl)\n[o4o]"]]
d_sup --> sup[["ssh_sup<br />(ssh_app.erl)<br />[o4o]"]]
c_sup --> sup
subgraph client
system_sup --> c_sup[["sshc_sup\n(ssh_app.erl)\n[o4o]\nauto_shutdown=never"]]
system_sup --> c_sup[["sshc_sup<br />(ssh_app.erl)<br />[o4o]<br />auto_shutdown=never"]]
subgraph connection_c
subsystem_sup --> system_sup[["ssh_system_sup\n[o4o]\nauto_shutdown=all_significant"]]
connection_handler["ssh_connection_handler\nSIGNIFICANT"] --> subsystem_sup[["ssh_subsystem_sup\n[o4a]\nauto_shutdown=any_significant\nSIGNIFICANT"]]
channel_sup[["ssh_channel_sup\n[o4o]"]] --> subsystem_sup
subsystem_sup --> system_sup[["ssh_system_sup<br />[o4o]<br />auto_shutdown=all_significant"]]
connection_handler["ssh_connection_handler<br />SIGNIFICANT"] --> subsystem_sup[["ssh_subsystem_sup<br />[o4a]<br />auto_shutdown=any_significant<br />SIGNIFICANT"]]
channel_sup[["ssh_channel_sup<br />[o4o]"]] --> subsystem_sup
sftp["ssh_sftp"] --> channel_sup
ssh_tcpip_forward_client --> channel_sup
tcpip_forward_acceptor_sup[["ssh_tcpip_forward_acceptor_sup\n[o4o]"]] --> subsystem_sup
ssh_tcpip_forward_acceptor["ssh_tcpip_forward_acceptor"] --> tcpip_forward_acceptor_sup
tcpip_forward_acceptor_sup[["ssh_tcpip_forward_acceptor_sup<br />[o4o]"]] --> subsystem_sup
end
end
subgraph server
system_sup_s --> d_sup[["sshd_sup\n(ssh_app.erl)\n[o4o]"]]
acceptor_sup --> system_sup_s[["ssh_system_sup\n[o4o]\nauto_shutdown=all_significant"]]
acceptor["ssh_acceptor"] --> acceptor_sup[["ssh_acceptor_sup\n[o4o]\nSIGNIFICANT"]]
system_sup_s --> d_sup[["sshd_sup<br />(ssh_app.erl)<br />[o4o]"]]
acceptor_sup --> system_sup_s[["ssh_system_sup<br />[o4o]<br />auto_shutdown=all_significant"]]
acceptor["ssh_acceptor"] --> acceptor_sup[["ssh_acceptor_sup<br />[o4o]<br />SIGNIFICANT"]]
acceptor_worker["acceptor<br />(parallel_login)"] o-. link .-o acceptor
subsystem_sup_s --> system_sup_s
subgraph connection_s
connection_handler_s["ssh_connection_handler\nSIGNIFICANT"] --> subsystem_sup_s[["ssh_subsystem_sup\n[o4a]\nauto_shutdown=any_significant\nSIGNIFICANT"]]
channel_sup_s[["ssh_channel_sup\n[o4o]"]] --> subsystem_sup_s
tcpip_forward_acceptor_sup_s[["ssh_tcpip_forward_acceptor_sup\n[o4o]"]] --> subsystem_sup_s
connection_handler_s["ssh_connection_handler<br />SIGNIFICANT"] --> subsystem_sup_s[["ssh_subsystem_sup<br />[o4a]<br />auto_shutdown=any_significant<br />SIGNIFICANT"]]
channel_sup_s[["ssh_channel_sup<br />[o4o]"]] --> subsystem_sup_s
tcpip_forward_acceptor_sup_s[["ssh_tcpip_forward_acceptor_sup<br />[o4o]"]] --> subsystem_sup_s
ssh_tcpip_forward_acceptor_s["ssh_tcpip_forward_acceptor"] --> tcpip_forward_acceptor_sup_s
sftd1["ssh_sftpd"] --> channel_sup_s
ssh_tcpip_forward_srv --> channel_sup_s
Expand All @@ -83,24 +121,24 @@ flowchart RL
title: SSH supervision tree (OTP-22)
---
flowchart RL
d_sup --> sup[["ssh_sup\n(ssh_app.erl)\n[o4o]"]]
d_sup --> sup[["ssh_sup<br />(ssh_app.erl)<br />[o4o]"]]
c_sup --> sup
subgraph client
connection_handler["ssh_connection_handler\nSIGNIFICANT?"] --> c_sup
connection_handler["ssh_connection_handler<br />SIGNIFICANT?"] --> c_sup
end
subgraph server
system_sup_s --> d_sup[["sshd_sup\n(ssh_app.erl)\n[o4o]"]]
acceptor_sup --> system_sup_s[["ssh_system_sup\n[o4o]\nauto_shutdown=all_significant"]]
acceptor["ssh_acceptor"] --> acceptor_sup[["ssh_acceptor_sup\n[o4o]\nSIGNIFICANT"]]
system_sup_s --> d_sup[["sshd_sup<br />(ssh_app.erl)<br />[o4o]"]]
acceptor_sup --> system_sup_s[["ssh_system_sup<br />[o4o]<br />auto_shutdown=all_significant"]]
acceptor["ssh_acceptor"] --> acceptor_sup[["ssh_acceptor_sup<br />[o4o]<br />SIGNIFICANT"]]
subsystem_sup_s --> system_sup_s
subgraph connection_s
connection_handler_s["ssh_connection_handler\nSIGNIFICANT"] --> subsystem_sup_s[["ssh_subsystem_sup\n[o4a]\nauto_shutdown=any_significant\nSIGNIFICANT"]]
channel_sup_s[["ssh_channel_sup\n[o4o]"]] --> subsystem_sup_s
tcpip_forward_acceptor_sup_s[["ssh_tcpip_forward_acceptor_sup\n[o4o]"]] --> subsystem_sup_s
connection_handler_s["ssh_connection_handler<br />SIGNIFICANT"] --> subsystem_sup_s[["ssh_subsystem_sup<br />[o4a]<br />auto_shutdown=any_significant<br />SIGNIFICANT"]]
channel_sup_s[["ssh_channel_sup<br />[o4o]"]] --> subsystem_sup_s
tcpip_forward_acceptor_sup_s[["ssh_tcpip_forward_acceptor_sup<br />[o4o]"]] --> subsystem_sup_s
sftd1["ssh_sftpd"] --> channel_sup_s
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/ssh/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ MODULES= \
ssh_info \
ssh_io \
ssh_lib \
ssh_lsocket \
ssh_lsocket_sup \
ssh_message \
ssh_no_io \
ssh_options \
Expand Down
2 changes: 2 additions & 0 deletions lib/ssh/src/ssh.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
ssh_daemon_channel,
ssh_dbg,
ssh_lib,
ssh_lsocket_sup,
ssh_lsocket,
ssh_shell,
ssh_io,
ssh_info,
Expand Down
Loading

0 comments on commit 783478e

Please sign in to comment.