mshogo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # セキュリティ演習 作戦会議 ## 役割分担(テキトウに編集して.被っても良いし) - 監視・まとめ:東原,山下 - 監視端末からサイトが見れるか購入できるか確認したり? - ログインユーザの監視`last`,`lastb`辺り? - 調査役:德田凜,谷﨑 - configファイルとlogファイル系精査するのかしら? - OS:芝,小池 - firewalld, 権限、ユーザとグループ管理系? - SSHの設定やログインの監視もここかな。 - Web:岡本, 西村 - Apache(httpd)の設定とかJava/Tomcatとか? - Web以外:室永,吉岡 - DNSやFTP、Mail辺り? ``` メンバー一覧 大枝(不参加) 岡本 小池 芝🍀 東原 谷﨑 德田(💩このスタンプを乱用する人です) 西村 室永 山下 吉岡 GODDARD(取り消し済み) ``` ## 参考 - [チートシート](https://drive.google.com/file/d/1DvWHfY-XMe7bsB_89GyYKLD4fo3wQKBk/view) ## 当日の環境 - OS: CentOS(学内から有線LANでSTのサーバにSSHする) |役割|ソフト名称|デーモン名称|稼働ポート番号|稼働状況確認|サービス再起動| |-|-|-|-|-|-| |Web|Apache|httpd|80|systemctl status httpd|systemctl restart httpd| |AP|tomcat|tomcat|18080|systemctl status tomcat|systemctl restart tomcat| |DNS|bind|named|53|sysemctl status named|systemctl restart named| |FTP|vsftp|vsfptd|21|systemctl status vsftpd|systemctl restart vsftpd| |Mail|posfix|postfix|25|操作禁止|操作禁止| |Mail|doveccot|dovecot|110,143|操作禁止|操作禁止| - Wordpress? - データベースサーバは? - Wordpress使ってECサイト構築するのにDB無いなんてこと有る?🍀 - 不正に挿入されたレコード(クロスサイトスクリプティング)削除するならSQL叩けないと困るけど?🍀 ## 予測される攻撃 と 対策 `この項目に関しては今週中にでもスライドの作成に取り掛かりたいですね~` - SQLインジェクション - PHPでエスケープ処理。 - [Javaだったらこの辺か?](https://media.zenet-web.co.jp/entry/2022/08/12/105846) - ディレクトリリスティング - ディレクトリリスティングの禁止(Apacheの設定)[^1] - サーバへの不正ログイン(ssh) - `last`, `lastb`で怪しいログイン(試行)を探す? - 見つけたらIPアドレスをFWのブラックリストに入れる? - パスワード認証の禁止(公開鍵認証)? - ちょっと手間かかるので一回目は様子見でも良いかも。🍀 - 不正ユーザによる不正操作 - `/var/log/secure`にsudoの使用やログインが記録される - クロスサイトスクリプティング - エスケープ処理。 - 挿入されてしまったレコードの削除は? ## 欲しいもの - ~~*モニター(他の人の画面を見る余裕がないとの噂)*~~ 申請しませんでした。 ## 事前準備 - CentOS触っておく(VirtualBox) - 権限設定周りのコマンド整理 - `chmod`, `chown`, `ls -al` - `firewalld`の使い方 - Apacheの設定(インタネット2) - ドキュメントルートの場所 - httpsの設定 - ディレクトリリスティングの禁止[^1] - DNS? 何すれば良い? - tomcatとは何か - APPサーバ(アプリケーション) - [参考URL](https://qiita.com/tanayasu1228/items/11e22a18dbfa796745b5) - クライアントはWEBサーバに対してリクエストを送るので、ApacheとTomcatがある場合にクライアントと最初に繋がるのはApacheになる - リクエストに対してApacheからWebアプリケーションを動作させるための実行環境であるTomcatへ必要な処理を要求する - DBとTomcatの間にJAVAが有り、そのJAVAがDBをたたきにいったり、必要なテンプレートを作成したりしている。(TomcatがDBをたたきにいくわけではないということ) - ↑ありがとう。「Webサーバ(Apache)ーアプリケーションサーバ(Tomcat)ーデータベースサーバ(MariaDB?不明)」の所謂Web3層アーキテクチャやね。🍀 - Webシステム開発でPHPがやっていたことをJacaScript+Tomcatで実現する模様。🍀 - データベース - 例えばクロスサイトスクリプティングで挿入された不正なレコードを削除したり? - 竹原パートの資料見る(特にセキュリティポイント) ## 当日やること - [ ] scriptコマンドで自分が実行したコマンドと出力のログをすべて記録する!(全員!) (timeスタンプのオプションがかなり使いづらかった(デフォルトだと標準エラー出力に数字のみ出力される)ので、-tでtimeオプションと使う場合はやらない、もしくはhistoryでコマンド履歴の参照のほうがいいかも) - [ ] HackMDでやったことを報告していく? - [ ] タイムスタンプどうする?🍀 「00:00 ○○コマンドで○○を実行」というように書き連ねていくのは? - [ ] Apacheの設定確認 - [ ] ドキュメントルートはどこ? デフォルトなら`/etc/httpd/conf/httpd.conf`の中に`DocumentRoot "/var/www/html"`とドキュメントルートの設定が書かれているはず - [ ] ポート番号は何番? - [ ] httpsの設定はしている? - 80番ポートってことはHTTPか?ECサイトの癖にそんな事ある?自分でHTTPS化しましょう的な?🍀 - でも下手に自己証明鍵認証とか組んだらBOT君たちがアクセスできなくなりそうで心配なんだがww🍀 - そうは言ってもインタネット繋がらないのに認証局(Let's Encryptとか)使えないよなあ?(笑)🍀 - [ ] firewallの設定 - [ ] ポートは何番が開いているか確認 <font color ="red">`ss`で現在のポートの状態</font> -ntを付けると接続が確率しているポート、-natでLISTENしているポートも表示される 例:ss -ntの場合`State Recv-Q Send-Q LocalAddress:Port peerAddress:Port Process`の順に `ESTAB 0 0 10.0.2.15:22 10.0.2.2:65521` - [ ] 不要なポートは閉じる。 - [ ] 演習用に開けておくポートなどがあるそう。(当日言われる) firewalld - [ ] SSHの設定 - [ ] rootログインの禁止(/etc/ssh/sshd_config) - [ ] ~~パスワードログインの禁止?公開鍵認証設定??~~ 面倒くさいのでとりあえずパス - [ ] ユーザとグループの確認 - [ ] ユーザとグループは何がある?Apacheユーザとか? - [ ] 権限の確認 - [ ] ユーザの適切な権限は?セカンダリグループは? - [ ] ドキュメントルートのディレクトリの権限 - [ ] Webページファイル(.php?.jsp?)の権限 - [ ] 所有者は? - [ ] ログインユーザの監視 - [ ] `last`, `lastb`, `lastlog`コマンド - [ ] `tail -f /var/log/httpd/access_log`でリアルタイム監視できる - [ ] 見つけたら該当のIPアドレスをFWで弾く? => FW担当者との意思疎通必要 - [ ] サービスが起動できているか監視 - [ ] `systemctl status apache2`など - [ ] DNSの設定確認 - [ ] ログファイルの場所は? - [ ] 設定ファイル(/etc/named.conf)に記載されているはず。 - [ ] プロセスの監視 - [ ] `ps aux`とか。 - [ ] 対処は`kill <pid>`とか ### ログファイルの場所とか - ログファイルの場所やコマンド - 各ソフトウェアのログ - sshd - /var/log/secure (かな、多分) - httpd(Apache) - /var/log/httpd/access_log - /var/log/httpd/error_log - (いずれもsudoが必要なはず) - Tomcat - [よぐわがんね](https://qiita.com/hidekatsu-izuno/items/ab604b6c764b5b5a86ed) - Bind - /var/named/log/transfer.log - firewalld - [設定で有効化する](https://security.sios.jp/guest/fiewalld-system-info-20190327/) - ftp - /var/log/vsftpd.log - /var/log/xferlog - mail - /var/log/maillog - cron(自動実行プログラム) - /var/log/cron - OSのログ - OSや認証からアプリケーションまで幅広く - /var/log/messages - sudoコマンドの使用やログイン認証 - /var/log/secure - ユーザログインのログ - `last`コマンド - `last -n 5`(直近5回)など - `lastb`コマンド(ログインの失敗) - `lastlog`コマンド(最終ログイン日時) - `lastlog -u <user>`など - `who`コマンド(ログイン中のユーザ) - tty, ptsとは #todo - `who -q`(ログイン中のユーザと人数)など - ユーザの作成 - /var/log/secure(同上) - ファイルシステムの監視 - ファイルやディレクトリの更新日時 - サービスの監視 - `systemctl status <サービス名>` - - プロセスの監視 - `ps`コマンド - `ps aux | grep <検索文字列>`とか - 設定ファイル - OS - /etc/passwd - /etc/group - Apache - ドキュメントルート - ディレクトリリスティング - SSH - rootログイン - パスワード認証 ### コマンド列 *~~書くか?~~ 書く。以下は例* - 権限の変更: `chmod NNN [ファイルなど]` - NNNは適切な数字。rwx 421の2進数 - わからない人は[これを読む](https://qiita.com/dev63/items/ceeaebeb7f587020c14c) - 所有者の変更: `chown [所有者]:[所有グループ] [ファイル/ディレクトリ]` - ユーザの作成: `useradd` - グループの作成: `groupadd` - ユーザの所属グループの追加: `usermod --append -G wheel <user>`など - ユーザのidや所属グループ確認: `id <user>` - ログインに失敗したログ: `sudo cat /var/log/secure* | grep "sshd" | grep "Failed password"` - ログインに成功したログ: `sudo cat /var/log/secure* | grep "sshd" | grep "Accepted"` - DNSが正常に動いているか確認するためのコマンド:`nslookup test1 `→該当するserverとaddressが返ってくる `nslookup xxx.yyy.zzz.aaa` →該当するドメイン名が返ってくる` - systemctlコマンド: `systemctl [命令] [サービス名]` - firewallの状態の確認: `systemctl status firewalld` - サーバの時刻とログインしているユーザ一覧: `date && who` - サービスの稼働状態を一気に確認: `sudo systemctl status httpd tomcat named vsftpd postfix dovecot firewalld | grep 'active (' -B 2` - /etc以下で10分以内に更新されたファイルを表示: `sudo find /etc -mmin -10` ## 発表スライドの内容 - 予測される攻撃と対策 - 発生した攻撃と実施した対応 - その他工夫したこと [^1]: [ディレクトリリスティングの禁止(Apache)](https://www.ritolab.com/posts/2)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully