tipsmemo:tips
差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
| tipsmemo:tips [2018/06/19 04:49] – hayashi | tipsmemo:tips [2025/05/13 00:55] (現在) – hayashi | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== tips ====== | ====== tips ====== | ||
| + | | ||
| + | |||
| + | ===== Hush されたパスワードを生成する ===== | ||
| + | ==== sha512 ==== | ||
| + | |||
| + | perl | ||
| + | $ perl -e 'print crypt(" | ||
| + | $6$SALTsalt$UiZikbV3VeeBPsg8./ | ||
| + | openssl((1.1.1以降)) | ||
| + | |||
| + | $ openssl passwd -6 -salt SALTsalt password | ||
| + | $6$SALTsalt$UiZikbV3VeeBPsg8./ | ||
| + | |||
| + | ==== bcrypt ==== | ||
| + | |||
| + | $ php -r "echo password_hash(' | ||
| + | $2y$10$numGUgDvQ4yy0mflhCoq8efS7xBhG2D1CvoD.bTWZcBr2jkFpCO5S | ||
| + | |||
| + | ===== 正規表現 ===== | ||
| + | |||
| + | * [[http:// | ||
| + | * [[https:// | ||
| + | |||
| + | |||
| ===== 開いているポートを確認する ===== | ===== 開いているポートを確認する ===== | ||
| ==== netstat ==== | ==== netstat ==== | ||
| 行 6: | 行 30: | ||
| ...... | ...... | ||
| + | pidも見る((freeBSDでは動作しない)) | ||
| + | |||
| + | $ netstat -apn | grep LISTEN | ||
| + | tcp | ||
| + | ...... | ||
| + | |||
| + | * -aオプション-> | ||
| + | * -pオプション-> | ||
| + | * -nオプション-> | ||
| ==== lsof ==== | ==== lsof ==== | ||
| ファイル指定 | ファイル指定 | ||
| 行 71: | 行 104: | ||
| $ echo -n ' | $ echo -n ' | ||
| 31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c | 31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c | ||
| + | | ||
| $ echo -n ' | $ echo -n ' | ||
| ecb666d778725ec97307044d642bf4d160aabb76f56c0069c71ea25b1e926825 | ecb666d778725ec97307044d642bf4d160aabb76f56c0069c71ea25b1e926825 | ||
| - | | + | |
| $ echo -n " | $ echo -n " | ||
| (stdin)= 31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c | (stdin)= 31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c | ||
| + | | ||
| + | * -n: | ||
| + | * -a: | ||
| - | | + | GNU拡張 |
| - | -a: | + | $ openssl passwd |
| + | $1$SALTsalt$CEvzkj.qgOcLTyU2B5Kg3. | ||
| + | |||
| + | $ openssl passwd -apr1 -salt " | ||
| + | $apr1$SaltsALT$51lBhVKD0vAdzxUx/ | ||
| + | |||
| + | perl | ||
| + | $ perl -e 'print crypt(" | ||
| + | $6$SALTsalt$gH47I0mRGadJVVlIpeTxVlYw.SjkPOZ7lJoGkqOyhyeUJ7PV5QWuYpIG6D5ggew6RXLpl1eA72TpgX5pGDpr/ | ||
| + | python | ||
| + | $ python -c " | ||
| + | $6$SALTsalt$gH47I0mRGadJVVlIpeTxVlYw.SjkPOZ7lJoGkqOyhyeUJ7PV5QWuYpIG6D5ggew6RXLpl1eA72TpgX5pGDpr/ | ||
| + | |||
| + | ===== UUID生成 ===== | ||
| + | |||
| + | $ uuidgen -r | ||
| + | |||
| + | -r を付けないとランダム(UUID Version4)にならないので注意(@FreeBSD) | ||
| + | |||
| + | ===== WEBを静的HTMLとして保存 ===== | ||
| + | |||
| + | wget --mirror --page-requisites --html-extension --convert-links http:// | ||
| + | |||
| + | それぞれのオプションの意味 | ||
| + | |||
| + | |--mirror|ページ内のリンクを解析し、再帰的にダウンロード| | ||
| + | |--page-requisites|ページ内の画像、CSSをダウンロード| | ||
| + | |--html-extension|拡張子がないファイルに拡張子(.html)を付加| | ||
| + | |--convert-links|CSS、JSへの参照がURLになっている場合、相対パスに変換| | ||
| + | ===== ダミーファイルを作る ===== | ||
| + | 10Mbyte | ||
| + | # dd if=/ | ||
| + | |||
| + | Linuxならこれも((ddより早い)) | ||
| + | |||
| + | | ||
| + | |||
| + | |||
| + | ===== SSHでパイプしつつデータ転送 ===== | ||
| + | |||
| + | cat hoge.txt | ssh host " cat > / | ||
| + | |||
| + | ===== 相手のsshが古い ===== | ||
| + | 以下のようなエラーが発生します | ||
| + | |||
| + | Unable to negotiate with 192.168.xx.yyy port zz: no matching host key type found. Their offer: ssh-rsa, | ||
| + | |||
| + | 具体的には ssh-rsa や ssh-dss といった古い、脆弱性のあるアルゴリズムを無効にしているが、接続先のサーバーが古いアルゴリズムのみを提供しているため、接続を確立できずにエラーとなっている | ||
| + | 以下の様に使用するホスト鍵アルゴリズムを明示的に指定((サーバー側の SSH を更新しましょう)) | ||
| + | |||
| + | ssh -oHostKeyAlgorithms=ssh-rsa, | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== diff コマンドで横並びで表示したい ===== | ||
| + | |||
| + | diff -y path/ | ||
| + | |||
| + | 変更行のみを表示したい | ||
| + | |||
| + | diff -y --suppress-common-lines path/ | ||
| ===== Gitでcheckout時にPermission Denied ===== | ===== Gitでcheckout時にPermission Denied ===== | ||
| 行 99: | 行 197: | ||
| * 定期的に◯時間アクセスがないログファイルとかを削除したい時 | * 定期的に◯時間アクセスがないログファイルとかを削除したい時 | ||
| ===== ハードウェア情報 ===== | ===== ハードウェア情報 ===== | ||
| - | dmidecodeが便利 | + | dmidecodeが便利((要インストール)) |
| メモリ情報 | メモリ情報 | ||
| 行 150: | 行 248: | ||
| or | or | ||
| apachectl configtest | apachectl configtest | ||
| + | ==== nginx ==== | ||
| + | # nginx -t | ||
| + | | ||
| ==== postfix ==== | ==== postfix ==== | ||
| # postfix check | # postfix check | ||
| + | 何も出なければOK | ||
| + | ==== lighttpd ==== | ||
| + | |||
| + | # lighttpd -t -f / | ||
| + | |||
| + | |||
| + | ==== sshd ==== | ||
| + | |||
| + | # sshd -t | ||
| + | | ||
| + | 何も出なければOK | ||
| + | |||
| + | ==== dovecot ==== | ||
| + | |||
| + | # doveconf -n | ||
| + | |||
| + | ==== PHP ==== | ||
| + | <file php phpinfo.php> | ||
| + | <?php phpinfo(); ?> | ||
| + | </ | ||
| + | ==== Rspamd==== | ||
| + | |||
| + | rspamadm configtest | ||
| ===== 換算表(サブネットマスク) ===== | ===== 換算表(サブネットマスク) ===== | ||
tipsmemo/tips.1529383757.txt.gz · 最終更新: by hayashi
