Files
yakpanel-core/YakPanel/static/vite/js/index-legacy-DDy04nFi.js
2026-04-07 02:04:22 +05:30

2 lines
14 KiB
JavaScript

System.register(["./index-legacy-DQdImDha.js?v=1773287522785","./index-legacy-xAbE4LTr.js?v=1773287522785","./vue-core-legacy-Cn1vuJ3s.js?v=1773287522785","./ssh-legacy-DyU8FGQu.js?v=1773287522785","./naive-ui-legacy-BW82sq8q.js?v=1773287522785"],(function(e,t){"use strict";var a,s,l,i,o,n,r,c,d,p,u,g,f,y,m,h,v,_,b,x,w,$,S,C,P,k,L,H,A,R,T,B,E,U,j,z,I,O,F,q,M,N,K,D,G,V,Z,J,Q,W,X,Y,ee,te,ae;return{setters:[e=>{a=e.as,s=e.a3,l=e.i,i=e.m,o=e.g,n=e.c,r=e.l,c=e.c9,d=e.p,p=e.P,u=e.af,g=e.ca},e=>{f=e.f,y=e.g},e=>{m=e.a4,h=e.e,v=e.x,_=e.r,b=e.k,x=e.$,w=e.Z,$=e._,S=e.a0,C=e.a9,P=e.aa,k=e.q,L=e.l,H=e.v,A=e.a6,R=e.o,T=e.n,B=e.ab,E=e.j,U=e.S,j=e.L,z=e.a8,I=e.ak,O=e.a3},e=>{F=e.g,q=e.a,M=e.b,N=e.s,K=e.c},e=>{D=e.k,G=e.a0,V=e.o,Z=e.au,J=e._,Q=e.av,W=e.B,X=e.as,Y=e.a8,ee=e.a6,te=e.a3,ae=e.a4}],execute:function(){var se=document.createElement("style");se.textContent=".stat-box[data-v-9bf365a4]{align-items:center;border-radius:8px;padding:16px;border:1px solid var(--color-border)}.flash-border .stat-box[data-v-9bf365a4]{animation:flash-green-9bf365a4 .8s ease-in-out 3}@keyframes flash-green-9bf365a4{0%,to{border-color:var(--color-border)}50%{border-color:#18a058;box-shadow:0 0 10px rgba(24,160,88,.3)}}\n/*$vite$:1*/",document.head.appendChild(se);const{t:le}=s.global,ie=e("h",(()=>a.post("/ssh_security?action=get_sshd_anti_logs"))),oe=e=>a.post("/safe/serversafe/repair_security",{data:JSON.stringify(e)},{requestOptions:{loading:le("Component.Pay.index_12"),successMessage:!0}}),ne=e("s",(e=>a.post("/ssh_security?action=set_anti_conf",e,{requestOptions:{loading:le("Component.Pay.index_12"),successMessage:!0}}))),{t:re}=(e("e",(()=>a.post("/ssh_security?action=get_anti_conf"))),e("f",(e=>a.post("/ssh_security?action=del_ban_ip",e,{requestOptions:{loading:le("Component.Pay.index_12"),successMessage:!0}}))),s.global),ce=e("u",m("service",(()=>{const e=h({sshPort:22,complexityLevel:3,minPasswordLength:15,sshAlert:!1,sshProtection:!1,panelAlert:!1,panelOtp:!1,panelSsl:!0,noLoginCode:404,rootLoginType:"without-password",sshKey:!0}),t=h({score:0,total_score:100,score_text:"-",loading:!1}),s=h([{label:re("Total banned IP"),value:"-"},{label:re("Total failed connection"),value:"-"},{label:re("Current banned IP"),value:"-"},{label:re("Current failed connection"),value:"-"}]),i=v([]),o=h({install:!0}),n=_([]),r=_([]);return{safeConfig:e,panelLogin:n,sshLogin:r,info:t,sshBruteForce:o,safeItems:i,protectionInfo:s,getSafeConfig:async()=>{try{t.loading=!0;const{message:o}=await a.post("/safe/serversafe/get_security_info");if(l(o)&&(t.score=o.score,t.total_score=o.total_score,t.score_text=o.score_text,i.value=o.security_data,e.sshPort=o.security_data.find((e=>1===e.id))?.value,e.complexityLevel=o.security_data.find((e=>2===e.id))?.value,e.minPasswordLength=o.security_data.find((e=>3===e.id))?.value,e.sshAlert=!!o.security_data.find((e=>4===e.id))?.status,e.sshProtection=!!o.security_data.find((e=>6===e.id))?.value,e.panelAlert=!!o.security_data.find((e=>7===e.id))?.status,e.panelOtp=o.security_data.find((e=>8===e.id))?.value,e.panelSsl=o.security_data.find((e=>10===e.id))?.value,e.noLoginCode=o.security_data.find((e=>9===e.id))?.value,e.rootLoginType=o.security_data.find((e=>5===e.id))?.value,t.loading=!1,e.sshProtection)){const{message:e}=await ie();l(e)&&(s[0].value=e.total_banned,s[1].value=e.total_failed,s[2].value=e.currently_banned,s[3].value=e.currently_failed)}}finally{t.loading=!1}},getPanelLogin:async()=>{const{message:e}=await(t={limit:5,p:1},a.post("/logs/panel/get_panel_login_log",t));var t;l(e)&&(n.value=e.data)},getSshLogin:async()=>{const{message:e}=await q({limit:5,p:1,search:"",select:""});l(e)&&(r.value=e.data)},getBruteForceInfo:async()=>{const{message:t}=await F();l(t)&&(o.install=1===t.fail2ban.installed,e.sshKey="yes"===t.config.pubkey)}}}))),{t:de}=s.global,pe=[{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}],ue=(e("d",(e=>{if(!e||"string"!=typeof e)return"-";const t=e.toLowerCase();return t.includes("edg/")?"Edge":t.includes("opr/")||t.includes("opera")?"Opera":!t.includes("chrome")||t.includes("edg/")||t.includes("opr/")?t.includes("firefox")?"Firefox":t.includes("safari")&&!t.includes("chrome")?"Safari":t.includes("msie")||t.includes("trident/")?"IE":"Unknown":"Chrome"})),e("g",(e=>e<=50?"text-error":e>50&&e<80?"text-warning":"text-primary")),async()=>{const{safeConfig:e}=ce();if(!e.sshKey)return void i.error(de("Security.SSH.Basic.index_25"));const{close:t}=i.loading(de("Security.SSH.Basic.index_26"));try{await M(),window.open(`${o()}/ssh_security?action=download_key`)}finally{t()}}),ge={class:"p-16px"},fe={class:"stat-box"},ye={class:"flex justify-between"},me={class:"text-2xl font-bold"},he={class:"color-desc"},ve=n(b({__name:"config-card",props:{title:{type:String,default:""},titleTips:{type:String,default:""},tips:{type:String,default:""}},setup:e=>(t,a)=>{const s=D,l=G;return x(),w("div",ge,[$("div",fe,[$("div",ye,[S(s,{class:"flex-col!"},{default:C((()=>[$("span",me,P(e.title),1),$("span",he,P(e.titleTips),1)])),_:1}),S(s,{class:"flex-nowrap! items-center"},{default:C((()=>[k(t.$slots,"default",{},void 0,!0)])),_:3})]),S(l,{class:"my-10px!"}),L($("span",null,P(e.tips),513),[[H,e.tips]]),k(t.$slots,"content",{},void 0,!0)])])}}),[["__scopeId","data-v-9bf365a4"]]),_e={class:"safety-config-page pb-20px"},be={class:"text-primary font-bold"},xe={class:"text-primary"},we={class:"whitespace-nowrap"},$e={class:"mb-10px"},Se=b({__name:"config-safe",props:{target:{type:Number,default:0}},setup(e){const t=ce(),{safeConfig:a}=A(t),s=e,l=()=>{t.getSafeConfig()},i=()=>{a.value.sshPort=Math.floor(64536*Math.random())+1e3},o=async()=>{await N({port:a.value.sshPort}),l()},n=async()=>{await oe({name:"Password Complexity Policy",args:{minclass:a.value.complexityLevel}}),l()},d=async()=>{await oe({name:"Password Length Limit",args:{len:a.value.minPasswordLength}}),l()},p=async e=>{ke(e,l)},u=async()=>{await c({status_code:a.value.noLoginCode}),l()},g=async()=>{await K({p_type:a.value.rootLoginType}),l()};return R((()=>{s.target&&T((()=>{const e=document.getElementById(s.target.toString());e&&e.scrollIntoView({behavior:"smooth",block:"center"})}))})),(t,s)=>{const c=V,f=J,y=r,m=Q,h=Z,v=W,_=B("i18n-t"),b=X,k=D,L=Y,H=ee,A=ae,R=te;return x(),w("div",_e,[S(ve,{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:j({"flash-border":1===e.target})},{default:C((()=>[S(c,{type:"warning",size:"small"},{default:C((()=>[E(P(t.$t("Important")),1)])),_:1}),S(h,{class:"w-200px"},{default:C((()=>[S(f,{value:U(a).sshPort,"onUpdate:value":s[0]||(s[0]=e=>U(a).sshPort=e),"show-button":!1},null,8,["value"]),S(m,{onClick:i},{default:C((()=>[S(y,{name:"base-refresh"})])),_:1})])),_:1}),S(v,{type:"primary",size:"small",onClick:o},{default:C((()=>[E(P(t.$t("Public.Btn.Apply")),1)])),_:1})])),_:1},8,["title","title-tips","tips","class"]),S(ve,{id:"2",title:t.$t("Password complexity"),"title-tips":t.$t("Recommended: Use a level greater than 3"),class:j({"flash-border":2===e.target})},{content:C((()=>[$("div",null,[S(_,{keypath:"Enable password complexity checks, the current complexity level will contain numbers, uppercase letters, lowercase letters, and special characters {a} types of characters"},{a:C((()=>[$("span",be,P(U(a).complexityLevel),1)])),_:1})]),S(k,{class:"items-center mt-10px"},{default:C((()=>[$("span",null,P(t.$t("Complexity level"))+":",1),S(b,{value:U(a).complexityLevel,"onUpdate:value":s[1]||(s[1]=e=>U(a).complexityLevel=e),min:1,max:4,step:1,class:"w-300px",onDragend:n},null,8,["value"]),$("span",xe,P(U(a).complexityLevel)+"/4",1)])),_:1})])),_:1},8,["title","title-tips","class"]),S(ve,{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:j({"flash-border":3===e.target})},{default:C((()=>[$("span",we,P(t.$t("Minimum length"))+":",1),S(f,{"show-button":!1,value:U(a).minPasswordLength,"onUpdate:value":s[2]||(s[2]=e=>U(a).minPasswordLength=e),min:6,max:64,class:"w-100px",size:"small"},null,8,["value"]),S(v,{type:"primary",size:"small",onClick:d},{default:C((()=>[E(P(t.$t("Public.Btn.Apply")),1)])),_:1})])),_:1},8,["title","title-tips","tips","class"]),S(ve,{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:j({"flash-border":4===e.target})},{default:C((()=>[$("span",{class:j(U(a).sshAlert?"text-primary":"text-error")},P(U(a).sshAlert?t.$t("Configured"):t.$t("Not configured")),3),S(v,{type:"primary",size:"small",onClick:s[3]||(s[3]=e=>U(Pe)(l,"7"))},{default:C((()=>[E(P(t.$t("Configure alert")),1)])),_:1})])),_:1},8,["title","title-tips","tips","class"]),S(ve,{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:j({"flash-border":6===e.target})},{default:C((()=>[S(L,{value:U(a).sshProtection,"onUpdate:value":s[4]||(s[4]=e=>U(Le)(l))},null,8,["value"])])),_:1},8,["title","title-tips","tips","class"]),S(ve,{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:j({"flash-border":7===e.target})},{default:C((()=>[$("span",{class:j(U(a).panelAlert?"text-primary":"text-error")},P(U(a).panelAlert?t.$t("Configured"):t.$t("Not configured")),3),S(v,{type:"primary",size:"small",onClick:s[5]||(s[5]=e=>U(Pe)(l,"8"))},{default:C((()=>[E(P(t.$t("Configure alert")),1)])),_:1})])),_:1},8,["title","title-tips","tips","class"]),S(ve,{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:j({"flash-border":8===e.target})},{default:C((()=>[S(L,{value:U(a).panelOtp,"onUpdate:value":p},null,8,["value"])])),_:1},8,["title","title-tips","tips","class"]),S(ve,{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:j({"flash-border":9===e.target})},{default:C((()=>[S(H,{"consistent-menu-width":!1,value:U(a).noLoginCode,"onUpdate:value":s[6]||(s[6]=e=>U(a).noLoginCode=e),options:U(pe),class:"w-200px",size:"small"},null,8,["value","options"]),S(v,{type:"primary",size:"small",onClick:u},{default:C((()=>[E(P(t.$t("Public.Btn.Apply")),1)])),_:1})])),_:1},8,["title","title-tips","tips","class"]),S(ve,{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:j({"flash-border":10===e.target})},{default:C((()=>[S(L,{value:U(a).panelSsl,"onUpdate:value":U(He)},null,8,["value","onUpdate:value"])])),_:1},8,["title","title-tips","tips","class"]),S(ve,{id:"5",title:t.$t("Root password login settings"),"title-tips":t.$t("Recommended: Use only key login"),class:j({"flash-border":5===e.target})},{content:C((()=>[$("div",$e,P(t.$t("Recommended to only allow key login")),1),S(R,{value:U(a).rootLoginType,"onUpdate:value":s[7]||(s[7]=e=>U(a).rootLoginType=e)},{default:C((()=>[S(A,{value:"without-password"},{default:C((()=>[E(P(t.$t("Only key login")),1)])),_:1}),S(A,{value:"forced-commands-only"},{default:C((()=>[E(P(t.$t("Only command execution")),1)])),_:1}),S(A,{value:"yes"},{default:C((()=>[E(P(t.$t("Password and key login + key")),1)])),_:1}),S(A,{value:"no"},{default:C((()=>[E(P(t.$t("Prohibited login")),1)])),_:1})])),_:1},8,["value"])])),default:C((()=>[S(v,{type:"primary",size:"small",onClick:g},{default:C((()=>[E(P(t.$t("Public.Btn.Apply")),1)])),_:1})])),_:1},8,["title","title-tips","class"]),"without-password"===U(a).rootLoginType||"yes"===U(a).rootLoginType?(x(),z(ve,{key:0,title:t.$t("Root key settings"),tips:t.$t("Enable YakPanel key, view and download")},{default:C((()=>[S(v,{type:"primary",size:"small",onClick:U(Ae)},{default:C((()=>[E(P(t.$t("View key")),1)])),_:1},8,["onClick"]),S(v,{size:"small",onClick:U(ue)},{default:C((()=>[E(P(t.$t("Download key")),1)])),_:1},8,["onClick"])])),_:1},8,["title","tips"])):I("",!0)])}}}),{t:Ce}=s.global,Pe=(e("a",(()=>{d({title:Ce("SSH protection configuration"),width:"400px",minHeight:"200px",footer:!0,component:O((()=>p((()=>t.import("./ssh-protection-config-legacy-DBWdhRuO.js?v=1773287522785")),void 0)))})})),e("b",(()=>{d({title:Ce("SSH protection log"),width:"600px",minHeight:"300px",component:O((()=>p((()=>t.import("./ssh-protection-log-legacy-B-cG2FeW.js?v=1773287522785")),void 0)))})})),e("c",(e=>{d({title:Ce("Security configuration"),width:"800px",height:"800px",component:Se,data:{target:e}})})),e("o",((e,a,s)=>{d({title:Ce("Configuration alarm task"),width:"860px",minHeight:"340px",footer:!0,data:{isEdit:!1,onRefresh:e,template_id:a,row:s},component:O((()=>p((()=>t.import("./form-legacy-DuvI0fIS.js?v=1773287522785")),void 0)))})}))),ke=async(e,a)=>{const s=ce(),{safeConfig:l}=A(s);e?l.value.panelOtp?d({title:Ce("Config.Safe.index_62"),width:600,component:O((()=>p((()=>t.import("./config-legacy-DLeSYE-1.js?v=1773287522785")),void 0)))}):d({title:Ce("Config.Safe.index_63"),width:670,footer:!0,data:{onRefresh:a},component:O((()=>p((()=>t.import("./confirm-legacy-ByQuhFNn.js?v=1773287522785")),void 0)))}):(await g({act:0},!0),a())},Le=async e=>{const t=ce(),{safeConfig:a,sshBruteForce:s}=A(t);s.value.install?(await ne({act:!a.value.sshProtection}),e()):u("fail2ban",(()=>{t.getBruteForceInfo()}))},He=e=>{e?f():y()},Ae=()=>{const{safeConfig:e}=ce();e.sshKey?d({title:Ce("Security.SSH.Basic.index_2"),width:"400px",minHeight:"322px",component:O((()=>p((()=>t.import("./view-legacy-4xDetiJK.js?v=1773287522785")),void 0)))}):i.error(Ce("Security.SSH.Basic.index_24"))}}}}));