r/fileserver: Restrict non-administrators to SFTP
Normal users do not need shell access to the file server, and certainly should not be allowed to e.g. forward ports through it. Using a `Match` block, we can apply restrictions to users who do not need administrative functionality. In this case, we restrict everyone who is not a member of the *Server Admins* group in the PYROCUFFLINK AD domain.frigate-exporter
parent
b5c54d7bb3
commit
0d30e54fd5
|
@ -22,3 +22,5 @@ sudo_authorized_ssh_keys: |
|
||||||
# Default flags include -n, which makes Ansible complain about a "missing
|
# Default flags include -n, which makes Ansible complain about a "missing
|
||||||
# become password," even though it would never actually prompt for one.
|
# become password," even though it would never actually prompt for one.
|
||||||
ansible_become_flags: -H
|
ansible_become_flags: -H
|
||||||
|
|
||||||
|
fileserver_sftp_only_match: 'Group !server?admins,*'
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
file_shares: []
|
file_shares: []
|
||||||
samba_use_smbd: true
|
samba_use_smbd: true
|
||||||
|
|
||||||
|
fileserver_sftp_only_match: 'User !root,*'
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
- name: save firewalld configuration
|
- name: save firewalld configuration
|
||||||
command: firewall-cmd --runtime-to-permanent
|
command: firewall-cmd --runtime-to-permanent
|
||||||
|
|
||||||
|
- name: reload sshd
|
||||||
|
service:
|
||||||
|
name: sshd
|
||||||
|
state: reloaded
|
||||||
|
|
|
@ -44,3 +44,16 @@
|
||||||
name=samba_enable_home_dirs
|
name=samba_enable_home_dirs
|
||||||
persistent=yes
|
persistent=yes
|
||||||
state=yes
|
state=yes
|
||||||
|
|
||||||
|
- name: ensure ssh server is configured for sftp only
|
||||||
|
template:
|
||||||
|
src: sftp-only.sshd_config.j2
|
||||||
|
dest: /etc/ssh/sshd_config.d/95-sftp-only.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rw,go=r
|
||||||
|
notify:
|
||||||
|
- reload sshd
|
||||||
|
tags:
|
||||||
|
- sshd-config
|
||||||
|
- config
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
Match {{ fileserver_sftp_only_match }}
|
||||||
|
AllowAgentForwarding no
|
||||||
|
AllowStreamLocalForwarding no
|
||||||
|
AllowTcpForwarding no
|
||||||
|
DisableForwarding yes
|
||||||
|
ForceCommand internal-sftp
|
||||||
|
PermitListen none
|
||||||
|
PermitOpen none
|
||||||
|
PermitTTY no
|
||||||
|
PermitTunnel no
|
||||||
|
PermitUserRC no
|
Loading…
Reference in New Issue