2023年7月18日 星期二

[胡言亂語] 找 OLED 教學之啟發

https://gurgleapps.com/learn/projects/how-to-display-your-own-custom-image-on-a-small-oled-screen-using-our-free-tool

影片中的小孩大概只有小學和國中,台風真好,可以清楚解釋原理。

 

 嗯,有為者亦若是。

2023年6月27日 星期二

[資訊安全] Email Spoofing

最近收到好心人(?)的信,告知因為 MX 的設定不對,可能會有 Email Spoofing 的可能。 

會發生問題主要是 SPF 和 DMARC 設定不正確。 

舉例來說,原本參考 Google 的 SPF 設定建議。 

```

v=spf1 include:_spf.google.com ~all 

``` 

但在好心人的信裡,建議使用 `-` 取代 `~`,半信半疑,但有找到某篇文章說明這兩種區別,好吧就這樣用吧。 

``` 

v=spf1 include:_spf.google.com -all 

``` 

另外 DMARC 原本也是參考 Google 的建議。 

``` 

v=DMARC1; p=none; rua=mailto:dmarc-reports@google.com 

``` 

後來好心人建議,要有積極作為,因此改為 

``` 

v=DMARC1; p=reject; rua=mailto:dmarc-reports@google.com 

``` 

但其實我要講的重點是。 

1. rua 後面要先接 mailto 才行! 因為一開始看錯,導致掃描時顯示 DMARC 沒有 enable。 

2. 我只有付少少的獎金,希望大家都愉快。 

* [Google] 新增DMARC 記錄- Google Workspace 管理員說明 

* [Google] 在網域供應商網站新增SPF 記錄- Google Workspace 管理員說明 

* [MX 工具] SuperTool Beta7 

* [工具] DMARC Check 

* How To use an SPF Record to Prevent Spoofing & Improve E-mail Reliability 

* How to Implement DMARC/DKIM/SPF to Stop Email Spoofing/Phishing: The Definitive Guide

2023年6月10日 星期六

[創業] 好日子結束了

2023/06/08。 該來的還是要來,細水長流吧。

2023年5月3日 星期三

[Ubuntu] Crontab Permission denied

最近遇到 crontab 編輯問題。使用者 ubuntu 想編輯自己的 crontab,使用指令 `crontab -e` 出現錯誤訊息 `crontabs/ubuntu/: fdopen: Permission denied`

網路上比較像的解法大多是修改 `/usr/bin/crontab` 的使用者和權限,但是對我沒效。

比對了另外一台正常的機器,發現是 `/var/spool/cron/crontabs/` 使用者錯誤了。正確應該是長這樣

```

$ sudo ls -al /var/spool/cron/crontabs/
total 16
drwx-wx--T 2 root   crontab 4096 Jan  3 10:57 .
drwxr-xr-x 5 root   root    4096 Apr 20  2022 ..
-rw------- 1 root   crontab 1135 Aug 20  2022 root
-rw------- 1 ubuntu crontab 1337 Jan  3 10:57 ubuntu

```

2023年4月14日 星期五

[RPi] no authorized to perform operation

使用 2023-02-21-raspios-bullseye-armhf-full.img 的版本,或是有更新 raspberrypi-kernel,當按住 pico 的 BOOTSEL 要更新韌體時,出現 "no authorized to perform operation" 錯誤訊息。

爬文後,發現是 udisks daemon security policy 造成的。步驟是修改 /usr/share/polkit-1/actions/org.freedesktop.UDisks2.policy。
===
  <!-- Mounting filesystems -->
  <action id="org.freedesktop.udisks2.filesystem-mount">
    <description>Mount a filesystem</description>
...
    <defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>
===

改為
===
  <!-- Mounting filesystems -->
  <action id="org.freedesktop.udisks2.filesystem-mount">
    <description>Mount a filesystem</description>
...
    <defaults>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>
===

修改後不用重啟任何服務,直接再做一次就 OK 了

2023年4月12日 星期三

[RPi] cannot currently show the desktop

幾個方法:

1. 設定桌面登入。sudo raspi-config > 1 System Options > S5 Boot / Auto Login > B4 Desktop Autologin

2. 重新安裝 LXsession 程式,sudo apt-get install --reinstall libgtk2.0-0 && sudo apt-get install --reinstall lxsession

3. 正確設對桌面解析度(例如 800x600)。/boot/config.txt
===
hdmi_force_hotplug=1
framebuffer_width=800
framebuffer_height=600
hdmi_group=2
hdmi_mode=9
===

4. 正確設對 VNC 解析度(例如 800x600)。sudo raspi-config > 2 Display Options > D5 VNC Resolution > 800x600

5. 設定正確螢幕解析度。sudo raspi-config > 2 Display Options > D1 Resolution > DMT Mode 9 800x600 60Hz 4:3 (2022-01 以後預設不出現/不適用)


最後找了半天,比較了正常的和不正常的設定,包括 /etc/vnc 和 /etc/X11 下面的所有檔案和目錄,看不出差異。

又參考這篇翻了 /var/log/vncserver-x11.log 和 sudo systemctl status vncserver-x11-serviced.service 服務狀態,發現雖然服務有啟動,但是出現 "AgentInitCheck: agent comms failure" 錯誤訊息,實際上 vncserver-x11 沒有正常啟動。

最後找到這篇,雖然解法不正確,但有提供方向 ==>
The "direct capture" option is not working when running VNC Server on Raspberry Pi OS with the KMS driver (vc4-kms-v3d). The Fake KMS driver (vc4-fkms-v3d) is not affected.


簡單說,把 /boot/config.txt 裡面的 dtoverlay=vc4-kms-v3d 註解掉,重開機後收工!

參考:
* How to Fix Raspberry Pi's 'Cannot Currently Show the Desktop' Error
* Disabling direct capture on Raspberry Pi using the command line

2023年3月20日 星期一

[創業] 敗公司

2023/03/19 賀成交。希望能再戰十年。