2025/07/02

最近一堆user反應如下的問題 一直跳出來

























以系統管理員執行 certmgr.msc

























在這個位置找到以上的憑証
刪除

2025/06/30

之前有提到 ZAP 使用shell scan 網站的方法 
今天找到單純使用docker的做法

docker run --rm -v /tmp:/zap/wrk/:rw -t ghcr.io/zaproxy/zaproxy:nightly zap-full-scan.py -t https://192.168.24.206 -r 192.168.24.206.html

實際跑起來快 而且方便許多

一樣用shell 來跑 

一行一個網站       

https://aa.bb.com
https://dd.ee.com

寫到  /tmp/site_to_test


#!/bin/bash

while read line
do

    echo "$line"
    docker run --rm -v /tmp:/zap/wrk/:rw -t ghcr.io/zaproxy/zaproxy:stable zap-full-scan.py -t $line -r `echo $line|cut -d '/' -f 3`.html

done < /tmp/site_to_test 

如果沒使用 --rm 全部執行完成後會殘留很多 docker process
列出所有 docker process

docker ps -a

找到如下 process

CONTAINER ID   IMAGE                             COMMAND                   CREATED              STATUS                      PORTS                                       NAMES
0ec0935c4233   ghcr.io/zaproxy/zaproxy:nightly   "zap-full-scan.py -t…"   About a minute ago   Exited (2) 44 seconds ago

清除CONTAINER ID

docker rm 0ec0935c4233

列出所有docker image

docker images

REPOSITORY                TAG       IMAGE ID       CREATED        SIZE
ghcr.io/zaproxy/zaproxy   nightly   432cd81f7738   22 hours ago   2.11GB

清除 IMAGE ID image

docker rmi  432cd81f7738

2025/06/26

本次的ZAP掃出以下的中風險







去年已經出現 本來想說去年應該已經解決了
但今年還是看到 可能是解決不完整

先在 apache 的 CSP 設定內加入以下二行

frame-ancestors 'self';
form-action 'self';

再來處理 style-src
先把 'unsafe-inline' 拿掉
接下來處理的方式有二種

如果在html檔裡直接定義 css 

要使用 hash 或 nonce
使用 nonce 是比較方便的做法

首先在 apache config 裡

style-src 這個定義加上 'nonce-12345678'

12345678 建議置換為亂碼

之後在 css 定義裡加上 nonce 定義
nonce的字串必須跟apahce config裡的相同

<style nonce="123456789" type="text/css">
</style>

修改 html內文 把原本直接定義的style改成先定義css再引用 

例如原本是

<a href="123456.exe" style="color:red;">123456</a>

要改成

<a href="123456.exe" class="red-text">123456</a><br>

同時在上方的css定義加入 red-text

<style nonce="sjdfhs6849" type="text/css">

.red-text {
  color: red;
  font-size: 21px;
}

</style>


另外不使用 hash 跟 nonce 的方法是 把css以獨立檔案定義後再引用

建立 style.css

檔案內容如下

.red-text {
  color: red;
  font-size: 21px;
}

接下來在 html 的head中引用

<head>
<link rel="stylesheet" href="style.css">
</head>

html內文的修正方法如上

2025/06/22

今天把oracle linux 8 升到 almalinux 9

首先升到 almalinux 8

dnf update -y

curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

bash almalinux-deploy.sh


再升到 almalinux 9

dnf -y update

yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm

dnf install -y leapp-upgrade leapp-data-almalinux

leapp preupgrade

查看 log 解決升級會碰到的問題

cpu要改成 x86-64-v2 或以上

leapp upgrade


升完後

dnf -y update 出現以下訊息

warning: Signature not supported. Hash algorithm SHA1 not available.

需要清除有問題的 gpg-pubkey

列出所有 gpg key

rpm -qa gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'

刪除以下二個  gpg key

gpg-pubkey-ad986da3-5cabf60d    gpg(Oracle OSS group (Open Source Software group) <build@oss.oracle.com>)

gpg-pubkey-ced7258b-6525146f    gpg(AlmaLinux OS 8 <packager@almalinux.org>)

rpm -e gpg-pubkey-ad986da3-5cabf60d
rpm -e gpg-pubkey-ced7258b-6525146f


目前正常
再觀察看看


2025/06/19

為了解決近期弱掃出現的portmapper 中風險
決定把 rpcbind 關了
之後nfs全部走4版

systemctl disable rpcbind.socket
systemctl disable rpcbind.service

mount -t nfs4


2025/06/05

fwupd

超方便的firmware 更新工具

先安裝

apt install fwupd

dnf install fwupd

使用 fwupd 的方法非常簡單,基於執行命令和 正確的方法是始終更新資料庫 在繼續更新設備韌體之前,請先了解可用韌體的資訊。我們可以透過輸入以下內容來做到這一點:

sudo fwupdmgr refresh

至 查看哪些裝置支援 fwupd以及其當前狀態,如果有可用更新,則可以使用以下命令進行更新:

fwupdmgr get-devices

一旦您列出了設備,他們就可以 檢查韌體更新 可以透過運行:

fwupdmgr get-updates

如果有可用的韌體更新, 你可以透過運行來應用它們:

sudo fwupdmgr update

至 顯示已安裝的韌體更新列表 透過 fwupd,您可以使用以下命令來完成此操作:

fwupdmgr history


2025/06/03

由於之前試的guacamole會一直當几斷線
今天找看看 meshcentral能不能錄影
有提供
不過要修改 config.json
路徑在 meshcentral-data/config/json

範例如下

{
  "$schema": "https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json",
  "settings": {
    "cert": "10.0.0.1",
    "WANonly": true,
    "_LANonly": true,
    "sessionKey": "MyReallySecretPassword1",
    "port": 443,
    "aliasPort": 443,
    "redirPort": 80,
    "redirAliasPort": 80
  },
  "domains": {
    "": {
      "title": "MyServer",
      "title2": "Servername",
      "minify": true,
      "newAccounts": true,
      "userNameIsEmail": true,
      "SessionRecording": {
        "_onlySelectedUsers": true,
        "_onlySelectedUserGroups": true,
        "onlySelectedDeviceGroups": true,
        "filepath": "/tmp/",
        "index": true,
        "protocols": [1, 2 ],
        "_maxRecordings": 100,
        "maxRecordingDays": 180,
        "maxRecordingSizeMegabytes": 1024
      }
    }
  },
  "_letsencrypt": {
    "email": "myemail@mydomain.com",
    "names": "myserver.mydomain.com",
    "skipChallengeVerification": true,
    "production": false
  }
}

這裡的config設好後 
就不用像之前啟動要再加上 --cert 10.0.0.1 了

node node_modules/meshcentral