Initial Commit

This commit is contained in:
LinuxSquare 2023-04-25 21:32:28 +02:00
commit aba81fd143
12 changed files with 261 additions and 0 deletions

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Noveria Salt-State
![SaltStack® Logo](https://upload.wikimedia.org/wikipedia/commons/6/64/SaltStack_logo_blk_2k.png)
This repository is for the master-less salt-statetree for the noveria host, running Fedora Server (insert latest version here).
It managed the complete system using the saltproject.
For further instructions, head to the official salt docs: https://docs.saltproject.io/en/latest/contents.html

View file

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF2kBMGGTKYtcIC8oJSqG0BvUXabIYyttte06pGtJ3f5

View 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 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 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

4
services/init.sls Normal file
View file

@ -0,0 +1,4 @@
include:
- .mysql
- .podman
- .ssh

19
services/mysql.sls Normal file
View file

@ -0,0 +1,19 @@
include:
- system.packages
system_service_mysql_enable:
service.enabled:
- name: mysql
- require:
- system_packages_install
file.directory:
- name: /var/lib/mysql
- create: False
- replace: False
- user: mysql
- group: mysql
- recurse:
- user
- group
- require:
- system_packages_install

8
services/podman.sls Normal file
View file

@ -0,0 +1,8 @@
include:
- system.packages
system_service_podman_enable:
service.enabled:
- name: podman
- require:
- system_packages_install

25
services/ssh.sls Normal file
View file

@ -0,0 +1,25 @@
include:
- system.packages
system_ssh_add_keys:
file.managed:
- name: /root/.ssh/authorized_keys
- source: salt://{{ tpldir }}/files/ssh_authorized_keys
- makedirs: True
- user: root
- group: root
- require:
- system_packages_install
- system_ssh_add_folder
system_ssh_configuration:
file.managed:
- name: /etc/ssh/sshd_config
- source: salt://{{ tpldir }}/files/ssh_sshd_config
system_ssh_enable:
service.enabled:
- name: sshd
- require:
- system_ssh_configuration
- system_ssh_add_keys

20
system/btrfs.sls Normal file
View file

@ -0,0 +1,20 @@
system_btrfs_create_podman_data_dir:
cmd.run:
- creates: /opt/podman
- name: btrfs subvolume create /opt/podman
file.managed:
- name: /opt/podman
- create: False
- replace: False
- user: root
- group: root
system_btrfs_create_noveria_home:
cmd.run:
- creates: /home/noveria
- name: btrfs subvolume create /home/noveria
system_btrfs_create_mysql_data_dir:
cmd.run:
- creates: /var/lib/mysql
- name: btrfs subvolume create /var/lib/mysql

4
system/init.sls Normal file
View file

@ -0,0 +1,4 @@
include:
- .btrfs
- .user
- .packages

15
system/packages.sls Normal file
View file

@ -0,0 +1,15 @@
include:
- .btrfs
system_packages_install:
pkg.installed:
- pkgs:
- podman
- cockpit-podman
- podman-docker
- podman-compose
- mariadb-server
- java-latest-openjdk-headless
- require:
- system_btrfs_create_podman_data_dir
- system_btrfs_create_mysql_data_dir

22
system/user.sls Normal file
View file

@ -0,0 +1,22 @@
include:
- .btrfs
system_user_create:
user.present:
- name: noveria
- shell: /bin/false
- home: /home/noveria
- usergroup: True
- createhome: False
system_user_create_home_noveria:
file.directory:
- name: /home/noveria
- user: noveria
- group: noveria
- mode: 700
- recurse:
- user
- group
- require:
- system_btrfs_create_noveria_home

4
top.sls Normal file
View file

@ -0,0 +1,4 @@
base:
'*':
- .system
- .services