aboutsummaryrefslogtreecommitdiff
path: root/pkgs/yossh/examples
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-04-29 15:20:57 -0500
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-04-29 15:20:57 -0500
commit9c9a49a855951662da62bcdec45f69ddc0099e5c (patch)
tree1f7852971693d9e49d16a77aff51b87d39940b1b /pkgs/yossh/examples
parent21de12cd6e63adf463674942f1a8f9b658f47945 (diff)
changes
Diffstat (limited to 'pkgs/yossh/examples')
-rwxr-xr-xpkgs/yossh/examples/home_wifi.lua33
-rw-r--r--pkgs/yossh/examples/mega_bastion.lua61
-rw-r--r--pkgs/yossh/examples/test.lua18
3 files changed, 0 insertions, 112 deletions
diff --git a/pkgs/yossh/examples/home_wifi.lua b/pkgs/yossh/examples/home_wifi.lua
deleted file mode 100755
index 8df2aad..0000000
--- a/pkgs/yossh/examples/home_wifi.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-yoshi = dofile'yoshi.lua'
-
-local function isHome()
- local ok, reason, code = os.execute("nc -z -w1 192.168.50.2 2222")
- return code == 0
-end
-
-yoshi.hosts["ganymede"] = function()
- if isHome() then
- return yoshi.ssh{
- HostName = "192.168.50.2",
- Port = 2222,
- LocalForward = 8010
- }
- else
- return yoshi.ssh{
- HostName = "williamsfam.us.com",
- LocalForward = 8010,
- DynamicForward = 9090
- }
- end
-end
-
-yoshi.hosts["io"] = function()
- return yoshi.ssh{
- HostName = "192.168.50.3",
- User = "admin",
- ProxyJump = isHome() or "collin@ganymede",
- }
-end
-
-yoshi.run(arg, {dry_run = true})
diff --git a/pkgs/yossh/examples/mega_bastion.lua b/pkgs/yossh/examples/mega_bastion.lua
deleted file mode 100644
index d4eb3ee..0000000
--- a/pkgs/yossh/examples/mega_bastion.lua
+++ /dev/null
@@ -1,61 +0,0 @@
--- situation: fictional network where there are three departments:
--- - tech (172.16.10.0/24)
--- - HR (172.16.20.0/24)
--- - Secretary (172.16.40.0/24)
--- Each department has
--- - an ssh bastion server at .1:22 (only way to access other devices on the subnet from outside the subnet)
--- - a shared sftp server at .2:25
---
--- This exact yoshi script would be deployed to all personal computers inside the network.
-local yoshi = dofile"yoshi.lua"
-
-local function inNetwork()
- -- company internal landing page
- local _, _, code = os.execute("nc -z -w1 172.16.0.1 443")
- return code == 0
-end
-
-local function currDept()
- local ip_addr = io.popen("hostname -I")
- local _, _, third_octet, _ = string.gmatch(ip_addr, "%d%.%d%.%d%.%d")
-
- return third_octet
-end
-
-local depts = {
- tech = 10,
- hr = 20,
- secretary = 40
-}
-
-yoshi.hosts["global-bastion"] = yoshi.ssh{
- HostName = "bastion.company-website.com",
- Port = 2222
-}
-
-for name, subnet in pairs(depts) do
- yoshi.hosts[name.."-bastion"] = function()
- return yoshi.ssh{
- HostName = "172.16."..subnet..".1",
- ProxyJump = inNetwork() or "global-bastion"
- }
- end
-
- yoshi.hosts[name.."-fileserver"] = function()
- return yoshi.ssh{
- HostName = "172.16."..subnet..".2",
- SessionType = "none",
- LocalForward = {2225, 25},
- ProxyJump = inNetwork() and currDept() == subnet or name.."-bastion"
- }
- end
-end
-
-yoshi.hosts[name.."-db"] = yoshi.ssh{
- HostName = "172.16.10.3",
- SessionType = "none",
- LocalForward = 5432,
- ProxyJump = inNetwork() and currDept() == subnet or "tech-bastion"
-}
-
-yoshi.run(arg, {dry_run = true})
diff --git a/pkgs/yossh/examples/test.lua b/pkgs/yossh/examples/test.lua
deleted file mode 100644
index a594305..0000000
--- a/pkgs/yossh/examples/test.lua
+++ /dev/null
@@ -1,18 +0,0 @@
-yoshi = dofile'yoshi.lua'
-
-yoshi.hosts["you"] = function()
- return yoshi.ssh{
- HostName = "192.168.50.2",
- DynamicForward = 7320,
- Port = 27
- }
-end
-
-yoshi.hosts["me"] = function()
- return yoshi.ssh{
- HostName = "test.local",
- ProxyJump = "jumper@you"
- }
-end
-
-yoshi.run(arg, {dry_run = true})