add podman
This commit is contained in:
parent
1184d3dff5
commit
1dd471f09e
10 changed files with 227 additions and 4 deletions
|
@ -4,20 +4,20 @@
|
||||||
template:
|
template:
|
||||||
src: files/openssh_sshd_config
|
src: files/openssh_sshd_config
|
||||||
dest: /etc/ssh/sshd_config
|
dest: /etc/ssh/sshd_config
|
||||||
mode: '0644'
|
mode: "0644"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
- name: Configure root .ssh directory
|
- name: Configure root .ssh directory
|
||||||
file:
|
file:
|
||||||
state: directory
|
state: directory
|
||||||
path: /root/.ssh
|
path: /root/.ssh
|
||||||
mode: '0755'
|
mode: "0755"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
- name: Configure root authorized_keys
|
- name: Configure root authorized_keys
|
||||||
template:
|
template:
|
||||||
src: files/openssh_authorized_keys
|
src: files/openssh_authorized_keys
|
||||||
dest: /root/.ssh/authroized_keys
|
dest: /root/.ssh/authroized_keys
|
||||||
mode: '0644'
|
mode: "0644"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
|
1
openssh/files/openssh_authorized_keys
Normal file
1
openssh/files/openssh_authorized_keys
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2kBMGGTKYtcIC8oJSqG0BvUXabIYyttte06pGtJ3f5
|
130
openssh/files/openssh_sshd_config
Normal file
130
openssh/files/openssh_sshd_config
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
|
||||||
|
|
||||||
|
# This is the sshd server system-wide configuration file. See
|
||||||
|
# sshd_config(5) for more information.
|
||||||
|
|
||||||
|
# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# To modify the system-wide sshd configuration, create a *.conf file under
|
||||||
|
# /etc/ssh/sshd_config.d/ which will be automatically included below
|
||||||
|
Include /etc/ssh/sshd_config.d/*.conf
|
||||||
|
|
||||||
|
# If you want to change the port on a SELinux system, you have to tell
|
||||||
|
# SELinux about this change.
|
||||||
|
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
|
||||||
|
#
|
||||||
|
Port 22
|
||||||
|
#AddressFamily any
|
||||||
|
ListenAddress 127.0.0.1
|
||||||
|
#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 prohibit-password
|
||||||
|
#StrictModes yes
|
||||||
|
#MaxAuthTries 6
|
||||||
|
#MaxSessions 10
|
||||||
|
|
||||||
|
PubkeyAuthentication yes
|
||||||
|
|
||||||
|
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
|
||||||
|
# but this is overridden so installations will only check .ssh/authorized_keys
|
||||||
|
AuthorizedKeysFile .ssh/authorized_keys
|
||||||
|
|
||||||
|
#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 yes
|
||||||
|
#PermitEmptyPasswords no
|
||||||
|
|
||||||
|
# Change to no to disable s/key passwords
|
||||||
|
#KbdInteractiveAuthentication yes
|
||||||
|
|
||||||
|
# Kerberos options
|
||||||
|
#KerberosAuthentication no
|
||||||
|
#KerberosOrLocalPasswd yes
|
||||||
|
#KerberosTicketCleanup yes
|
||||||
|
#KerberosGetAFSToken no
|
||||||
|
#KerberosUseKuserok yes
|
||||||
|
|
||||||
|
# GSSAPI options
|
||||||
|
#GSSAPIAuthentication no
|
||||||
|
#GSSAPICleanupCredentials yes
|
||||||
|
#GSSAPIStrictAcceptorCheck yes
|
||||||
|
#GSSAPIKeyExchange no
|
||||||
|
#GSSAPIEnablek5users 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 without-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'.
|
||||||
|
# WARNING: 'UsePAM no' is not supported in Fedora and may cause several
|
||||||
|
# problems.
|
||||||
|
#UsePAM no
|
||||||
|
|
||||||
|
#AllowAgentForwarding yes
|
||||||
|
#AllowTcpForwarding yes
|
||||||
|
#GatewayPorts no
|
||||||
|
#X11Forwarding no
|
||||||
|
#X11DisplayOffset 10
|
||||||
|
#X11UseLocalhost yes
|
||||||
|
#PermitTTY yes
|
||||||
|
#PrintMotd yes
|
||||||
|
#PrintLastLog yes
|
||||||
|
#TCPKeepAlive yes
|
||||||
|
#PermitUserEnvironment no
|
||||||
|
#Compression delayed
|
||||||
|
#ClientAliveInterval 0
|
||||||
|
#ClientAliveCountMax 3
|
||||||
|
#UseDNS no
|
||||||
|
#PidFile /var/run/sshd.pid
|
||||||
|
#MaxStartups 10:30:100
|
||||||
|
#PermitTunnel no
|
||||||
|
#ChrootDirectory none
|
||||||
|
#VersionAddendum none
|
||||||
|
|
||||||
|
# no default banner path
|
||||||
|
#Banner none
|
||||||
|
|
||||||
|
# override default of no subsystems
|
||||||
|
Subsystem sftp /usr/libexec/openssh/sftp-server
|
||||||
|
|
||||||
|
# Example of overriding settings on a per-user basis
|
||||||
|
#Match User anoncvs
|
||||||
|
# X11Forwarding no
|
||||||
|
# AllowTcpForwarding no
|
||||||
|
# PermitTTY no
|
||||||
|
# ForceCommand cvs server
|
9
podman/directory.ansible.yml
Normal file
9
podman/directory.ansible.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: Create podman directory
|
||||||
|
file:
|
||||||
|
path: /opt/podman
|
||||||
|
owner: puser
|
||||||
|
group: puser
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
1
podman/files/files_unprivileged_ports
Normal file
1
podman/files/files_unprivileged_ports
Normal file
|
@ -0,0 +1 @@
|
||||||
|
net.ipv4.ip_unprivileged_port_start=0
|
|
@ -1 +1,5 @@
|
||||||
- import_playbook:
|
- import_playbook: pkg.ansible.yml
|
||||||
|
- import_playbook: rootless.ansible.yml
|
||||||
|
- import_playbook: user.ansible.yml
|
||||||
|
- import_playbook: directory.ansible.yml
|
||||||
|
- import_playbook: service.ansible.yml
|
||||||
|
|
9
podman/pkg.ansible.yml
Normal file
9
podman/pkg.ansible.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: Install podman package
|
||||||
|
package:
|
||||||
|
state: present
|
||||||
|
name:
|
||||||
|
- podman
|
||||||
|
- podman-openrc
|
||||||
|
- podman-compose
|
32
podman/rootless.ansible.yml
Normal file
32
podman/rootless.ansible.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: cgroup mode
|
||||||
|
lineinfile:
|
||||||
|
path: "/etc/rc.conf"
|
||||||
|
regexp: "^rc_cgroup_mode.?=.?"
|
||||||
|
line: rc_cgroup_mode="unified"
|
||||||
|
- name: cgroups service
|
||||||
|
service:
|
||||||
|
name: cgroups
|
||||||
|
enabled: true
|
||||||
|
- name: rootless modules
|
||||||
|
lineinfile:
|
||||||
|
state: present
|
||||||
|
path: /etc/modules
|
||||||
|
insertafter: EOF
|
||||||
|
line: |
|
||||||
|
tun
|
||||||
|
fuse
|
||||||
|
ip_tables
|
||||||
|
- name: subgid
|
||||||
|
lineinfile:
|
||||||
|
state: present
|
||||||
|
path: /etc/subgid
|
||||||
|
insertafter: EOF
|
||||||
|
line: puser:100000:65536
|
||||||
|
- name: subuid
|
||||||
|
lineinfile:
|
||||||
|
state: present
|
||||||
|
path: /etc/subuid
|
||||||
|
insertafter: EOF
|
||||||
|
line: puser:100000:65536
|
13
podman/service.ansible.yml
Normal file
13
podman/service.ansible.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: Enable podman service
|
||||||
|
service:
|
||||||
|
name: podman
|
||||||
|
enabled: true
|
||||||
|
- name: Podman unprivileged ports
|
||||||
|
template:
|
||||||
|
src: files/files_unprivileged_ports
|
||||||
|
dest: /etc/sysctl.d/podman.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
24
podman/user.ansible.yml
Normal file
24
podman/user.ansible.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: Create puser user
|
||||||
|
user:
|
||||||
|
uid: 2000
|
||||||
|
name: puser
|
||||||
|
shell: /bin/zsh
|
||||||
|
home: /home/puser
|
||||||
|
password: "*"
|
||||||
|
create_home: true
|
||||||
|
- name: puser .ssh dir
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: /home/puser/.ssh
|
||||||
|
mode: "0755"
|
||||||
|
owner: puser
|
||||||
|
group: puser
|
||||||
|
- name: puser authorized_keys
|
||||||
|
template:
|
||||||
|
src: ../openssh/files/openssh_authorized_keys
|
||||||
|
dest: /home/puser/.ssh/authorized_keys
|
||||||
|
mode: "0644"
|
||||||
|
owner: puser
|
||||||
|
group: puser
|
Loading…
Reference in a new issue