const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/ssh-protection-config-Bf_maSWl.js?v=1773287522785","js/index-DIKmrNCq.js?v=1773287522785","js/index-BTglIPU2.js?v=1773287522785","js/vue-core-DJjvd5ZC.js?v=1773287522785","js/prismjs-BZPoR7_J.js?v=1773287522785","css/prismjs-D-3FhBe_.css?v=1773287522785","js/naive-ui--dJnpVcV.js?v=1773287522785","css/index-DEM1fxGq.css?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785","js/useLoading-CZ2gSAW7.js?v=1773287522785","js/index-DLN4sTNp.js?v=1773287522785","js/index-CZps0rIN.js?v=1773287522785","css/index-CdMsogou.css?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785","js/data-BVsViUMm.js?v=1773287522785","js/useTableData-BmkIKQ_R.js?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-DG86e1NA.js?v=1773287522785","js/index-K4YGya6V.js?v=1773287522785","css/index-DKJnQkCC.css?v=1773287522785","js/check-CNel7fTH.js?v=1773287522785","js/index-BRQskX9P.js?v=1773287522785","css/index-CCworjcO.css?v=1773287522785","js/ssl-lets-progress-6I5lHATh.js?v=1773287522785","js/ssl-Bm8jcneQ.js?v=1773287522785","css/ssl-lets-progress-D49nLRZ0.css?v=1773287522785","css/index-DZgeF7yl.css?v=1773287522785","js/ssh-g_xvV-TS.js?v=1773287522785","js/ssh-protection-log-CuKLhDHw.js?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-DgjjuUjT.js?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-B7YvCBmY.js?v=1773287522785","css/index-CVIzYRIt.css?v=1773287522785","js/useTableColumns-DDeyYvje.js?v=1773287522785","js/index-S15tYq5l.js?v=1773287522785","js/copy-D-wIKr0q.js?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785","js/index-Cg6fMjw6.js?v=1773287522785","css/ssh-protection-log-CO-tEjMc.css?v=1773287522785","js/form-DjNxICQD.js?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-DDg6Zp8N.js?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-O0FWUQU9.js?v=1773287522785","js/alarm-C8du74Vj.js?v=1773287522785","js/alarm-DLi1oY_0.js?v=1773287522785","js/index-BPrJVxQ_.js?v=1773287522785","css/index-C-upYGTt.css?v=1773287522785","js/config-Db5nkq_D.js?v=1773287522785","css/config-Ds3-Cpxn.css?v=1773287522785","js/confirm-6yFLisEX.js?v=1773287522785","js/confirm.vue_vue_type_script_setup_true_lang-CGAfjXXx.js?v=1773287522785","js/view-BY3TF_FT.js?v=1773287522785"])))=>i.map(i=>d[i]); import{as as $,a3 as z,i as L,m as F,g as oe,c as ae,l as ie,c9 as le,p as w,P as b,af as re,ca as ce}from"./index-BTglIPU2.js?v=1773287522785";import{f as ue,g as de}from"./index-DLN4sTNp.js?v=1773287522785";import{a4 as pe,e as O,x as fe,r as J,k as Y,$ as M,Z as ee,_ as g,a0 as n,a9 as a,aa as r,q as Z,l as ge,v as me,a6 as q,o as _e,n as ye,ab as ve,j as f,S as i,L as y,a8 as he,ak as Se,a3 as P}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{g as we,a as $e,b as be,s as Pe,c as Ce}from"./ssh-g_xvV-TS.js?v=1773287522785";import{k as te,a0 as Le,o as ke,au as Ae,_ as Te,av as Ee,B as Re,as as Be,a8 as xe,a6 as Ue,a3 as Ie,a4 as Oe}from"./naive-ui--dJnpVcV.js?v=1773287522785";const{t:K}=z.global,He=e=>$.post("/logs/panel/get_panel_login_log",e),ze=()=>$.post("/ssh_security?action=get_sshd_anti_logs"),De=()=>$.post("/safe/serversafe/get_security_info"),Q=e=>$.post("/safe/serversafe/repair_security",{data:JSON.stringify(e)},{requestOptions:{loading:K("Component.Pay.index_12"),successMessage:!0}}),Ne=e=>$.post("/ssh_security?action=set_anti_conf",e,{requestOptions:{loading:K("Component.Pay.index_12"),successMessage:!0}}),dt=()=>$.post("/ssh_security?action=get_anti_conf"),pt=e=>$.post("/ssh_security?action=del_ban_ip",e,{requestOptions:{loading:K("Component.Pay.index_12"),successMessage:!0}}),{t:H}=z.global,k=pe("service",()=>{const e=O({sshPort:22,complexityLevel:3,minPasswordLength:15,sshAlert:!1,sshProtection:!1,panelAlert:!1,panelOtp:!1,panelSsl:!0,noLoginCode:404,rootLoginType:"without-password",sshKey:!0}),o=O({score:0,total_score:100,score_text:"-",loading:!1}),s=O([{label:H("Total banned IP"),value:"-"},{label:H("Total failed connection"),value:"-"},{label:H("Current banned IP"),value:"-"},{label:H("Current failed connection"),value:"-"}]),m=fe([]),d=O({install:!0}),D=async()=>{const{message:p}=await we();L(p)&&(d.install=p.fail2ban.installed===1,e.sshKey=p.config.pubkey==="yes")},N=async()=>{var p,t,c,E,C,R,B,x,v,U;try{o.loading=!0;const{message:u}=await De();if(L(u)&&(o.score=u.score,o.total_score=u.total_score,o.score_text=u.score_text,m.value=u.security_data,e.sshPort=(p=u.security_data.find(l=>l.id===1))==null?void 0:p.value,e.complexityLevel=(t=u.security_data.find(l=>l.id===2))==null?void 0:t.value,e.minPasswordLength=(c=u.security_data.find(l=>l.id===3))==null?void 0:c.value,e.sshAlert=!!((E=u.security_data.find(l=>l.id===4))!=null&&E.status),e.sshProtection=!!((C=u.security_data.find(l=>l.id===6))!=null&&C.value),e.panelAlert=!!((R=u.security_data.find(l=>l.id===7))!=null&&R.status),e.panelOtp=(B=u.security_data.find(l=>l.id===8))==null?void 0:B.value,e.panelSsl=(x=u.security_data.find(l=>l.id===10))==null?void 0:x.value,e.noLoginCode=(v=u.security_data.find(l=>l.id===9))==null?void 0:v.value,e.rootLoginType=(U=u.security_data.find(l=>l.id===5))==null?void 0:U.value,o.loading=!1,e.sshProtection)){const{message:l}=await ze();L(l)&&(s[0].value=l.total_banned,s[1].value=l.total_failed,s[2].value=l.currently_banned,s[3].value=l.currently_failed)}}finally{o.loading=!1}},A=J([]),T=J([]);return{safeConfig:e,panelLogin:A,sshLogin:T,info:o,sshBruteForce:d,safeItems:m,protectionInfo:s,getSafeConfig:N,getPanelLogin:async()=>{const{message:p}=await He({limit:5,p:1});L(p)&&(A.value=p.data)},getSshLogin:async()=>{const{message:p}=await $e({limit:5,p:1,search:"",select:""});L(p)&&(T.value=p.data)},getBruteForceInfo:D}}),{t:W}=z.global,Ve=[{label:"403 - Access Denied",value:403},{label:"404 - Page Not Found",value:404},{label:"416 - Invalid Request",value:416},{label:"408 - Client Timeout",value:408},{label:"400 - Client Request Error",value:400},{label:"401 - Unauthorized Access",value:401}],ft=e=>{if(!e||typeof e!="string")return"-";const o=e.toLowerCase();return o.includes("edg/")?"Edge":o.includes("opr/")||o.includes("opera")?"Opera":o.includes("chrome")&&!o.includes("edg/")&&!o.includes("opr/")?"Chrome":o.includes("firefox")?"Firefox":o.includes("safari")&&!o.includes("chrome")?"Safari":o.includes("msie")||o.includes("trident/")?"IE":"Unknown"},gt=e=>e<=50?"text-error":e>50&&e<80?"text-warning":"text-primary",Fe=()=>Math.floor(Math.random()*64536)+1e3,Me=async()=>{const{safeConfig:e}=k();if(!e.sshKey){F.error(W("Security.SSH.Basic.index_25"));return}const{close:o}=F.loading(W("Security.SSH.Basic.index_26"));try{await be(),window.open("".concat(oe(),"/ssh_security?action=download_key"))}finally{o()}},qe={class:"p-16px"},Ke={class:"stat-box"},Ge={class:"flex justify-between"},je={class:"text-2xl font-bold"},Je={class:"color-desc"},Ze=Y({__name:"config-card",props:{title:{type:String,default:""},titleTips:{type:String,default:""},tips:{type:String,default:""}},setup(e){return(o,s)=>{const m=te,d=Le;return M(),ee("div",qe,[g("div",Ke,[g("div",Ge,[n(m,{class:"flex-col!"},{default:a(()=>[g("span",je,r(e.title),1),g("span",Je,r(e.titleTips),1)]),_:1}),n(m,{class:"flex-nowrap! items-center"},{default:a(()=>[Z(o.$slots,"default",{},void 0,!0)]),_:3})]),n(d,{class:"my-10px!"}),ge(g("span",null,r(e.tips),513),[[me,e.tips]]),Z(o.$slots,"content",{},void 0,!0)])])}}}),h=ae(Ze,[["__scopeId","data-v-9bf365a4"]]),Qe={class:"safety-config-page pb-20px"},We={class:"text-primary font-bold"},Xe={class:"text-primary"},Ye={class:"whitespace-nowrap"},et={class:"mb-10px"},tt=Y({__name:"config-safe",props:{target:{type:Number,default:0}},setup(e){const o=k(),{safeConfig:s}=q(o),m=e,d=()=>{o.getSafeConfig()},D=()=>{s.value.sshPort=Fe()},N=async()=>{await Pe({port:s.value.sshPort}),d()},A=async()=>{await Q({name:"Password Complexity Policy",args:{minclass:s.value.complexityLevel}}),d()},T=async()=>{await Q({name:"Password Length Limit",args:{len:s.value.minPasswordLength}}),d()},G=async t=>{st(t,d)},j=async()=>{await le({status_code:s.value.noLoginCode}),d()},p=async()=>{await Ce({p_type:s.value.rootLoginType}),d()};return _e(()=>{m.target&&ye(()=>{const t=document.getElementById(m.target.toString());t&&t.scrollIntoView({behavior:"smooth",block:"center"})})}),(t,c)=>{const E=ke,C=Te,R=ie,B=Ee,x=Ae,v=Re,U=ve("i18n-t"),u=Be,l=te,V=xe,se=Ue,I=Oe,ne=Ie;return M(),ee("div",Qe,[n(h,{id:"1",title:t.$t("SSH port change"),"title-tips":t.$t("Recommended: Use a non-22 port"),tips:t.$t("Modify the default SSH port to avoid malicious scanning"),class:y({"flash-border":e.target===1})},{default:a(()=>[n(E,{type:"warning",size:"small"},{default:a(()=>[f(r(t.$t("Important")),1)]),_:1}),n(x,{class:"w-200px"},{default:a(()=>[n(C,{value:i(s).sshPort,"onUpdate:value":c[0]||(c[0]=_=>i(s).sshPort=_),"show-button":!1},null,8,["value"]),n(B,{onClick:D},{default:a(()=>[n(R,{name:"base-refresh"})]),_:1})]),_:1}),n(v,{type:"primary",size:"small",onClick:N},{default:a(()=>[f(r(t.$t("Public.Btn.Apply")),1)]),_:1})]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:"2",title:t.$t("Password complexity"),"title-tips":t.$t("Recommended: Use a level greater than 3"),class:y({"flash-border":e.target===2})},{content:a(()=>[g("div",null,[n(U,{keypath:"Enable password complexity checks, the current complexity level will contain numbers, uppercase letters, lowercase letters, and special characters {a} types of characters"},{a:a(()=>[g("span",We,r(i(s).complexityLevel),1)]),_:1})]),n(l,{class:"items-center mt-10px"},{default:a(()=>[g("span",null,r(t.$t("Complexity level"))+":",1),n(u,{value:i(s).complexityLevel,"onUpdate:value":c[1]||(c[1]=_=>i(s).complexityLevel=_),min:1,max:4,step:1,class:"w-300px",onDragend:A},null,8,["value"]),g("span",Xe,r(i(s).complexityLevel)+"/4",1)]),_:1})]),_:1},8,["title","title-tips","class"]),n(h,{id:"3",title:t.$t("Password length limit"),"title-tips":t.$t("Recommended: Use a password length of 9-20 characters"),tips:t.$t("Set the minimum password length requirement"),class:y({"flash-border":e.target===3})},{default:a(()=>[g("span",Ye,r(t.$t("Minimum length"))+":",1),n(C,{"show-button":!1,value:i(s).minPasswordLength,"onUpdate:value":c[2]||(c[2]=_=>i(s).minPasswordLength=_),min:6,max:64,class:"w-100px",size:"small"},null,8,["value"]),n(v,{type:"primary",size:"small",onClick:T},{default:a(()=>[f(r(t.$t("Public.Btn.Apply")),1)]),_:1})]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:4,title:t.$t("SSH login alert"),"title-tips":t.$t("Recommended: Enable SSH login alerts"),tips:t.$t("Send alert notifications when SSH logs in"),class:y({"flash-border":e.target===4})},{default:a(()=>[g("span",{class:y(i(s).sshAlert?"text-primary":"text-error")},r(i(s).sshAlert?t.$t("Configured"):t.$t("Not configured")),3),n(v,{type:"primary",size:"small",onClick:c[3]||(c[3]=_=>i(X)(d,"7"))},{default:a(()=>[f(r(t.$t("Configure alert")),1)]),_:1})]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:"6",title:t.$t("SSH Brute Force Protection"),"title-tips":t.$t("Recommended: Enable SSH Brute Force Protection"),tips:t.$t("Deployed in the background after activation to prevent brute-force attacks"),class:y({"flash-border":e.target===6})},{default:a(()=>[n(V,{value:i(s).sshProtection,"onUpdate:value":c[4]||(c[4]=_=>i(nt)(d))},null,8,["value"])]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:"7",title:t.$t("Panel login alert"),"title-tips":t.$t("Recommended: Enable panel login alerts"),tips:t.$t("Send alert notifications when the panel logs in"),class:y({"flash-border":e.target===7})},{default:a(()=>[g("span",{class:y(i(s).panelAlert?"text-primary":"text-error")},r(i(s).panelAlert?t.$t("Configured"):t.$t("Not configured")),3),n(v,{type:"primary",size:"small",onClick:c[5]||(c[5]=_=>i(X)(d,"8"))},{default:a(()=>[f(r(t.$t("Configure alert")),1)]),_:1})]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:"8",title:t.$t("Panel Google Authenticator login"),"title-tips":t.$t("Recommended: Enable Google Authenticator login"),tips:t.$t("Enable Google Authenticator login to enhance security"),class:y({"flash-border":e.target===8})},{default:a(()=>[n(V,{value:i(s).panelOtp,"onUpdate:value":G},null,8,["value"])]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:"9",title:t.$t("Not logged in response status code"),"title-tips":t.$t("Recommended: Set 404 as the response code"),tips:t.$t("The security entry was incorrect and returned certain status"),class:y({"flash-border":e.target===9})},{default:a(()=>[n(se,{"consistent-menu-width":!1,value:i(s).noLoginCode,"onUpdate:value":c[6]||(c[6]=_=>i(s).noLoginCode=_),options:i(Ve),class:"w-200px",size:"small"},null,8,["value","options"]),n(v,{type:"primary",size:"small",onClick:j},{default:a(()=>[f(r(t.$t("Public.Btn.Apply")),1)]),_:1})]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:"10",title:t.$t("Panel SSL"),"title-tips":t.$t("Recommended: Enable panel HTTPS"),tips:t.$t("Enable HTTPS access (the panel will restart when set)"),class:y({"flash-border":e.target===10})},{default:a(()=>[n(V,{value:i(s).panelSsl,"onUpdate:value":i(ot)},null,8,["value","onUpdate:value"])]),_:1},8,["title","title-tips","tips","class"]),n(h,{id:"5",title:t.$t("Root password login settings"),"title-tips":t.$t("Recommended: Use only key login"),class:y({"flash-border":e.target===5})},{content:a(()=>[g("div",et,r(t.$t("Recommended to only allow key login")),1),n(ne,{value:i(s).rootLoginType,"onUpdate:value":c[7]||(c[7]=_=>i(s).rootLoginType=_)},{default:a(()=>[n(I,{value:"without-password"},{default:a(()=>[f(r(t.$t("Only key login")),1)]),_:1}),n(I,{value:"forced-commands-only"},{default:a(()=>[f(r(t.$t("Only command execution")),1)]),_:1}),n(I,{value:"yes"},{default:a(()=>[f(r(t.$t("Password and key login + key")),1)]),_:1}),n(I,{value:"no"},{default:a(()=>[f(r(t.$t("Prohibited login")),1)]),_:1})]),_:1},8,["value"])]),default:a(()=>[n(v,{type:"primary",size:"small",onClick:p},{default:a(()=>[f(r(t.$t("Public.Btn.Apply")),1)]),_:1})]),_:1},8,["title","title-tips","class"]),i(s).rootLoginType==="without-password"||i(s).rootLoginType==="yes"?(M(),he(h,{key:0,title:t.$t("Root key settings"),tips:t.$t("Enable YakPanel key, view and download")},{default:a(()=>[n(v,{type:"primary",size:"small",onClick:i(at)},{default:a(()=>[f(r(t.$t("View key")),1)]),_:1},8,["onClick"]),n(v,{size:"small",onClick:i(Me)},{default:a(()=>[f(r(t.$t("Download key")),1)]),_:1},8,["onClick"])]),_:1},8,["title","tips"])):Se("",!0)])}}}),{t:S}=z.global,mt=()=>{w({title:S("SSH protection configuration"),width:"400px",minHeight:"200px",footer:!0,component:P(()=>b(()=>import("./ssh-protection-config-Bf_maSWl.js?v=1773287522785"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])))})},_t=()=>{w({title:S("SSH protection log"),width:"600px",minHeight:"300px",component:P(()=>b(()=>import("./ssh-protection-log-CuKLhDHw.js?v=1773287522785"),__vite__mapDeps([27,28,29,2,3,4,5,6,7,30,13,14,31,32,33,1,34,35,15,10,8,11,12,9,16,17,18,19,20,21,22,23,24,25,26,36])))})},yt=e=>{w({title:S("Security configuration"),width:"800px",height:"800px",component:tt,data:{target:e}})},X=(e,o,s)=>{w({title:S("Configuration alarm task"),width:"860px",minHeight:"340px",footer:!0,data:{isEdit:!1,onRefresh:e,template_id:o,row:s},component:P(()=>b(()=>import("./form-DjNxICQD.js?v=1773287522785"),__vite__mapDeps([37,8,3,4,5,6,38,2,7,39,40,9,41,14,1,42,43])))})},st=async(e,o)=>{const s=k(),{safeConfig:m}=q(s);e?m.value.panelOtp?w({title:S("Config.Safe.index_62"),width:600,component:P(()=>b(()=>import("./config-Db5nkq_D.js?v=1773287522785"),__vite__mapDeps([44,1,2,3,4,5,6,7,9,45])))}):w({title:S("Config.Safe.index_63"),width:670,footer:!0,data:{onRefresh:o},component:P(()=>b(()=>import("./confirm-6yFLisEX.js?v=1773287522785"),__vite__mapDeps([46,47,2,3,4,5,6,7,10,1,8,11,12,9,13,14,15,16,17,18,19,20,21,22,23,24,25,44,45])))}):(await ce({act:0},!0),o())},nt=async e=>{const o=k(),{safeConfig:s,sshBruteForce:m}=q(o);if(!m.value.install){re("fail2ban",()=>{o.getBruteForceInfo()});return}await Ne({act:!s.value.sshProtection}),e()},ot=e=>{e?ue():de()},at=()=>{const{safeConfig:e}=k();if(!e.sshKey){F.error(S("Security.SSH.Basic.index_24"));return}w({title:S("Security.SSH.Basic.index_2"),width:"400px",minHeight:"322px",component:P(()=>b(()=>import("./view-BY3TF_FT.js?v=1773287522785"),__vite__mapDeps([48,11,3,4,5,6,2,7,12,33,9,26])))})};export{mt as a,_t as b,yt as c,ft as d,dt as e,pt as f,gt as g,ze as h,X as o,Ne as s,k as u};