@stacksjs/ts-cloud 0.12.16 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aws/index.js +1 -1
- package/dist/bin/{chunk-9wjgxjqp.js → chunk-22c3pk8s.js} +48 -48
- package/dist/bin/chunk-2ahgpy3j.js +2 -0
- package/dist/bin/chunk-2synp9gh.js +1 -0
- package/dist/bin/{chunk-zhpzxnpg.js → chunk-2v0qm547.js} +1 -1
- package/dist/bin/{chunk-52wgrpe8.js → chunk-88ysj8n5.js} +1 -1
- package/dist/bin/{chunk-6tty6sjf.js → chunk-8bbw6qc2.js} +1 -1
- package/dist/bin/{chunk-2shtky1g.js → chunk-9qndhwbe.js} +1 -1
- package/dist/bin/{chunk-a76krpa1.js → chunk-bdgkeqv6.js} +1 -1
- package/dist/bin/chunk-c82rh7qe.js +1 -0
- package/dist/bin/{chunk-e3d9m062.js → chunk-d4bb9qg9.js} +1 -1
- package/dist/bin/{chunk-tpjepvwa.js → chunk-d6kqbp8q.js} +1 -1
- package/dist/bin/{chunk-a8rn2wym.js → chunk-dk38j1qr.js} +9 -9
- package/dist/bin/{chunk-9vrnrxay.js → chunk-e1cxh9rj.js} +2 -2
- package/dist/bin/{chunk-9k60q9qz.js → chunk-edaq5jef.js} +3 -3
- package/dist/bin/{chunk-srw2jmh3.js → chunk-fbycbnvj.js} +4 -4
- package/dist/bin/chunk-fj89173b.js +1 -0
- package/dist/bin/{chunk-xyk8qe2c.js → chunk-gxwsq3k0.js} +21 -21
- package/dist/bin/{chunk-ebdybz7x.js → chunk-hwp5xp1c.js} +35 -35
- package/dist/bin/{chunk-ndbtr4mb.js → chunk-jee6msvx.js} +3 -3
- package/dist/bin/chunk-kjatss6s.js +1 -0
- package/dist/bin/{chunk-mekcw1zn.js → chunk-kxa4t4wh.js} +2 -2
- package/dist/bin/{chunk-8sxb2rr0.js → chunk-m5sjzxm3.js} +1 -1
- package/dist/bin/{chunk-7xszcdqn.js → chunk-n56c0j1e.js} +4 -4
- package/dist/bin/{chunk-be7rhw60.js → chunk-rzt92fwv.js} +3 -3
- package/dist/bin/{chunk-zav02r6k.js → chunk-vwzgtsn9.js} +1 -1
- package/dist/bin/{chunk-dvm4n8m8.js → chunk-w0g72e50.js} +1 -1
- package/dist/bin/chunk-wb8y7zey.js +1 -0
- package/dist/bin/{chunk-y24gfke7.js → chunk-x4gsw45d.js} +5 -5
- package/dist/bin/{chunk-hzj5r6b7.js → chunk-xs62dg7t.js} +2 -2
- package/dist/bin/{chunk-k7w2ztw9.js → chunk-xtp2zf3j.js} +1 -1
- package/dist/bin/{chunk-5qann9n2.js → chunk-xw9vcdwt.js} +1 -1
- package/dist/bin/{chunk-3zq0wkz2.js → chunk-y671cgz5.js} +1 -1
- package/dist/bin/cli.js +76 -76
- package/dist/bin/dashboard-server.js +1 -1
- package/dist/chunk-05qawkra.js +1 -0
- package/dist/{chunk-qszktnnz.js → chunk-0g2jkhy5.js} +1 -1
- package/dist/{chunk-crpjqnjb.js → chunk-2s65yj3g.js} +4 -4
- package/dist/chunk-3qtce4mm.js +1 -0
- package/dist/chunk-3tt5em2c.js +1 -0
- package/dist/{chunk-hw3p6pth.js → chunk-42kv07cs.js} +1 -1
- package/dist/{chunk-nr1bdzwy.js → chunk-65ajja2a.js} +1 -1
- package/dist/{chunk-rtg6nw3n.js → chunk-6gtqjsg9.js} +3 -3
- package/dist/{chunk-a7v15116.js → chunk-8s9m8pyb.js} +1 -1
- package/dist/chunk-a1p70h5d.js +2 -0
- package/dist/{chunk-j9rv5m58.js → chunk-asmv4fw1.js} +19 -19
- package/dist/{chunk-a6zymyfs.js → chunk-ds92qg3g.js} +4 -4
- package/dist/{chunk-93mgdgd5.js → chunk-dzqz1sm0.js} +3 -3
- package/dist/{chunk-wz57brcf.js → chunk-hyj2ymp1.js} +6 -6
- package/dist/{chunk-1zz5n6q8.js → chunk-j7vsrx9g.js} +5 -5
- package/dist/chunk-jdq95b4h.js +1 -0
- package/dist/{chunk-wxv3ypt5.js → chunk-m5r0dt28.js} +2 -2
- package/dist/{chunk-bga3mw5f.js → chunk-mcfdtg5w.js} +1 -1
- package/dist/{chunk-4ywy6dp5.js → chunk-ngdhqwf3.js} +3 -3
- package/dist/{chunk-6znnde1s.js → chunk-nhtz2k8d.js} +5 -5
- package/dist/{chunk-kazw813q.js → chunk-nw0tvrrr.js} +1 -1
- package/dist/{chunk-d1tv3wx0.js → chunk-p9fqsz06.js} +2 -2
- package/dist/{chunk-qzwack6w.js → chunk-r4dpn715.js} +7 -7
- package/dist/{chunk-ajq92t46.js → chunk-t5tvt2r3.js} +124 -124
- package/dist/{chunk-jk7ecnmc.js → chunk-vk513ge7.js} +78 -78
- package/dist/{chunk-mherymtx.js → chunk-w5fmaaxa.js} +4 -4
- package/dist/chunk-wr7tn9j5.js +1 -0
- package/dist/{chunk-7hjsnwcv.js → chunk-xqx5szta.js} +27 -27
- package/dist/{chunk-thghrpf9.js → chunk-y13zcbnp.js} +101 -101
- package/dist/{chunk-bgrre2px.js → chunk-z7v4evbh.js} +2 -2
- package/dist/deploy/index.js +1 -1
- package/dist/dns/delegate-from-config.d.ts +50 -0
- package/dist/dns/delegate-from-config.test.d.ts +1 -0
- package/dist/dns/delegation.d.ts +110 -0
- package/dist/dns/delegation.test.d.ts +1 -0
- package/dist/dns/index.d.ts +4 -0
- package/dist/dns/index.js +1 -1
- package/dist/dns/porkbun-nameservers.test.d.ts +1 -0
- package/dist/drivers/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -49
- package/dist/operations/index.js +1 -1
- package/dist/protection/index.js +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/accept-invitation.html +1 -1
- package/dist/ui/access-denied.html +1 -1
- package/dist/ui/account/automation.html +6 -6
- package/dist/ui/account/security.html +2 -2
- package/dist/ui/applications/compose.html +6 -6
- package/dist/ui/applications/new.html +1 -1
- package/dist/ui/data/backups.html +6 -6
- package/dist/ui/data/services.html +6 -6
- package/dist/ui/data/volumes.html +6 -6
- package/dist/ui/index.html +6 -6
- package/dist/ui/infrastructure/topology.html +6 -6
- package/dist/ui/integrations.html +2 -2
- package/dist/ui/operations/alerts.html +6 -6
- package/dist/ui/operations/configuration.html +6 -6
- package/dist/ui/operations/jobs.html +5 -5
- package/dist/ui/operations/maintenance.html +5 -5
- package/dist/ui/operations/observability.html +6 -6
- package/dist/ui/operations/previews.html +6 -6
- package/dist/ui/operations/queue.html +6 -6
- package/dist/ui/operations/regions.html +5 -5
- package/dist/ui/operations/releases.html +6 -6
- package/dist/ui/operations/spend.html +6 -6
- package/dist/ui/operations/workloads.html +6 -6
- package/dist/ui/security.html +2 -2
- package/dist/ui/server/actions.html +6 -6
- package/dist/ui/server/activity.html +1 -1
- package/dist/ui/server/capacity.html +6 -6
- package/dist/ui/server/database.html +6 -6
- package/dist/ui/server/deployments.html +6 -6
- package/dist/ui/server/diagnostics.html +2 -2
- package/dist/ui/server/firewall.html +6 -6
- package/dist/ui/server/fleet.html +6 -6
- package/dist/ui/server/logs.html +6 -6
- package/dist/ui/server/metrics.html +6 -6
- package/dist/ui/server/security.html +2 -2
- package/dist/ui/server/services.html +2 -2
- package/dist/ui/server/sites.html +6 -6
- package/dist/ui/server/ssh-keys.html +6 -6
- package/dist/ui/server/team.html +5 -5
- package/dist/ui/server/terminal.html +2 -2
- package/dist/ui/serverless/alarms.html +6 -6
- package/dist/ui/serverless/assets.html +2 -2
- package/dist/ui/serverless/cost.html +2 -2
- package/dist/ui/serverless/data.html +6 -6
- package/dist/ui/serverless/deployments.html +2 -2
- package/dist/ui/serverless/firewall.html +2 -2
- package/dist/ui/serverless/functions.html +6 -6
- package/dist/ui/serverless/logs.html +6 -6
- package/dist/ui/serverless/metrics.html +2 -2
- package/dist/ui/serverless/queues.html +6 -6
- package/dist/ui/serverless/secrets.html +6 -6
- package/dist/ui/serverless/traces.html +6 -6
- package/dist/ui/serverless.html +5 -5
- package/package.json +3 -3
- package/dist/bin/chunk-005sxfmc.js +0 -1
- package/dist/bin/chunk-4vgbynq6.js +0 -1
- package/dist/bin/chunk-bwvnfc74.js +0 -1
- package/dist/bin/chunk-cy4wwpnf.js +0 -1
- package/dist/bin/chunk-dxfsq94k.js +0 -2
- package/dist/bin/chunk-dy10cmt9.js +0 -1
- package/dist/chunk-8fcrgq31.js +0 -1
- package/dist/chunk-8msfne57.js +0 -2
- package/dist/chunk-eadp23eh.js +0 -1
- package/dist/chunk-jpbgr1wg.js +0 -1
- package/dist/chunk-w7710vzg.js +0 -1
- package/dist/chunk-xfdpxsbc.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as q}from"node:module";var k=Object.create;var{getPrototypeOf:l,defineProperty:i,getOwnPropertyNames:m}=Object;var j=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,
|
|
2
|
-
export{
|
|
1
|
+
import{createRequire as q}from"node:module";var k=Object.create;var{getPrototypeOf:l,defineProperty:i,getOwnPropertyNames:m}=Object;var j=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,sh=(a,b,d)=>{var f=a!=null&&typeof a==="object";if(f){var g=b?o??=new WeakMap:p??=new WeakMap,h=g.get(a);if(h)return h}d=a!=null?k(l(a)):{};let c=b||!a||!a.__esModule||!j.call(a,"default")?i(d,"default",{value:a,enumerable:!0}):d;if(a&&typeof a==="object"||typeof a==="function"){for(let e of m(a))if(!j.call(c,e))i(c,e,{get:n.bind(a,e),enumerable:!0})}if(f)g.set(a,c);return c};var oh=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var Me=q(import.meta.url);
|
|
2
|
+
export{sh,oh,Me};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Xc={newConnectionsPerSecond:50,concurrentPerSource:100,synPerSecond:2000,burst:100,icmpPerSecond:5,banSeconds:600};function h(e){return{...Xc,...e.thresholds}}var _=/^(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,2})?$|^[0-9a-f:]+(?:\/\d{1,3})?$/i;function Br(e){if(!_.test(e))return!1;let[t,n]=e.split("/");if(t.includes(":"))return n==null||Number(n)>=0&&Number(n)<=128;let s=t.split(".");if(s.length!==4||s.some((a)=>Number(a)>255||a===""))return!1;return n==null||Number(n)>=0&&Number(n)<=32}function f(e){return[...new Set((e??[]).map((t)=>t.trim()).filter(Br))]}function y(e){let t=(e??[80,443]).filter((n)=>Number.isInteger(n)&&n>=1&&n<=65535);return[...new Set(t)].sort((n,s)=>n-s)}function Yc(e={}){let t=h(e);return{"net.ipv4.tcp_syncookies":"1","net.ipv4.tcp_max_syn_backlog":String(Math.max(4096,t.synPerSecond*4)),"net.ipv4.tcp_synack_retries":"2","net.ipv4.tcp_abort_on_overflow":"1","net.ipv4.tcp_fin_timeout":"15","net.ipv4.tcp_keepalive_time":"300","net.ipv4.tcp_keepalive_intvl":"30","net.ipv4.tcp_keepalive_probes":"3","net.core.somaxconn":"4096","net.core.netdev_max_backlog":"16384","net.ipv4.conf.all.rp_filter":"1","net.ipv4.conf.default.rp_filter":"1","net.ipv4.conf.all.accept_source_route":"0","net.ipv4.conf.all.accept_redirects":"0","net.ipv4.conf.all.send_redirects":"0","net.ipv6.conf.all.accept_redirects":"0","net.ipv6.conf.all.accept_source_route":"0","net.ipv4.icmp_echo_ignore_broadcasts":"1","net.ipv4.icmp_ignore_bogus_error_responses":"1","net.netfilter.nf_conntrack_max":"262144","net.netfilter.nf_conntrack_tcp_timeout_established":"3600"}}function Zc(e={}){let t=["# Managed by ts-cloud. Edits are overwritten on the next deploy.","# Network hardening against L3/L4 floods.",""];for(let[n,s]of Object.entries(Yc(e)))t.push(`${n} = ${s}`);return`${t.join(`
|
|
2
2
|
`)}
|
|
3
|
-
`}function
|
|
4
|
-
`)}function
|
|
3
|
+
`}function ed(e={}){let t=h(e),n=y(e.ports),s=f(e.allowlist),a=f(e.blocklist),l=e.monitorOnly?"counter":"counter drop",i=e.originProtection?.enabled?f(e.originProtection.cdnRanges):[],c=s.filter((r)=>!r.includes(":")),p=s.filter((r)=>r.includes(":")),u=a.filter((r)=>!r.includes(":")),o=["#!/usr/sbin/nft -f","# Managed by ts-cloud. Edits are overwritten on the next deploy.","","table inet ts_cloud_ddos","delete table inet ts_cloud_ddos","","table inet ts_cloud_ddos {"," # Sources that tripped a limit, with a timeout so a ban self-expires.",` set banned4 { type ipv4_addr; flags timeout; timeout ${t.banSeconds}s; }`,` set banned6 { type ipv6_addr; flags timeout; timeout ${t.banSeconds}s; }`];if(c.length>0)o.push(` set allow4 { type ipv4_addr; flags interval; elements = { ${c.join(", ")} } }`);if(p.length>0)o.push(` set allow6 { type ipv6_addr; flags interval; elements = { ${p.join(", ")} } }`);if(u.length>0)o.push(` set block4 { type ipv4_addr; flags interval; elements = { ${u.join(", ")} } }`);if(i.length>0)o.push(` set cdn4 { type ipv4_addr; flags interval; elements = { ${i.filter((r)=>!r.includes(":")).join(", ")} } }`);if(o.push(""," chain input {"," type filter hook input priority -150; policy accept;",""," # Established traffic is already paid for; never re-inspect it."," ct state established,related accept"," iif lo accept",""," # Invalid packets are never legitimate and are cheap to drop early."," ct state invalid counter drop"),c.length>0)o.push(" ip saddr @allow4 accept");if(p.length>0)o.push(" ip6 saddr @allow6 accept");if(u.length>0)o.push(" ip saddr @block4 counter drop");if(o.push(" ip saddr @banned4 counter drop"," ip6 saddr @banned6 counter drop",""),o.push(" # Nonsense TCP flag combinations: scanners and stack fingerprinting."," tcp flags & (fin|syn) == (fin|syn) counter drop"," tcp flags & (syn|rst) == (syn|rst) counter drop"," tcp flags & (fin|rst) == (fin|rst) counter drop"," tcp flags & (fin|ack) == fin counter drop"," tcp flags & (syn|fin|ack|rst|psh|urg) == 0x0 counter drop",""," # Ping stays usable, ping floods do not.",` ip protocol icmp icmp type echo-request limit rate ${t.icmpPerSecond}/second burst ${t.burst} packets accept`," ip protocol icmp icmp type echo-request counter drop",""),n.length>0){let r=n.join(", ");if(o.push(" # Platform-wide SYN ceiling. Above it the kernel falls back to cookies.",` tcp dport { ${r} } ct state new limit rate ${t.synPerSecond}/second burst ${t.burst} packets accept`,""," # Per-source new-connection rate. This is what stops one host hammering.",` tcp dport { ${r} } ct state new meter conn_rate4 { ip saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned4 { ip saddr } ${l}`,` tcp dport { ${r} } ct state new meter conn_rate6 { ip6 saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned6 { ip6 saddr } ${l}`,""," # Concurrency ceiling per source: the slow-loris defence.",` tcp dport { ${r} } ct state new meter conn_count4 { ip saddr ct count over ${t.concurrentPerSource} } ${l}`,` tcp dport { ${r} } ct state new meter conn_count6 { ip6 saddr ct count over ${t.concurrentPerSource} } ${l}`,""),i.length>0)o.push(" # Origin protection: reject traffic that skipped the CDN and came"," # straight to the box, which is how an attacker bypasses the edge.",` tcp dport { ${r} } ip saddr != @cdn4 counter drop`,"")}return o.push(" }","}",""),o.join(`
|
|
4
|
+
`)}function mi(e={}){return`#!/usr/bin/env bash
|
|
5
5
|
# Managed by ts-cloud. Installs L3/L4 flood mitigation.
|
|
6
6
|
set -euo pipefail
|
|
7
7
|
|
|
@@ -13,11 +13,11 @@ fi
|
|
|
13
13
|
|
|
14
14
|
install -d -m 0755 /etc/ts-cloud /etc/nftables.d
|
|
15
15
|
cat > /etc/sysctl.d/90-ts-cloud-ddos.conf <<'SYSCTL_EOF'
|
|
16
|
-
${
|
|
16
|
+
${Zc(e)}SYSCTL_EOF
|
|
17
17
|
sysctl --system >/dev/null
|
|
18
18
|
|
|
19
19
|
cat > /etc/nftables.d/ts-cloud-ddos.nft.new <<'NFT_EOF'
|
|
20
|
-
${
|
|
20
|
+
${ed(e)}NFT_EOF
|
|
21
21
|
|
|
22
22
|
# Syntax-check before applying: a bad ruleset would leave the box unprotected.
|
|
23
23
|
if ! nft -c -f /etc/nftables.d/ts-cloud-ddos.nft.new; then
|
|
@@ -40,5 +40,5 @@ include "/etc/nftables.d/ts-cloud-ddos.nft"
|
|
|
40
40
|
fi
|
|
41
41
|
systemctl enable nftables >/dev/null 2>&1 || true
|
|
42
42
|
echo "ts-cloud: L3/L4 mitigation active"
|
|
43
|
-
`}var b=["off","monitor","rate_limit","challenge","lockdown"];function
|
|
44
|
-
export{
|
|
43
|
+
`}var b=["off","monitor","rate_limit","challenge","lockdown"];function Tp(e,t=[]){let n=[],s=Math.max(1,e.baselineRequestsPerSecond),a=e.requestsPerSecond/s,l=0,i=(g,v)=>{n.push(v),l=Math.max(l,b.indexOf(g))},c=a>=3;if(c)i("monitor",`Traffic is ${a.toFixed(1)}x the baseline.`);let p=e.topSourceShare>=0.25,u=e.errorRate>=0.25,o=(e.suspiciousAgentShare??0)>=0.5,r=e.uniqueSources>0&&e.requestsPerSecond/e.uniqueSources>=50;if(c&&p)i("rate_limit",`One source accounts for ${(e.topSourceShare*100).toFixed(0)}% of traffic.`);if(c&&r)i("rate_limit","Request rate per unique source is far above what a browser produces.");if(c&&u)i("challenge",`Error rate is ${(e.errorRate*100).toFixed(0)}% under load.`);if(c&&o)i("challenge","Most requests carry no recognisable browser agent.");if(a>=20&&(p||u||o||r))i("lockdown",`Traffic is ${a.toFixed(0)}x the baseline with attack-shaped characteristics.`);if(!c&&e.topSourceShare>=0.6&&e.requestsPerSecond>s)i("rate_limit","A single source dominates traffic without an overall surge.");let d=b[l],m={off:1,monitor:1,rate_limit:0.5,challenge:0.25,lockdown:0.1}[d];return{level:d,reasons:n,rateLimitFactor:m,challengeEnabled:d==="challenge"||d==="lockdown",staticOnly:d==="lockdown",banCandidates:d==="off"||d==="monitor"?[]:f(t)}}function xr(e,t){return Math.max(1,Math.floor(e*t.rateLimitFactor))}
|
|
44
|
+
export{Xc,Br,Yc,Zc,ed,mi,Tp,xr};
|