Skip to content

Commit

Permalink
feat(node): add SSH outboud support
Browse files Browse the repository at this point in the history
  • Loading branch information
1715173329 committed Dec 2, 2023
1 parent 1148b5c commit c6963de
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
29 changes: 29 additions & 0 deletions htdocs/luci-static/resources/view/homeproxy/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ return view.extend({
so.value('shadowsocks', _('Shadowsocks'));
so.value('shadowtls', _('ShadowTLS'));
so.value('socks', _('Socks'));
so.value('ssh', _('SSH'));
so.value('trojan', _('Trojan'));
if (features.with_quic)
so.value('tuic', _('Tuic'));
Expand All @@ -537,13 +538,15 @@ return view.extend({
so = ss.option(form.Value, 'username', _('Username'));
so.depends('type', 'http');
so.depends('type', 'socks');
so.depends('type', 'ssh');
so.modalonly = true;

so = ss.option(form.Value, 'password', _('Password'));
so.password = true;
so.depends('type', 'http');
so.depends('type', 'hysteria2');
so.depends('type', 'shadowsocks');
so.depends('type', 'ssh');
so.depends('type', 'trojan');
so.depends('type', 'tuic');
so.depends({'type': 'shadowtls', 'shadowtls_version': '2'});
Expand Down Expand Up @@ -704,6 +707,32 @@ return view.extend({
so.rmempty = false;
so.modalonly = true;

/* SSH config start */
so = ss.option(form.Value, 'ssh_client_version', _('Client version'),
_('Random version will be used if empty.'));
so.depends('type', 'ssh');
so.modalonly = true;

so = ss.option(form.DynamicList, 'ssh_host_key', _('Host key'),
_('Accept any if empty.'));
so.depends('type', 'ssh');
so.modalonly = true;

so = ss.option(form.DynamicList, 'ssh_host_key_algo', _('Host key algorithms'))
so.depends('type', 'ssh');
so.modalonly = true;

so = ss.option(form.Value, 'ssh_priv_key', _('Private key'));
so.password = true;
so.depends('type', 'ssh');
so.modalonly = true;

so = ss.option(form.Value, 'ssh_priv_key_pp', _('Private key passphrase'));
so.password = true;
so.depends('type', 'ssh');
so.modalonly = true;
/* SSH config end */

/* TUIC config start */
so = ss.option(form.Value, 'uuid', _('UUID'));
so.depends('type', 'tuic');
Expand Down
9 changes: 8 additions & 1 deletion root/etc/homeproxy/scripts/generate_client.uc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ function generate_outbound(node) {
server: node.address,
server_port: strToInt(node.port),

username: node.username,
username: (node.type !== 'ssh') ? node.username : null,
user: (node.tpye === 'ssh') ? node.username : null,
password: node.password,

/* Direct */
Expand All @@ -151,6 +152,12 @@ function generate_outbound(node) {
plugin_opts: node.shadowsocks_plugin_opts,
/* ShadowTLS / Socks */
version: (node.type === 'shadowtls') ? strToInt(node.shadowtls_version) : ((node.type === 'socks') ? node.socks_version : null),
/* SSH */
client_version: node.ssh_client_version,
host_key: node.ssh_host_key,
host_key_algorithms: node.ssh_host_key_algo,
private_key: node.ssh_priv_key,
private_key_passphrase: node.ssh_priv_key_pp,
/* Tuic */
uuid: node.uuid,
congestion_control: node.tuic_congestion_control,
Expand Down

0 comments on commit c6963de

Please sign in to comment.