2026年9月2日水曜日

AltStore で the data couldn’t be read because it isn’t in the correct format

AltStore で the data couldn’t be read because it isn’t in the correct format

概要

対応策を紹介します

環境

  • macOS 26.6.2
  • AltServer 1.7.2
  • AltStore 2.2.1

対応策

  • iPhone の wifi をオフにする
  • Mac と有線接続する
  • AltServer 起動
  • AltStore 起動
  • アプリの更新

最後に

macOS をアップデートすると出る気がしなくもないです

2026年8月30日日曜日

semgrep 超入門

semgrep 超入門

概要

SAST しましょう

環境

  • macOS 26.6.2
  • semgrep 1.175.0

インストール

  • brew install semgrep

pip でもインストールできるのでグローバルにインストールしたくない場合は Pipfile や pyproject.toml を使いましょう

スキャン

  • semgrep --config=auto .

初回はルールのダウンロードが走ります
以下のようなエラーが良く出ます

  • CSS のインポート時に integrity がないから XSS されます
  • パスワードや鍵などのセンシティブ情報がコード内に含まれています
  • GithubActions や docker はタグじゃなくてコミットハッシュを指定しましょう、じゃないとサプライチェーンアタックの対象になる可能性があります

などなど出てきます

ルールセット

今回は auto でしたが p/ci や p/python など使えます

https://semgrep.dev/explore

OSS 版だと使えるルールセットが限られていますが Pro 版だとよりたくさんのルールセットが使えます

Gitlab CI

https://docs.semgrep.dev/semgrep-ci/sample-ci-configs

semgrep:
  # A Docker image with Semgrep installed.
  image: semgrep/semgrep
  # Run the "semgrep ci" command on the command line of the docker image.
  script: semgrep ci

  rules:
    # Allow triggering a scan manually from the GitLab UI
    - if: $CI_PIPELINE_SOURCE == "web"
    # Scan changed files in MRs, (diff-aware scanning):
    - if: $CI_MERGE_REQUEST_IID
    # Scan mainline (default) branches and report all findings.
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

  variables:
    # Connect to Semgrep AppSec Platform through your SEMGREP_APP_TOKEN.
    # Generate a token from Semgrep AppSec Platform > Settings
    # and add it as a variable in your GitLab CI/CD project settings.
    SEMGREP_APP_TOKEN: $SEMGREP_APP_TOKEN

こんな感じらしいです
当然ですがローカルで実行してエラーをすべて解消しないと CI してもエラーになるので注意してください

最後に

semgrep を試してみました
無料版でも十分使えるレベルかなと思います
あとカスタムルールも作成できるので足りなければ自分でルールを作成すれば SAST なり SCA できます

2026年8月24日月曜日

古い認証アルゴリズムの sshd を検証で起動する方法

古い認証アルゴリズムの sshd を検証で起動する方法

概要

検証用途で一時的に起動させる方法を紹介します

環境

  • Ubuntu 24.04
  • openssh-server 9.6p1

ホスト鍵作成

mkdir -p /tmp/sshd-legacy-test
if [ ! -f /tmp/sshd-legacy-test/ssh_host_rsa_key ]; then
ssh-keygen -q -t rsa -b 2048 -f /tmp/sshd-legacy-test/ssh_host_rsa_key -N ''
fi

設定ファイル作成

cat > /tmp/sshd-legacy-test/sshd_config <<'EOF'
Port 2222
ListenAddress 127.0.0.1
HostKey /tmp/sshd-legacy-test/ssh_host_rsa_key
PidFile /tmp/sshd-legacy-test/sshd.pid
LogLevel VERBOSE
UsePAM no
PasswordAuthentication no
KbdInteractiveAuthentication no
ChallengeResponseAuthentication no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PermitRootLogin no
AllowUsers devops

X11Forwarding no
AllowTcpForwarding no
PrintMotd no
Subsystem sftp internal-sftp

KexAlgorithms +diffie-hellman-group14-sha1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
EOF

設定ファイル確認

  • /usr/sbin/sshd -t -f /tmp/sshd-legacy-test/sshd_config

