Compare commits
3 Commits
61e5dec1c4
...
a52c841151
Author | SHA1 | Date |
---|---|---|
Kazuhiro MUSASHI | a52c841151 | |
Kazuhiro MUSASHI | f6a6c49823 | |
Kazuhiro MUSASHI | 8ae10311a6 |
|
@ -71,7 +71,7 @@ include_recipe './cloudflared.rb'
|
|||
|
||||
# recipes for Ubuntu 20.04 and later
|
||||
case node['platform_version']
|
||||
when "20.04", "22.04"
|
||||
when "20.04", "22.04", "24.04"
|
||||
remote_file '/etc/multipath.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
|
@ -89,29 +89,40 @@ when "20.04", "22.04"
|
|||
service 'systemd-timesyncd' do
|
||||
action :enable
|
||||
end
|
||||
end
|
||||
|
||||
case node['platform_version']
|
||||
when "20.04"
|
||||
remote_file '/etc/systemd/timesyncd.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
case node['platform_version']
|
||||
when "20.04"
|
||||
remote_file '/etc/systemd/timesyncd.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
|
||||
notifies :restart, 'service[systemd-timesyncd]'
|
||||
end
|
||||
when "22.04"
|
||||
remote_file '/etc/systemd/timesyncd.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
notifies :restart, 'service[systemd-timesyncd]'
|
||||
end
|
||||
when "22.04"
|
||||
remote_file '/etc/systemd/timesyncd.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
|
||||
source 'files/etc/systemd/timesyncd.2204.conf'
|
||||
source 'files/etc/systemd/timesyncd.2204.conf'
|
||||
|
||||
notifies :restart, 'service[systemd-timesyncd]'
|
||||
notifies :restart, 'service[systemd-timesyncd]'
|
||||
end
|
||||
when "24.04"
|
||||
remote_file '/etc/systemd/timesyncd.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
|
||||
source 'files/etc/systemd/timesyncd.2404.conf'
|
||||
|
||||
notifies :restart, 'service[systemd-timesyncd]'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# AWS EC2 Swap Setting:
|
||||
if node['is_ec2']
|
||||
include_recipe './aws_ec2.rb'
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
|
||||
# This is the sshd server system-wide configuration file. See
|
||||
# sshd_config(5) for more information.
|
||||
|
||||
# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
|
||||
|
||||
# The strategy used for options in the default sshd_config shipped with
|
||||
# OpenSSH is to specify options with their default value where
|
||||
# possible, but leave them commented. Uncommented options override the
|
||||
# default value.
|
||||
|
||||
Include /etc/ssh/sshd_config.d/*.conf
|
||||
|
||||
Port 10022
|
||||
#AddressFamily any
|
||||
#ListenAddress 0.0.0.0
|
||||
#ListenAddress ::
|
||||
|
||||
#HostKey /etc/ssh/ssh_host_rsa_key
|
||||
#HostKey /etc/ssh/ssh_host_ecdsa_key
|
||||
#HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
|
||||
# Ciphers and keying
|
||||
#RekeyLimit default none
|
||||
|
||||
# Logging
|
||||
#SyslogFacility AUTH
|
||||
#LogLevel INFO
|
||||
|
||||
# Authentication:
|
||||
|
||||
#LoginGraceTime 2m
|
||||
PermitRootLogin no
|
||||
#StrictModes yes
|
||||
#MaxAuthTries 6
|
||||
#MaxSessions 10
|
||||
|
||||
#PubkeyAuthentication yes
|
||||
|
||||
# Expect .ssh/authorized_keys2 to be disregarded by default in future.
|
||||
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
|
||||
|
||||
#AuthorizedPrincipalsFile none
|
||||
|
||||
#AuthorizedKeysCommand none
|
||||
#AuthorizedKeysCommandUser nobody
|
||||
|
||||
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
|
||||
#HostbasedAuthentication no
|
||||
# Change to yes if you don't trust ~/.ssh/known_hosts for
|
||||
# HostbasedAuthentication
|
||||
#IgnoreUserKnownHosts no
|
||||
# Don't read the user's ~/.rhosts and ~/.shosts files
|
||||
#IgnoreRhosts yes
|
||||
|
||||
# To disable tunneled clear text passwords, change to no here!
|
||||
PasswordAuthentication no
|
||||
#PermitEmptyPasswords no
|
||||
|
||||
# Change to yes to enable challenge-response passwords (beware issues with
|
||||
# some PAM modules and threads)
|
||||
KbdInteractiveAuthentication no
|
||||
|
||||
# Kerberos options
|
||||
#KerberosAuthentication no
|
||||
#KerberosOrLocalPasswd yes
|
||||
#KerberosTicketCleanup yes
|
||||
#KerberosGetAFSToken no
|
||||
|
||||
# GSSAPI options
|
||||
#GSSAPIAuthentication no
|
||||
#GSSAPICleanupCredentials yes
|
||||
#GSSAPIStrictAcceptorCheck yes
|
||||
#GSSAPIKeyExchange no
|
||||
|
||||
# Set this to 'yes' to enable PAM authentication, account processing,
|
||||
# and session processing. If this is enabled, PAM authentication will
|
||||
# be allowed through the KbdInteractiveAuthentication and
|
||||
# PasswordAuthentication. Depending on your PAM configuration,
|
||||
# PAM authentication via KbdInteractiveAuthentication may bypass
|
||||
# the setting of "PermitRootLogin prohibit-password".
|
||||
# If you just want the PAM account and session checks to run without
|
||||
# PAM authentication, then enable this but set PasswordAuthentication
|
||||
# and KbdInteractiveAuthentication to 'no'.
|
||||
UsePAM yes
|
||||
|
||||
#AllowAgentForwarding yes
|
||||
#AllowTcpForwarding yes
|
||||
#GatewayPorts no
|
||||
X11Forwarding yes
|
||||
#X11DisplayOffset 10
|
||||
#X11UseLocalhost yes
|
||||
#PermitTTY yes
|
||||
PrintMotd no
|
||||
#PrintLastLog yes
|
||||
#TCPKeepAlive yes
|
||||
#PermitUserEnvironment no
|
||||
#Compression delayed
|
||||
#ClientAliveInterval 0
|
||||
#ClientAliveCountMax 3
|
||||
#UseDNS no
|
||||
#PidFile /run/sshd.pid
|
||||
#MaxStartups 10:30:100
|
||||
#PermitTunnel no
|
||||
#ChrootDirectory none
|
||||
#VersionAddendum none
|
||||
|
||||
# no default banner path
|
||||
#Banner none
|
||||
|
||||
# Allow client to pass locale environment variables
|
||||
AcceptEnv LANG LC_*
|
||||
|
||||
# override default of no subsystems
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
|
||||
# Example of overriding settings on a per-user basis
|
||||
#Match User anoncvs
|
||||
# X11Forwarding no
|
||||
# AllowTcpForwarding no
|
||||
# PermitTTY no
|
||||
# ForceCommand cvs server
|
|
@ -0,0 +1,26 @@
|
|||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Lesser General Public License as published by the Free
|
||||
# Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Entries in this file show the compile time defaults. Local configuration
|
||||
# should be created by either modifying this file (or a copy of it placed in
|
||||
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
|
||||
# the /etc/systemd/timesyncd.conf.d/ directory. The latter is generally
|
||||
# recommended. Defaults can be restored by simply deleting the main
|
||||
# configuration file and all drop-ins located in /etc/.
|
||||
#
|
||||
# Use 'systemd-analyze cat-config systemd/timesyncd.conf' to display the full config.
|
||||
#
|
||||
# See timesyncd.conf(5) for details.
|
||||
|
||||
[Time]
|
||||
NTP=192.168.10.1
|
||||
#FallbackNTP=ntp.ubuntu.com
|
||||
#RootDistanceMaxSec=5
|
||||
#PollIntervalMinSec=32
|
||||
#PollIntervalMaxSec=2048
|
||||
#ConnectionRetrySec=30
|
||||
#SaveIntervalSec=60
|
|
@ -20,24 +20,28 @@ end
|
|||
|
||||
### Here we are going to install git.
|
||||
# Constants:
|
||||
KEYSRV = 'hkp://keyserver.ubuntu.com:80'
|
||||
ID = 'E1DF1F24'
|
||||
case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp
|
||||
when "24.04"
|
||||
execute 'add-apt-repository -y ppa:git-core/ppa' do
|
||||
not_if 'test -e /etc/apt/sources.list.d/git-core-ubuntu-ppa-noble.sources'
|
||||
end
|
||||
else
|
||||
KEYSRV = 'hkp://keyserver.ubuntu.com:80'
|
||||
ID = 'E1DF1F24'
|
||||
|
||||
GIT_PREPUSH = '/usr/share/git-core/templates/hooks/pre-push'
|
||||
PREPUSH = 'https://gist.github.com/kazu634/8267388/raw/e9202cd4c29a66723c88d2be05f3cd19413d2137/pre-push'
|
||||
# Retrieve the Ubuntu code:
|
||||
DIST = run_command('lsb_release -cs').stdout.chomp
|
||||
|
||||
# Retrieve the Ubuntu code:
|
||||
DIST = run_command('lsb_release -cs').stdout.chomp
|
||||
# Add the public key file to install `git`
|
||||
execute "apt-key adv --keyserver #{KEYSRV} --recv-keys #{ID}" do
|
||||
not_if 'apt-key list | grep "E1DF 1F24"'
|
||||
end
|
||||
|
||||
# Add the public key file to install `git`
|
||||
execute "apt-key adv --keyserver #{KEYSRV} --recv-keys #{ID}" do
|
||||
not_if 'apt-key list | grep "E1DF 1F24"'
|
||||
end
|
||||
|
||||
# Deploy the `apt` sources:
|
||||
template '/etc/apt/sources.list.d/git.list' do
|
||||
action :create
|
||||
variables(distribution: DIST)
|
||||
# Deploy the `apt` sources:
|
||||
template '/etc/apt/sources.list.d/git.list' do
|
||||
action :create
|
||||
variables(distribution: DIST)
|
||||
end
|
||||
end
|
||||
|
||||
execute 'apt update' do
|
||||
|
@ -48,6 +52,9 @@ execute 'apt install git -y' do
|
|||
not_if 'LANG=C apt-cache policy git | grep Installed | grep ppa'
|
||||
end
|
||||
|
||||
GIT_PREPUSH = '/usr/share/git-core/templates/hooks/pre-push'
|
||||
PREPUSH = 'https://gist.github.com/kazu634/8267388/raw/e9202cd4c29a66723c88d2be05f3cd19413d2137/pre-push'
|
||||
|
||||
execute "wget #{PREPUSH} -O #{GIT_PREPUSH}" do
|
||||
not_if "test -e #{GIT_PREPUSH}"
|
||||
end
|
||||
|
|
|
@ -9,6 +9,16 @@ end
|
|||
|
||||
# Deploy the `sshd` configuration file:
|
||||
case node['platform_version']
|
||||
when "24.04"
|
||||
remote_file '/etc/ssh/sshd_config' do
|
||||
user 'root'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
source 'files/etc/ssh/sshd_config.2404'
|
||||
end
|
||||
|
||||
when "22.04"
|
||||
remote_file '/etc/ssh/sshd_config' do
|
||||
user 'root'
|
||||
|
@ -48,9 +58,15 @@ else
|
|||
end
|
||||
end
|
||||
|
||||
case node['platform_version']
|
||||
when "24.04"
|
||||
execute 'systemctl disable --now ssh.socket'
|
||||
execute 'systemctl enable --now ssh.service'
|
||||
execute 'systemctl daemon-reload'
|
||||
end
|
||||
|
||||
# Apply the changes:
|
||||
execute 'systemctl reload ssh.service ' do
|
||||
execute 'systemctl restart ssh.service ' do
|
||||
action :nothing
|
||||
subscribes :run, 'remote_file[/etc/ssh/sshd_config]'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue