發表文章

IIS Log 第三方代理處理

  IIS 建議優先檢查以下紀錄: 紀錄欄位 用途 c-ip 直接連線設備 IP CF-Connecting-IP 原始訪客 IP X-Forwarded-For 代理轉送來源 CF-Ray 比對 Cloudflare 請求紀錄 cs-uri-stem 被存取的網站路徑 cs-uri-query 請求參數 cs-method GET、POST 等請求方式 sc-status HTTP 回應狀態 cs(User-Agent) 訪客瀏覽器或攻擊工具特徵 一次新增以下四個欄位 Field Name Source Type Source CF-Connecting-IP Request Header CF-Connecting-IP X-Forwarded-For Request Header X-Forwarded-For CF-Ray Request Header CF-Ray CF-Connecting-IPv6 Request Header CF-Connecting-IPv6 各欄位用途: 欄位 用途 CF-Connecting-IP Cloudflare 傳遞的訪客來源 IP X-Forwarded-For 追蹤代理轉送的 IP CF-Ray 比對 Cloudflare 的請求及資安事件紀錄 CF-Connecting-IPv6 在特定 Cloudflare IPv4 轉換設定下保留原始 IPv6 c-ip(原本的欄位) IIS 實際收到的連線來源 IP,請保留 Cloudflare 官方建議優先使用 CF-Connecting-IP ,而不是 X-Forwarded-For 。

[MSSQL] 資料庫更新定序時,無法取得獨佔權

-- 設定資料庫為單一使用者模式,並強制終止所有其他連線 ALTER DATABASE [dbname] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; -- 更改資料庫的定序 ALTER DATABASE [dbname] COLLATE Chinese_Taiwan_Stroke_CI_AS;; -- 將資料庫設定回多使用者模式 ALTER DATABASE [dbname] SET MULTI_USER;

OpenSSH SSH SFTP 架設

Windows Server 2019 以上 及 Windows 10 以上 可以在新增功能找到 OpenSSH 伺服器 安裝 其他舊版本可以在 https://github.com/PowerShell/Win32-OpenSSH/releases 下載最新檔案安裝 安裝之後, 以系統管理員身分啟動PowerShell 啟動「OpenSSH SSH Server」服務,在終端機輸入指令: Start -Service sshd 確認當前防火牆規則,指令如下 Get-NetFirewallRule -Name *ssh* 新建立防火牆規則指令 New -NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 測試連線: 開啟命令提示字元,在內輸入: ssh username @servername username:電腦使用者帳號,servername:電腦IP 連線時會要你輸入密碼,密碼為電腦使用者的密碼,輸入時會沒有任何反應是正常的,為了保密。 第一次連線到伺服器時,應該會看到類似下列的訊息: The authenticity of host 'servername (10.00.00.001)' can't be established. ECDSA key fingerprint is SHA256:(<a large string>). Are you sure you want to continue connecting (yes/no)? 這邊輸入 yes

[MS-SQL] 單一使用者,立即中斷SQL Server連線

針對所有SQL Server連線查出現有連線,一一刪除 EXEC sp_who KILL spid號碼 刪除指定資料庫上的所有連線,並變更為單一使用者連線模式 USE master GO ALTER DATABASE [資料庫名稱] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO 切換回多人使用者連線模式 ALTER DATABASE [資料庫名稱] SET MULTI_USER; GO

[GIT]轉移整包git commit 至其他台主機

  先將原git的mirror整包 clone 下來 1 git clone --mirror https://git.compilerok/oldJob.git 到 gitlab 建一個空的 repo 進到專案資料夾,設定新的遠端 git repo 位置 1 2 cd oldJob .git/ git remote set-url --push origin https://Newgit.compilerok/newJob.git local 更新 remote branch,因為是新的 repo,並將本地的 origin/xxx 都刪囉。-p == --prune 1 git fetch -p origin 最後將整包 push 上去 1 git push --mirror 可以在 Gitl上看到 repo 裡有先前的所有紀錄與內容囉。

Mac OS Ventura XCode 無法使用 13.XXXX版

 Ventura 直接無法使用 XCode 13.X.X版 解決方式 直接從 Apple Developer 網站下載 Xcode 其實 Apple 官網一直有下載  .xip  壓縮檔版本 Xcode 的連結,但是藏得有點深。 下載頁面的首頁是  https://developer.apple.com/downloads 。 透過 xcode-install 套件管理 Xcode command line  xcode-install   Ruby 套件。 安裝 Xcode 11.0 : gem install xcode-install xcversion install 11.0 就會登入(使用跟 Fastlane 一樣的 Keychain 機制)、下載,並且解壓縮。 甚至可以列出所有可下載與已安裝的版本: xcversion update xcversion list 安裝或下載完成後, 不要直接點xcode.app 請用"顯示套件內容" 點選/Applications/Xcode_13.4.1.app/Contents/MacOS

[asp.net] 無法載入檔案或組件 'Antlr3.Runtime' 或其相依性的其中之一

無法載入檔案或組件 'Antlr3.Runtime' 或其相依性的其中之一。 存取被拒 ASP.NET MVC 4 讓使用者可以上傳檔案,存到另台SERVER 除了設定帳號外 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files 這個目錄也要賦予該帳號的寫入權限