From fdfa8d05de3e11a3314b0c647be6aedadedce3b8 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 1 Nov 2020 16:25:28 +0900 Subject: [PATCH] Install and initial setup for `lsyncd`. --- cookbooks/base/default.rb | 3 ++ cookbooks/base/files/etc/logrotate.d/lsyncd | 13 +++++++ cookbooks/base/files/root/.ssh/id_rsa | 38 +++++++++++++++++++++ cookbooks/base/files/root/.ssh/known_hosts | 1 + cookbooks/base/lsyncd.rb | 30 ++++++++++++++++ 5 files changed, 85 insertions(+) create mode 100644 cookbooks/base/files/etc/logrotate.d/lsyncd create mode 100644 cookbooks/base/files/root/.ssh/id_rsa create mode 100644 cookbooks/base/files/root/.ssh/known_hosts create mode 100644 cookbooks/base/lsyncd.rb diff --git a/cookbooks/base/default.rb b/cookbooks/base/default.rb index caa17e2..5b904d1 100644 --- a/cookbooks/base/default.rb +++ b/cookbooks/base/default.rb @@ -60,6 +60,9 @@ include_recipe './kernel.rb' # Install mc command: include_recipe './mc.rb' +# Install lsyncd command: +include_recipe './lsyncd.rb' + # recipes for Ubuntu 16.04 if node['platform_version'].to_f == 16.04 # ntp configurations diff --git a/cookbooks/base/files/etc/logrotate.d/lsyncd b/cookbooks/base/files/etc/logrotate.d/lsyncd new file mode 100644 index 0000000..52d4ad1 --- /dev/null +++ b/cookbooks/base/files/etc/logrotate.d/lsyncd @@ -0,0 +1,13 @@ +/var/log/lsyncd/*.log { + rotate 4 + compress + delaycompress + missingok + notifempty + sharedscripts + postrotate + if [ -f /var/run/lsyncd.pid ]; then + /usr/bin/systemctl restart lsyncd.service > /dev/null 2>/dev/null || true + fi + endscript +} diff --git a/cookbooks/base/files/root/.ssh/id_rsa b/cookbooks/base/files/root/.ssh/id_rsa new file mode 100644 index 0000000..b979e47 --- /dev/null +++ b/cookbooks/base/files/root/.ssh/id_rsa @@ -0,0 +1,38 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUA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BVEkzrV9xZPB/nNYNa9OE+DH1zD/0tUUNw ++L/mMjz9KDZJ+3mUWlNxMU0U5d/B0cbwAAAMEA0VXCDduckbbrKb5PrV1NGlZD8FlFgovx +IbOlhB1Zfbop4N8QndsMx5pXRwDOCiJ7z5Sc2huuJ5OCTnmW4yGajXo/yfX63B+suELbPk +tjO5nl6yGcgOz95V2sfkCqlvchsxYN3qTmolWD0PadK5Sno8glzyM60sGv+basfgEOBsli +GTIWv6gUA8QSVPkYFyircWMk7S7HwB1nc39B2XVdMzZkKnNKqv9yHhaEBxOzWwulUksEuN +Jge4w7RaxPRg3vAAAAEHJvb3RAYmFzdGlvbjIwMDQBAg== +-----END OPENSSH PRIVATE KEY----- diff --git a/cookbooks/base/files/root/.ssh/known_hosts b/cookbooks/base/files/root/.ssh/known_hosts new file mode 100644 index 0000000..84e08df --- /dev/null +++ b/cookbooks/base/files/root/.ssh/known_hosts @@ -0,0 +1 @@ +|1|/SRt7pnr5wRdTihEn9BLVAij7X8=|AiMlTVmMn4KG3ITCPxG+iL+1Z4o= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAej4lWqrN/bly94FQVTjNEsBxK7RiMlAkXrJQhnr6nLaLK0yEAJUHGZXF0LwnxYH9r734W6eDfQiqyqmbE2vPg= diff --git a/cookbooks/base/lsyncd.rb b/cookbooks/base/lsyncd.rb new file mode 100644 index 0000000..5c29b1a --- /dev/null +++ b/cookbooks/base/lsyncd.rb @@ -0,0 +1,30 @@ +package 'lsyncd' + +# Create /etc/sudoers.d/ +%w( /etc/lsyncd /var/log/lsyncd ).each do |d| + directory d do + owner 'root' + group 'root' + mode '755' + end +end + +directory '/root/.ssh/' do + owner 'root' + group 'root' + mode '0700' +end + +%w(id_rsa known_hosts).each do |f| + remote_file "/root/.ssh/#{f}" do + owner 'root' + group 'root' + mode '600' + end +end + +remote_file '/etc/logrotate.d/lsyncd' do + owner 'root' + group 'root' + mode '644' +end