好煩的outlook pst檔案最大只能50GB
舉個例子,很煩的是透過 imap , 麻瓜郵件放在server上超過 300GB , 但是ost/pst只能50GB, 就算封存50G, 還是不夠, 然後就沒有然後了(檔案掛掉).
爬文後, office 2016,2019以後, 可以設定最大值, 這個網站說可以到4PB ,也就是無限大了, 不知真假, 先把registry做好再說.
按此下載registry檔案 , 或是自己照著m$網站做也可以
舉個例子,很煩的是透過 imap , 麻瓜郵件放在server上超過 300GB , 但是ost/pst只能50GB, 就算封存50G, 還是不夠, 然後就沒有然後了(檔案掛掉).
爬文後, office 2016,2019以後, 可以設定最大值, 這個網站說可以到4PB ,也就是無限大了, 不知真假, 先把registry做好再說.
按此下載registry檔案 , 或是自己照著m$網站做也可以
公司某台筆電突然出現這個訊息, 原來是windows 7升級到windows 10, 判斷應該是升級後某種原因授權不過,這很怪,筆電購置一定都是正版的, 不過因為使用者急著用, 但是又一直跳出這視窗, 非常煩, 因此爬文, 先解決這惱人視窗問題.
做法好多種, 可以參考這裡 , 我自己用的是其中一種“停用windows授權管理員服務”&”windwos update”
我很少推薦軟體, 但是pst這個outlook檔案大怪獸, 麻瓜常常因為超過50G爆掉, 連outlook封存功能, 也在封存檔案超過50G爆掉的同時, 造成本體檔案損毀, 我召喚 m$ 內建的scanpst 藍袍法師, 法師會跟你說修復完畢, 其實是障眼法, 一律嘴巴說好, 但實際上pst身體很誠實地說修不好, 於是我踏上谷歌尋找修復pst軟體之路, 測試了很多很多種, 都扛不住檔案太大,直接秀逗不執行, 所以也不知修復能力如何, 好在皇天不負IT人, 終於找到 SysTools outlook recovery 簡單好用, 速度極快, 表裡如一, 也不貴 50美金, 極力推薦使用.
出事了阿伯! pve 某linux vm系統裡面有重要檔案誤刪,於是我把NAS上的snapshot還原(qcow2), 想說掛載到原vm成為另一個硬碟,再提取裡面的檔案使用。 這種土炮做法, 我記錄一下:
步驟4掛載的同時,出現以下問題
該partition為xfs
wrong fs type, bad option, bad superblock on /dev/vdd1, missing codepage or helper program, or other error.
這問題應該是該還原的檔案, 與原本的檔案有相同UUID才導致無法掛載,
解法如下:
# xfs_db -c uuid /dev/vdc1
UUID = 56283b3b-c2f3-525e-90db-e9d26def629d
# 用無UUID方式掛載
# mount -t xfs -o nouuid /dev/vdc1 /mnt
# xfs_admin -U generate /dev/vdc1
Clearing log and setting UUID
writing all SBs
new UUID = 1eb81512-3f22-4b79-9a35-f22f29745c60
這個我也不知道怎回事, 反正解法是想辦法用本地端帳號登入, 用NTPWEdit(點此下載)這款軟件, 搭配優啟通, 或是 usbox 開機碟製作工具, 先做出開機碟再開機->執行 NTPWEdit->選擇 C:\WINDOWS\SYSTEM32\CONFIG\SAM 改掉裡面本機帳號之密碼, 重開就可以本機帳號登入,
登入後, 先退出網域, 再重新加入網域, 就可以挽回網域主控站的心, 重新認可這台主機了
前一篇文章 Tailscale+Headscale 自架VPN全紀錄 讓 tailscale node 能夠透過 headscale 管控, 互相連線, 但是有些 tailscale node 隱藏在區域網路中, 無法互相p2p(peer to peer)直接連線, 這時候就需要 derp 伺服器提供轉接, derp 伺服器預設有很多, 若需要效率更好的,更無資安疑慮的, 可以自架.
我想也因為 derp 只做資料轉接, 不會偷看內容, 因此才會叫這個名字 DERP(笨蛋) XD.
derp 伺服器有很多, 可以參考tailscale官網 .
此外若derp轉接延遲時間太長, 就需要自架 , 可參考 https://tailscale.com/kb/1118/custom-derp-servers/
本文提供CentOS 7 安裝derp過程
wget https://golang.google.cn/dl/go1.20.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
export GOROOT=/usr/local/go
export GOPATH=/usr/local/gopath
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:$GOPATH/bin
source /etc/profile
#安裝完畢, 執行
/usr/local/go/bin/go version
go install tailscale.com/cmd/derper@main
#安裝完畢, 應該會在
/usr/local/gopath/bin/derper
先搞定letscrypt證書, 因為我選擇derp手動設定, 所以文件要對應好.
ln -s /etc/letsencrypt/live/derp.test.com/cert.pem /etc/letsencrypt/live/derp.test.com/derp.test.com.crt
ln -s /etc/letsencrypt/live/derp.test.com/privkey.pem /etc/letsencrypt/live/derp.test.com/derp.test.com.key
執行指令
#若要防止別人使用, 需先把derp server主機也加入tailscale 端點, 才可使用 --verify-clients 這個參數
/usr/local/gopath/bin/derper --hostname=derp.test.com --verify-clients -a=:8445 -http-port=-1 -certdir=/etc/letsencrypt/live/derp.test.com -certmode=manual -stun
#這樣就可以輸入 https://derp.test.com:8445 測試是否正常
新增 derp.yaml
重開 headscale 就可以,進行測試了
# 隨便找一個tailscale端點
tailscale netcheck
# 然後 tailscale ping <另一個端點的ip (100.64....)>
tailscale ping 100.64.0.2
在台灣, 我自己覺得架設derp除非有資安考量, 否則不見得需要.
Wireguard 與最近大熱門的ChatGPT一樣, 是邪惡的存在, 以往公司網管還能勉強管控員工自架VPN, P2P, 與遠端連線, 雖說辛苦,但員工相關網路行為終究掌握在手中.
現在不得了了, 使用wireguard技術的 Tailscale 已攔不住, 隨隨便便就能翻牆, 穿透內網. 我們網管就像是鯀, 治水用阻擋的方式不再可行 , 該是要全面開放, 採用全面零信任的思維+員工契約進行資通安全的管控.
“新暗網時代” , 用wireguard, 能讓一個小群體, 自成一個暗網, 也可自行打造VPN暗黑王國, 市面上網紅推薦的乾爹乾爸VPN, 未來亦將勢微.
本文著重在翻牆, 與簽入公司內部網路, 若用來做site to site請參考以下 tailscale 建議, 直接用Wireguard 比較好.
Using WireGuard directly offers better performance than using Tailscale. Tailscale does more than WireGuard, so that will always be true. We aim to minimize that gap, and Tailscale generally offers good bandwidth and excellent latency, particularly compared to non-WireGuard VPNs.
環境
架設Headscale+UI
# 存放headscale設定檔按
mkdir -p /root/headscale/config
mkdir -p /root/headscale/data
# 虛擬網路
docker network create reverseproxy-nw
vi /root/headscale/docker-compose.yml
###############################################################################
version: '3.5'
services:
headscale:
image: headscale/headscale:0.21
container_name: headscale
volumes:
- '~/config:/etc/headscale'
- '~/data:/var/lib/headscale'
ports:
- 8081:8080
- 50443:50443
command: headscale serve
restart: unless-stopped
networks:
reverseproxy-nw:
headscale-ui:
image: ghcr.io/gurucomputing/headscale-ui:latest
restart: unless-stopped
container_name: headscale-ui
ports:
- 9443:443
networks:
reverseproxy-nw:
networks:
reverseproxy-nw:
external: true
volumes:
data:
driver: local
config:
driver: local
###############################################################################
wget https://github.com/juanfont/headscale/raw/main/config-example.yaml -O /root/headscale/config/config.yaml
# 下載完畢, 修改yaml檔案中以下參數
server_url: https://headscale.test.com
listen_addr: 0.0.0.0:8080
base_domain: test.com
#是否改寫用戶端dns,請自行測試, 依照需求決定
override_local_dns: true
# 提供(expose)給用戶端dns
nameservers:
- 1.1.1.1
- 8.8.4.4
# 公司內部專用網址,可分別參考不同dns
restricted_nameservers:
test.com:
- 192.168.1.1
# 停用magic dns
magic_dns: false
#其他如derp, 有機會再另外寫文章
cd /root/headscale
docker-compose up -d
<VirtualHost *:443>
ServerName headscale.test.com
ErrorLog /var/log/httpd/ssl_error_log
TransferLog /var/log/httpd/ssl_access_log
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/headscale.test.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/headscale.test.com/privkey.pem
SSLCACertificateFile /etc/letsencrypt//live/headscale.test.com/fullchain.pem
SSLProxyEngine On
ProxyPreserveHost On
Header add Access-Control-Allow-Origin "test.com";
SSLProxyCheckPeerName off
ProxyPass /web https://localhost:9443/web
ProxyPassReverse /web https://localhost:9443/web
ProxyPass / http://localhost:8081/ upgrade=any
ProxyPassReverse / http://localhost:8081/ upgrade=any
</VirtualHost>
https://headscale.test.com/windows
docker exec -it headscale headscale apikey create
# 建立使用者
# docker exec headscale headscale users create <使用者>
docker exec headscale headscale users create hlmtvpn
# 產生authkey, 讓tailscale端點使用
docker exec headscale headscale --user hlmtvpn preauthkeys create --reusable --expiration 24h
1. 列出 tailscale 端點
docker exec headscale headscale node list
2. 刪除 tailscale 端點
docker exec headscale headscale node delete -i <ID>
docker exec headscale headscale node delete -i 1
3. 列出 tailsacle 路由
docker exec headscale headscale route list
4. 啟用路由功能
docker exec headscale headscale route enable -r <ID>
5. 刪除路由表
docker exec headscale headscale route delete -r <ID> --force
公司架設tailscale 端點
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update
sudo apt-get install tailscale
# http://headscale.test.com:8080是 headscale對外的URL
# d72e7351e24bbd21ecc99bbf5004c3e1f7cffa0631f8f5d5 是 authkey
# nat , 翻牆
tailscale up --reset --accept-routes --advertise-exit-node --snat-subnet-routes=true --accept-dns=false --advertise-routes=192.168.1.0/24 --login-server=https://headscale.test.com --authkey=d72e7351e24bbd21ecc99bbf5004c3e1f7cffa0631f8f5d5
# site to site , 不翻牆
tailscale up --reset --accept-routes --snat-subnet-routes=false --accept-dns=false --advertise-routes=192.168.1.0/24 --login-server=https://headscale.hlmt.com.tw --authkey=d72e7351e24bbd21ecc99bbf5004c3e1f7cffa0631f8f5d5
# 主機為vp, 不需要對外ip, 只要內網ip, 可上網, 要加上forward功能
# https://tailscale.com/kb/1019/subnets/
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
#列出路由表
docker exec headscale headscale route list
#啟用路由
docker exec headscale headscale route enable -r <ID>
公司主要路由(router), 須額外設定靜態路由
若需要做到site to site
PC 用戶端安裝tailscale端點(可翻牆)
cd C:\Program Files\Tailscale
tailscale login --login-server https://headscale.test.com --exit-node=<headscale ip 可為headscale server local ip> --exit-node-allow-lan-access=true
此時網頁會出現一串指令, 請將該node key 給管理人員註冊
**這邊要注意的是網址指令裡面的 USERNAME , 是一開始 headscale 新增的使用者帳號.
# 管理人員到headscale主機註冊
docker exec headscale headscale nodes register --user hlmtvpn --key nodekey:32a95789aa71c2dc7ccfa43a16cf1cff575e318c0a67117370ec9c847ff76828
若管理人員註冊完成, PC上面的tailscale會自動登入, 代表註冊成功, 此時可以選擇變身成公司tailscale 端點(如下圖 william-standard-pc-i440fx-piix-1996) , 就可以以公司ip的名義上網翻牆, 當然也可也存取公司內網(tiptop erp不行).
Android
原本想簡單用linux安裝wireguard 來達到site to site vpn , 無奈搞不定 , 只能依靠OPNsense幫忙了.
OPNsense 幾乎與pfSense 齊名, 是款開源免費,以及補漏洞快速的防火牆軟體, 評估後,我用OPNsense有三個理由:
目前還需要wireguard改善的:
情境 site to site vpn
Site A
對外IP: 192.168.1.1 , udp port: 65536
內網: 10.192.130.15/24
Wireguard Tunnel ip : 10.1.0.1/24
Site B
對外IP: 192.168.2.1 , udp port: 65536
內網: 191.1.0.0/24
Wireguard Tunnel ip : 10.1.0.2/24
安裝步驟:
另外一邊服務器, 請務必也用OPNsense , 不要像我這樣走冤枉路, 一邊OPNsense, 一邊Linux, 或是docker, 作法同上步驟, 資料記得不可一模一樣, 每個服務器ip, udp port , public key, 都不一樣
完成後, 可以到 lobby 查看, Lobby->Dashboard->右下角wireguard-go
ps.
1. 上面有一步驟可以輸入preshared key (也可以不輸入) , 若要輸入, 需登入OPNsense , 輸入 wg genpsk 即可產生, 這個key要放到所有相連結的服務器, Endpoints裡面
2. 參考資料 https://www.thomas-krenn.com/en/wiki/OPNsense_WireGuard_VPN_Site-to-Site_configuration
我打算用OPNsense取代目前老舊的硬體防火牆(Fortigate 80C) , 後來透過OPNsense 外掛, 試了suricata, AdGuard Home, tailcale , wireguard , 總共花了我2周的時間, 對於VPN, site to site , point to site 也都玩了一輪.
其中對於VPN心得:
wireguard 設定檔簡單解釋如下, 檔案為/etc/wireguard/wg0.conf, 該設定檔可形成 site to site , 但我在Linux設定一直失敗, 只能用NAT方式,最後發現OPNsense才能做到真正的site to site 功能, 太怪了!
[Interface] # Site A # private key PrivateKey = CG0svjlK7NdZ3U0MdYQzBHx7adDi1p2UlhPFXdH4HHw= # Site A Tunnel IP Address = 10.1.0.1/32 ListenPort = 51820 [Peer] # Site B public key , tunnel ip 10.1.0.2/32 PublicKey = Jkdn621+amuCV8Wj7YQLMydtE9GO5kpq+oZdK/17XAY= # 允許Site B內網, 以及Site B的tunnel ip AllowedIPs = 10.1.0.2/32,10.176.5.0/24 Endpoint = <Site B 對外ip>:51820 PersistentKeepalive = 25 [Peer] # Site C public key , tunnel ip 10.1.0.3/32 PublicKey = VaVaSY6SkizEhexj9vSTkzKgaIo5MwMnulu6I/D+iAI= # 允許Site C內網, 以及Site C的tunnel ip AllowedIPs = 10.1.0.3/32,192.1.0.0/22 Endpoint = <Site B 對外ip>:51820 PersistentKeepalive = 25