|
发表于 2020-3-30 22:52:26
|
显示全部楼层
本帖最后由 cspm333 于 2020-3-30 23:15 编辑
目的是設計當有vpn用戶連線,可命系統mail到私人信箱進行通知。
原理是vpn帳戶可以綁一個profile設置,而連線成功後profile會運行on-up內的script。
:local date [/system clock get date]
:local time [/system clock get time]
:local yy [:pick $date 7 11]
:local mm [:find 0,jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:pick $date 0 3]]
:if ($mm<10) do={:set mm "0$mm"}
:local dd [:pick $date 4 6]
:set date "$yy/$mm/$dd"
:if (!($"caller-id" in 192.168.0.0/16)) do={
:local type [/interface get $interface type] ; :set type [:pick $type 0 [:find $type "-"]]
/tool fetch url="http://myip.chaip.vip:9080/ip\?ip=$"caller-id"" dst-path=from.txt
:local from [/file get from.txt contents] ; :set from [:pick $from [:find $from "["] ([:find $from "]"]+1)]
/tool e-mail send to="abc123@msa.hinet.net" subject="VPN-Client($user) login at $date $time" \
body="\nDate : $date\r\nTime : $time\r\nFrom : $"caller-id" $from\r\nAddress : $"local-address"\r\nType : $type\r\nName : $user"
}
用戶連線後,信箱接收到的通知:
因字型讓地理位置產生亂碼,請問這要如何解決?
|
|