2025
|
{"installed": { "client_id":"************-********************************.apps.googleusercontent.com", "project_id":"example0430", "auth_uri":"https://accounts.google.com/o/oauth2/auth", "token_uri":"https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs", "client_secret":"******-****************************", "redirect_uris":["http://localhost"] }}
項目 | 設定例 | 認識情報作成時 | 確認場所 | 備考 |
---|---|---|---|---|
アプリ名 | gmail0430oauth2 | OAuth同意 | ブランディング | 他のgoogleアプリとかぶらない名にする事 |
ユーザーサポートメール | example0430@gmail.com | OAuth同意 | ブランディング | ユーザーのgmailから選択 |
デベロッパーの連絡先情報 | example0430@gmail.com | OAuth同意 | ブランディング | ユーザーサポートメールと同じで良い |
スコープ(範囲) | https://mail.google.com/ | スコープ | データアクセス | Gmail のすべてのメールの閲覧、作成、送信、完全な削除 |
アプリケーションの種類 | デスクトップアプリ | OAuthクライアントID | クライアント | 名前 | desktop0430client01 | OAuthクライアントID | クライアント | コンソールでのクライアント識別 |
クライアントID | ************-********************************.apps.googleusercontent.com | - | クライアント | Google Cloud 自動生成ID |
クライアントシークレット | ******-**************************** | - | クライアント | Google Cloud 自動生成シークレット |
公開ステータス | テスト中 | - | 対象 | 変更しない。つまり、[アプリを公開]しない事 |
ユーザーの種類 | 外部 | - | 対象 | |
テストユーザー | example0430@gmail.com | - | 対象 | 自分のgmail等 |
名称 | URL |
---|---|
ブランディング | https://console.cloud.google.com/auth/branding |
対象 | https://console.cloud.google.com/auth/audience |
クライアント | https://console.cloud.google.com/auth/clients |
デーアアクセス | https://console.cloud.google.com/auth/scopes |
ロール | データ | 備考 |
---|---|---|
リソースオーナー | クライアントID, スコープ | Google Cloudののデータを使用 |
認可サーバ(https://accounts.google.com/o/oauth2/auth) | 認可コード | アクセストークン取得用 |
https://accounts.google.com/o/oauth2/auth?response_type=code &client_id=*************-********************************.apps.googleusercontent.com &state=xyz &scope=https://mail.google.com/ &redirect_uri=http://127.0.0.1/callbackGoogle Cloudのconsoleの[対象]で追加したテストユーザーの認証を求められる。
http://127.0.0.1/callback?state=xyz &code=*****_*******************************-_********************************** &scope=https://mail.google.com/※stateはリソースオーナー側でランダム生成した値。認可サーバからの返信に同じ値のstateがる事を確認する。
ロール | データ | 備考 |
---|---|---|
クライアント | クライアントID, クライアントシークレット, 認可コード | Google CloudののデータとSTEP 1で取得したコードを使用 |
トークンサーバ(https://oauth2.googleapis.com/token) | アクセストークン、リフレッシュトークン | リソースサーバアクセス用 |
curl -d "client_id=*************-********************************.apps.googleusercontent.com" \ -d "client_secret=******-****************-***********" \ -d "redirect_uri=http://127.0.0.1/callback" \ -d "grant_type=authorization_code" \ -d "code=*****_*******************************-_**********************************" \ https://oauth2.googleapis.com/token
{ "access_token": "****.**********************************************************************-********************************-********************************************************-********************************************************", "expires_in": 3599, "refresh_token": "*******************************-***************************************************************_*******", "scope": "https://mail.google.com/", "token_type": "Bearer", "refresh_token_expires_in": 604799 }%
update: 2025/05/01 21:04 | path: /pub/software/gmail
$ sudo apt install postfix procmail $ sudo dpkg -i sasl-xoauth2_0.20-1_amd64.deb sasl-xoauth2-tool_0.20-1_amd64.deb※ sasl-xoauth2 は debian experimental にある sasl-xoauth2 (0.20-1)を使用しました(R7年5月1日(木)現在 debian packageとしては、そこにしかない...)。
$ sudo dpkg-reconfigure postfix
項目 | 設定 | 備考 |
---|---|---|
General mail configuration type | スマートホスト付きインターネット Internet with smarthost | メールはSMTPを使用して直接受信するか、fetchmailなどのユーティリティを実行して受信します。送信メールはスマートホストを使用して送信されます。 Mail is received directly using SMTP or by running a utility such as fetchmail. Outgoing mail is sent using a smarthost. |
System mail name | (PCローカルHOST名に合わせる) | |
SMTP relay host | [smtp.gmail.com]:587 | Please specify a domain, host, host:port, [address] or [address]:port. |
Recipient for root and postmaster mail | (PCローカルのユーザー名) | Mail for the 'postmaster', 'root', and other system accounts needs to be redirected to the user account of the actual system administrator. |
メールを受け取るほかの宛先 (なければ空) | (空) | このマシンが最終的な宛先と見なされるドメインのリストを、コンマで区切って指定してください。 |
Local networks: | 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 | Please specify the network blocks for which this host should relay mail. The default is just the local host, which is needed by some mail user agents. |
Mailbox size limit (bytes) | 0 | A value of zero (0) means no limit. The upstream default is 51200000. |
Local address extension character | (空) | To not use address extensions, leave the string blank. |
利用するインターネットプロトコル | IPv4 | すべて : IPv4 と IPv6 アドレス両方を使う, IPv6: IPv6 アドレスのみをリスンする, ipv4: IPv4 アドレスのみをリスンする, |
mailbox_command = /usr/bin/procmail -a "$EXTENSION"
# SMTP Client TLS security level: none|may|encrypt|... smtp_tls_security_level = encrypt # SASL XOAUTH2 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = smtp_sasl_mechanism_filter = xoauth2
[smtp.gmail.com]:587 YourMail@gmail.com:/etc/tokens/YourMail@gmail.com※ SecretなFILEなのでchown 600 しましょう。
{ "client_id": "*************-********************************.apps.googleusercontent.com", "client_secret": "******-****************************" }認可サーバへの通信にproxyを使用する場合は、以下のようにproxy設定を記述する。
{ "client_id": "*************-********************************.apps.googleusercontent.com", "client_secret": "******-****************************", "proxy" : "http://proxy:8080" }※ SecretなFILEなのでchown 600 しましょう。
$ sasl-xoauth2-tool get-token gmail \ --client-id=*************-********************************.apps.googleusercontent.com \ --client-secret=******-**************************** \ --scope="https://mail.google.com/" \ /tmp/YourMail@gmail.com $ sudo mkdir -p /var/spool/postfix/etc/tokens $ sudo mv /tmp/YourMail@gmail.com /var/spool/postfix/etc/tokens $ sudo chown -R postfix:postfix /var/spool/postfix/etc/tokens※ chrootで実行している設定なので、/var/spool/postfix/ 以下をアクセスする為
$ sudo mkdir -p /var/spool/postfix/etc/ssl/certs $ sudo cp /etc/ssl/certs/ca-certificates.crt /var/spool/postfix/etc/ssl/certs/ca-certificates.crt※ chrootで実行している設定なので、/var/spool/postfix/ 以下をアクセスする為
$ sudo postmap /etc/postfix/sasl_passwd
$ sudo systemctl reload postfix
update: 2025/05/01 20:36 | path: /pub/software/mta
update: 2025/05/01 14:57 | path: /pub/software/mta
$ dpkg-source -x mew_6.9-1.dsc $ cd mew-6.9 $ vi debian/changelog # 変更内容記載し、versionを上げておく $ dpkg-buildpackage -us -uc $ cd .. $ sudo dpkg -i mew_6.9-5_all.deb mew-bin_6.9-5_amd64.deb
;;; for OAuth2.0 (setq mew-oauth2-client-id "*************-********************************.apps.googleusercontent.com") (setq mew-oauth2-client-secret "******-****************************") (setq mew-config-alist '(("MyGmail" ("user" . "MyName") ("mail-domain" . "gmail.com") ("prog-ssl" . "/usr/bin/stunnel") ("use-smtp-auth" . t) ("smtp-ssl" . t) ("smtp-server" . "smtp.gmail.com") ("smtp-ssl-port" . "465") ("smtp-auth-list" . ("XOAUTH2")) ("smtp-user" . "MyName@gmail.com") ("imap-ssl" . t) ("imap-server" . "imap.gmail.com") ("imap-ssl-port" . "993") ("imap-auth-list" . ("XOAUTH2")) ("imap-user" . "MyName@gmail") )))
update: 2025/05/01 14:52 | path: /pub/software/emacs
update: 2025/04/23 14:59 | path: /pub/software/vmware
update: 2025/04/16 13:15 | path: /pub/misc
update: 2025/04/16 07:43 | path: /pub/software/libreoffice
update: 2025/03/04 19:28 | path: /pub/health/ski
$ sudo apt install openjdk-21-jdk-headless tmux
$ cd ~/work/minecraft/select $ java -jar minecraft_server.1.21.4.jar --noguiサーバーに必要なファイルが展開される。その中の eula.txt のeula=trueに編集する。
eula=true
#!/bin/sh # memory on start MS=1G # max memory MX=6G # server SERVER=minecraft_server.1.21.4.jar cd "$(dirname "$0")" exec java -Xms$MS -Xmx$MX -jar $SERVER --nogui
#!/bin/bash # # mincraft_server start/stop/status script # # mincraft_server.jar 実行ユーザ USERNAME=`whoami` # session名 SESSION_NAME='minecraft' # minecraft_serverディレクトリ MC_PATH="/home/$USERNAME/work/minecraft/select" # 実行するminecraft_server.jar SERVICE="$MC_PATH/minecraft_server.1.21.4.jar" # メモリ設定 XMX='2G' XMS='1G' if [ ! -f $SERVICE ];then echo "No such file : $SERVICE" exit fi cd $MC_PATH # Minecraft 起動処理 start() { if pgrep -u $USERNAME -f $SERVICE > /dev/null; then echo "$SERVICE is already running!" else echo "Starting $SERVICE..." tmux new-session -d -s $SESSION_NAME tmux send-keys -t $SESSION_NAME:0 "java -Xmx$XMX -Xms$XMS -jar $SERVICE --nogui" C-m fi } # Minecraft 停止処理 stop() { if pgrep -u $USERNAME -f $SERVICE > /dev/null; then echo "Stopping $SERVICE" tmux send-keys -t $SESSION_NAME:0 "say SERVER SHUTTING DOWN IN 10 SECONDS. Saving map..." C-m tmux send-keys -t $SESSION_NAME:0 "save-all" C-m sleep 10 tmux send-keys -t $SESSION_NAME:0 "stop" C-m sleep 10 echo "Stopped minecraftserver" else echo "$SERVICE is not running!" exit fi while : do if pgrep -u $USERNAME -f $SERVICE > /dev/null; then echo "Stopping $SERVICE" sleep 10 else tmux kill-session -t $SESSION_NAME echo "Stoped $SERVICE" break fi done } # Minecraft 起動状態確認処理 status() { if pgrep -u $USERNAME -f $SERVICE > /dev/null; then echo "$SERVICE is already running!" exit else echo "$SERVICE is not running!" exit fi } case "$1" in start) echo "Minecraft Server Start" start ;; stop) echo "Minecraft Server Stop" stop ;; status) echo "Minecraft Server Check Status" status ;; *) echo "Invalid option" echo $"Usage: $0 {start|stop|status}" esac
[ { "uuid": "********-****-****-****-************", "name": "USERNAME1" }, { "uuid": "********-****-****-****-************", "name": "USERNAME2" } ]server.propertiesを編集する。
white-list=true変更を反映する場合は、
/whitelist reload
update: 2025/01/22 21:14 | path: /pub/software/game