Skip to content

Commit

Permalink
add wezterm tls config
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Oct 25, 2024
1 parent b8f27bb commit aa3e4a9
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions dot_config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,59 @@ end)
-- Show which key table is active in the status area
wezterm.on('update-right-status', function(window, pane)
local name = window:active_key_table()
if name then
name = 'TABLE: ' .. name
end
if name then name = 'TABLE: ' .. name end
window:set_right_status(name or '')
end)

local default_domain = 'SSHMUX:dev'

local config = {}

config.tls_clients = {}

config.ssh_domains = wezterm.default_ssh_domains()
for _, dom in ipairs(config.ssh_domains) do
wezterm.log_info('setting multiplexing to WezTerm for ' .. dom.name)
-- Default ssh domains are Posix, but we can override that later.
dom.assume_shell = 'Posix'
dom.local_echo_threshold_ms = 10

-- Create a tls client for each ssh domain.
-- The dom name here can start with SSH: or SSHMUX:
-- We remove the prefix here.
local server_name = dom.name:gsub('^SSH[MUX]*:', '')
local tls_name = server_name .. '.tls'
local tls_client_found = false
for _, tls in ipairs(config.tls_clients) do
if tls.name == tls_name then
tls_client_found = true
break
end
end

-- If we have already set this name in the tls_config, then just skip
-- the rest of the loop.
if not tls_client_found then
local conf = {
name = tls_name,
remote_address = dom.remote_address .. ":4443",
bootstrap_via_ssh = server_name
}
wezterm.log_info('domain', dom)
wezterm.log_info('config', conf)

-- Insert the config to config.tls_clients
config.tls_clients[#config.tls_clients + 1] = conf
end
end

config.tls_servers = {
{
-- The host:port combination on which the server will listen
-- for connections
bind_address = ':4443'
}
}

config.color_scheme = scheme_for_appearance(get_appearance())

config.launch_menu = {
Expand Down

0 comments on commit aa3e4a9

Please sign in to comment.