task #366
masaya_abe さんが1日前に更新
Redmine2024年度弄くりながら回して,結構散らかっているので 最新バージョンにしつつ再度構築する. 2024よりセキュリティも少しマシにする. redmine2025構築メモ(未完) ### lightsailでbitnami redmineイメージをデプロイ ``` shell sudo apt-get update sudo apt-get install zip unzip ``` ### awsマネコンでソースIPなど一時的に制限する 自分のGIPからのみアクセス可能にする. ### sshログインしsshポートを22から適当な値に変更 ``` shell sudo vi /etc/ssh/sshd_config ``` ssh: 22 → 使っていなそうなポートに変更 ``` shell sudo systemctl restart sshd exit ``` ### 変更したポートでログイン確認 ### fail2ban設定 lightsailではwafなど高度なセキュリティ構築できないし,個人redmineとしてこれで十分かなと ``` shell apt install fail2ban sudo apt install fail2ban sudo apt install rsyslog ``` ### SSHdのloglevelをINFOからVERBOSEに変更する ``` shell sudo vi /etc/ssh/sshd_config ``` loglevelをinfoからVERBOSEへ変更 ### 設定オーバーライドファイルの作成 ``` shell sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local ``` ###下記の追記 ``` [sshd] enabled = true port = 変更後のSSHポート filter = sshd logpath = /var/log/auth.log maxretry = 5 findtime = 600 bantime = 3600 #backend = systemd [redmine] enabled = true filter = redmine port = 80,443 #backend = polling action = iptables-allports[name=redmine] logpath = /var/log/redmine/default/production.log maxretry = 5 findtime = 7320 bantime = 7320 ``` 反映を確認 ``` shell sudo systemctl restart fail2ban sudo fail2ban-client status sudo fail2ban-client status sshd sudo fail2ban-client status redmine ``` ### redmineとsshで意図的にログインミスしてみる 下記のコマンドでfail回数とか見れる ``` shell sudo fail2ban-client status sshd sudo fail2ban-client status redmine ``` ### blocktypeの変更 ``` shell sudo vi /etc/fail2ban/action.d/iptables.conf ``` blocktype = DROP ### banを解除する場合 ``` shell sudo fail2ban-client set <jail名> unbanip <IPアドレス> ``` ## ◆Redmine内設定 ### redmine初期ユーザーの認証情報を確認する ``` shell cat /opt/bitnami/redmine/files/delete.me bitnami_credentials ``` ユーザ名とパスワード,二段階認証など適切に変更 ### ◆プラグイン(redmine 6.0xに対応したプラグインがどれだけあるか) Easy Baseline Easy Gantt plugin Easy MindMup plugin Easy WBS plugin https://www.easysoftware.com RedMica UI extension https://github.com/redmica/redmica_ui_extension Redmine Checklists plugin (Light version) https://www.redmineup.com/pages/plugins/checklists Redmine Issue Assign Notice plugin https://github.com/onozaty/redmine_issue_assign_notice Redmine Issue Templates plugin https://github.com/agileware-jp/redmine_issue_templates Redmine Issues Panel plugin https://github.com/redmica/redmine_issues_panel Redmine People plugin (Light version) http://redmineup.com/pages/plugins/people Redmine Slack https://github.com/sciyoshi/redmine-slack Scrum Redmine plugin https://redmine.ociotec.com/projects/redmine-plugin-scrum View Customize plugin https://github.com/onozaty/redmine-view-customize autolink https://github.com/INSANEWORKS/redmine_auto_link_relate Redmine Auto Internal Link Plugin https://github.com/INSANEWORKS/redmine_auto_internal_link ##↓プラグイン入れたら大体これでgem installとDBマイグレする ``` shell bundle install --without development test rake redmine:plugins:migrate RAILS_ENV=production ``` Permission dynied するとき ``` shell sudo chown -R bitnami:daemon /opt/bitnami/redmine /bitnami/redmine sudo chmod -R g+w /opt/bitnami/redmine /bitnami/redmine ``` ###↓gem installでfrozen~~と警告出たら解除する ``` shell bundle config --delete frozen bundle config set frozen false ```