平衡点


2026/10/20

_ パンプキン詐欺の spam メールの撃墜[Computer] 

「還付金詐欺がパンプキン詐欺に聞こえる」ってのは誰のネタだったっけ? としあさん?

閑話休題

最近, Subject や Body に U+200C (ゼロ幅非接合子), U+2060 (単語結合子), U+FEFF (ゼロ幅スペース) 入れたスパムが増えてて, ベイジアンスパムフィルタを擦り抜ける様になった.

まあ, 絵文字バリバリ使うんじゃなければ, こういった不可視文字列を Subject や Body に使う事は無いでしょう, ということで. エイヤっと procmail で判定して撃墜することに.

例えば

:0
* ! ^From:.*info@e-tax\.nta\.go\.jp
{
         SUBJECT=`formail -xSubject: | nkf -m -w | perl -CS -pe 's/[\x{200B}-\x{200D}\x{2060}\x{FEFF}]//g'`

        :0
        * SUBJECT ?? (還付|確定|税務署)
        {
                foldername='.Junk'
        }
}

とか?

とりあえずこれで様子見.

_ tDiary の野良パッチの不具合[tDiary] [Computer] 

なぜか update.rb が 500 を返していた. とりあえず 5.6.0 に更新したら直った. なんだったんだろうか.

(追記)

  • HTML5 にする monkey patch が悪さしてた…今迄, なんで動いてたんだろうかね.
    # coding: utf-8
    #
    # monky patching: replace <html> tag to html5
    #
    # Copyright (c) 2026 Youhei SASAKI <uwabami@gfd-dennou.org>
    #
    # You can redistribute it and/or modify it under GPL-2+
    
    require 'tdiary/base'
    
    module TDiary
      class TDiaryBase
        alias_method :_orig_eval_rhtml, :eval_rhtml
        
        def eval_rhtml( prefix = '' )
          html = _orig_eval_rhtml(prefix)
          is_update = File.basename($0) == 'update.rb'
          
          html.sub!(/<html(?: lang="(ja|en)-(?:JP|US)")?>/) do
    	# $1 には 'ja' か 'en' が入る。なければ nil
    	attr_lang = $1 ? "lang=\"#{$1}\"" : ""
    	"<html #{attr_lang} data-theme=\"light\">"
          end
          html.sub!(/^\t<meta charset="UTF-8">/,"\t<meta charset=\"utf-8\">")
          html.sub!(/^\t(<meta name="generator" content="tDiary #{h TDIARY_VERSION}">)/,"\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n\t\\1")
          html.sub!(/(width=device-width,initial-scale=1)/,'\\1,minimum-scale=1')
          html.sub!(/^<div class="whole-content">\n\n/,'')
          html   # <-- 抜けてた
        end
      end
    end
    
  • 序でに makerss の修正. PStore にゴミが入ってるのか, うまく更新できていなかったので
    diff --git a/plugins/makerss_custom.rb b/plugins/makerss_custom.rb
    index 47fc85e..e4206dc 100644
    --- a/plugins/makerss_custom.rb
    +++ b/plugins/makerss_custom.rb
    @@ -284,7 +284,7 @@ def makerss_update
        end
    
        rsses.each{|rss| rss.head( makerss_header( uri ) ) }
    -     db.keys.map{|k|get(db, k)}.sort.each_with_index do |rdfsec, idx|
    +     db.keys.map{|k|get(db, k)}.compact.sort.each_with_index do |rdfsec, idx|
        if rdfsec && rdfsec.section['visibility']
          rsses.each {|rss|
          rss.item( makerss_seq( uri, rdfsec ), makerss_body( uri, rdfsec ), rdfsec )
    

    他にも変な所ありそうだなぁ.

_ Apache2 の PQC 設定[Computer] 

とりあえず, 以下の様な塩梅だろうかねぇ…

SSLEngine On
SSLProtocol -all +TLSv1.3 +TLSv1.2
SSLOpenSSLConfCmd Curves X25519MLKEM768:SecP384r1MLKEM1024:X25519:secp384r1:prime256v1
SSLHonorCipherOrder On
SSLSessionTickets Off
SSLCompression Off
SSLStrictSNIVHostCheck Off
SSLUseStapling Off
SSLOptions +StrictRequire
SSLCipherSuite TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256

一応, Qualys SSL Labs は A+ になった. 古い iOS の Safari が軒並対応していないみたいだけれど、まあエエか(多分)。

日本って iPhone 率高いって聞くけど、古いまま使っている人多い印象…

_ tdiary-mode の修正[Computer] [Emacs] 

303 Redirect が返って来た時でも動く様にしてみたり

diff --git a/tdiary-mode.el b/tdiary-mode.el
index 029afe2..60f71e3 100644
--- a/tdiary-mode.el
+++ b/tdiary-mode.el
@@ -311,17 +311,25 @@ If error, return a cons cell (ERRCODE . DESCRIPTION)."
                            "\r\n"
                            str))
                "\r\n"))
-      (goto-char (point-min))
-      (while (not (search-forward "</body>" nil t))
-        (unless (accept-process-output connection tdiary-http-timeout)
-          (error "HTTP fetch: Connection timeout!"))
-        (goto-char (point-min)))
+      (catch 'done
+        (while t
+          (goto-char (point-min))
+          (when (or (search-forward "</body>" nil t)
+                    (save-excursion
+                      (goto-char (point-min))
+                      (and (re-search-forward "^HTTP/1\\.[01] 30[0-9]" nil t)
+                           (search-forward "\r\n\r\n" nil t)))
+                    (not (memq (process-status connection) '(open run))))
+            (throw 'done t))
+          (unless (accept-process-output connection tdiary-http-timeout)
+            (when (memq (process-status connection) '(open run))
+              (error "HTTP fetch: Connection timeout!")))))
       (goto-char (point-min))
       (save-excursion
         (if (re-search-forward "HTTP/1.[01] \\([0-9][0-9][0-9]\\) \\(.*\\)" nil t)
             (let ((code (match-string 1))
                   (desc (match-string 2)))
-              (cond ((equal code "200")
+              (cond ((member code '("200" "301" "302" "303"))
                      buf)
                     (t
                      (cons code desc)))))))))

ところで update_main.rb の run は

rescue TDiary::ForceRedirect
    res = TDiary::Response.new( '', 303, { 'location' => $!.path } )
    res.set_header('Set-Cookie', tdiary.cookies.map(&:to_s)) if tdiary && tdiary.cookies.size > 0
    res
end

じゃなくて,

rescue TDiary::ForceRedirect
    res = TDiary::Response.new( '', 303, {
        'location' => $!.path,
        'content-type' => 'text/html; charset=UTF-8',
        'content-length' => '0'
    } )
    res.set_header('Set-Cookie', tdiary.cookies.map(&:to_s)) if tdiary && tdiary.cookies.size > 0
    res
end

の方が良いんじゃないだろうか?


連絡先など

portrait

最近の日記

一覧

Back to Top ▲