起動

  • /usr/sbin/sshd -D -e -f /tmp/sshd-legacy-test/sshd_config
  • ss -ltn | grep ':2222 '

停止

if [ -f /tmp/sshd-legacy-test/sshd.pid ]; then
kill "$(cat /tmp/sshd-legacy-test/sshd.pid)"
fi

2026年8月15日土曜日

キーチェインアクセスの GUI からパスワードが消せないときの対処方法

キーチェインアクセスの GUI からパスワードが消せないときの対処方法

概要

もうキーチェインアクセスはオワコンですが git などのコマンドは未だにキーチェインアクセスを参照しているのでキーチェインアクセス側に古いパスワードが残っている場合は削除しましょう

環境

  • macOS 26.5.2
  • git 2.55.0

コマンド

security delete-internet-password -s bitbucket.org  

bitbucket.org の部分は適宜変更してください

確認

security find-internet-password -s bitbucket.org

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain. になれば削除完了です

最後に

なぜか GUI からだと削除できないというなぞの現象が発生した場合は CLI を使いましょう

2026年8月3日月曜日

Stable diffusion forge Neo を試す

Stable diffusion forge Neo を試す

概要

WAI-illustrious-SDXL v17.0 が出たのでそれを試すために forge Neo が必要だったのでインストールから試してみました

環境

  • macOS 26.5.2 (m2 pro mac mini)
  • Python 3.13.14
  • StableDiffusion webui forge Neo 2.28

Python 準備

  • pyenv install 3.13.14

プロジェクトのクローン

  • git clone https://github.com/Haoming02/sd-webui-forge-classic sd-webui-forge-neo --branch neo --depth 1
  • cd sd-webui-forge-neo
  • pyenv local 3.13.14
  • pip install uv

プロジェクトのセットアップ

  • uv venv venv --python 3.13 --seed
  • vim webui-user.sh
# export TORCH_COMMAND="pip install torch==2.12.0 torchvision==0.27.0"

export TORCH_COMMAND="pip install torch==2.12.0 torchvision==0.27.0"

webui 起動

  • chmod +x webui-user.sh
  • ./webui-user.sh

webui 動作確認

localhost:7860 にアクセスできれば OK です

モデルのダウンロードとインストール

https://civitai.red/models/827184/wai-illustrious-sdxl ここからダウンロードします
6.46GB ほどあります

ダウンロードしたら以下に配置します

ls -l sd-webui-forge-neo/models/Stable-diffusion/

モデルを再配置したら念のため webui を再起動しましょう

動作確認

再度 webui にアクセスしモデルが読み込まれていることを確認します
そしてプロンプトとパラメータを入力します

  • Steps: 15-30
  • CFG scale: 5-7
  • Sampler: Euler a
  • Size: 1024x1024
  • Positive Prompt: ,masterpiece,best quality,amazing quality,
  • Negative Prompt: bad quality,worst quality,worst detail,sketch,censor,

あとはプロンプトを適当に調整し「Generate」してください

最後に

macOS でも普通に動作しました

参考サイト

2026年7月22日水曜日

Aider CLI + litellm で独自のエンドポイントを使う方法

Aider CLI + litellm で独自のエンドポイントを使う方法

概要

前回 Hermes CLI + litellm を試しました
今回は Aider CLI を試してみます

なお LLM は gpt を使い設定は Hermes と同じでいけます

環境

  • Ubuntu 24.04
  • Aider 0.86.2
  • litellm 1.90.2

インストール

  • curl -LsSf https://aider.chat/install.sh | sh

litellm_config.yaml

Azure OpenAI の gpt-5.1 をモデルを使う場合は以下のようにします
モデル名は適宜変更してください

model_list:
  - model_name: chatAI
    litellm_params:
      model: azure/gpt-5.1
      api_base: https://your-custom-endpoint/gpt-5.1
      api_key: os.environ/AI_SERVICE_API_KEY
      max_tokens: 4096
      temperature: 0.2
      rpm: 30
      tpm: 60000
    model_info:
      base_model: azure/gpt-5.1

litellm_settings:
  drop_params: true

general_settings:
  global_max_parallel_requests: 1
  max_parallel_requests: 1
  max_request_size_mb: 10

router_settings:
  num_retries: 0
  retry_after: 20
  allowed_fails: 1
  cooldown_time: 180
  timeout: 120
  stream_timeout: 120

server_settings:
  port: 4000

compose.yaml

litellm を起動します

services:
  litellm:
    image: docker.litellm.ai/berriai/litellm:latest
    container_name: litellm
    environment:
      - AI_SERVICE_API_KEY=${AI_SERVICE_API_KEY}
    ports:
      - "4000:4000"
    volumes:
      - ./litellm_config.yaml:/app/config.yaml
    restart: unless-stopped
    command: ["--config", "/app/config.yaml"]

動作確認

  • export AI_SERVICE_API_KEY=secret
  • docker compose up -d

で LiteLLM を起動します

  • export OPENAI_API_BASE=http://localhost:4000/v1
  • export OPENAI_API_KEY=dummy
  • aider --model openai/chatAI

設定ファイルではなく環境変数で LiteLLM に向けます
aider が OpenAI 互換の API を使うように openai/ というプレフィックスを付与してプロバイダ名を指定します

最後に

Aider + LiteLLM の設定を紹介しました
Aider 自体が内部的に LiteLLM を使っているので簡単に呼べるようになっていました

参考サイト

2026年7月21日火曜日

Hermes CLI + litellm で独自のエンドポイントを使う方法

Hermes CLI + litellm で独自のエンドポイントを使う方法

概要

前回 gemini-cli でカスタムエンドポイントを使う方法を紹介しました
今回は Hermes CLI でカスタムエンドポイントを紹介します
ただ gemini は使えなかったので gpt を使います (前回のように Python で頑張ればできるかもです)

環境

  • Ubuntu 24.04
  • hermes cli 0.18.2
    • python 3.11.15

インストール

  • curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash

~/.hermes/config.yaml

hermes cli からは litellm を使うように指定します
デフォルトだと他にも設定項目がいろいろありますが model の部分だけ以下のように修正してください
それ以外の項目はそのままで OK です

model:
  default: chatAI
  provider: custom
  base_url: http://localhost:4000/v1
  api_key: dummy

litellm_config.yaml

Azure OpenAI の gpt-5.1 をモデルを使う場合は以下のようにします
モデル名は適宜変更してください

model_list:
  - model_name: chatAI
    litellm_params:
      model: azure/gpt-5.1
      api_base: https://your-custom-endpoint/gpt-5.1
      api_key: os.environ/AI_SERVICE_API_KEY
      max_tokens: 4096
      temperature: 0.2
      rpm: 30
      tpm: 60000
    model_info:
      base_model: azure/gpt-5.1

litellm_settings:
  drop_params: true

general_settings:
  global_max_parallel_requests: 1
  max_parallel_requests: 1
  max_request_size_mb: 10

router_settings:
  num_retries: 0
  retry_after: 20
  allowed_fails: 1
  cooldown_time: 180
  timeout: 120
  stream_timeout: 120

server_settings:
  port: 4000

compose.yaml

litellm を起動します

services:
  litellm:
    image: docker.litellm.ai/berriai/litellm:latest
    container_name: litellm
    environment:
      - AI_SERVICE_API_KEY=${AI_SERVICE_API_KEY}
    ports:
      - "4000:4000"
    volumes:
      - ./litellm_config.yaml:/app/config.yaml
    restart: unless-stopped
    command: ["--config", "/app/config.yaml"]

動作確認

  • export AI_SERVICE_API_KEY=secret
  • docker compose up -d
  • hermes

最後に

Hermes CLI + litellm でカスタムエンドポイントを設定する方法を紹介しました
Hermes CLI 自体は Google AI Studio に対応しているので使えます
設定しているカスタムエンドポイント側の gemini が function calling や web_search に対応していなかったりリクエストやレスポンスの形式が少し異なる場合にはそのままでは使えません

前回のように Python なりでプロキシを立てて工夫する必要がありそうです

参考サイト