Skip to content

Commit 33dece3

Browse files
author
Abhishek Shukla
authored
Merge branch 'develop' into dlpx/pr/rasantel/b46e023c-a6d9-4f5d-9d9c-22ad61395406
2 parents c409696 + 0b5db55 commit 33dece3

File tree

9 files changed

+136
-69
lines changed

9 files changed

+136
-69
lines changed

debian/rules

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ DEPENDS += aptitude, \
158158
memstat, \
159159
mtr-tiny, \
160160
ncdu, \
161+
netcat-openbsd, \
161162
pciutils, \
162163
performance-diagnostics, \
163164
procinfo, \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
umask 027
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# During upgrade verification, the root filesystem will be booted as a
3+
# container using systemd-nspawn. We don't "sandbox" the container, so
4+
# when zfs-import-cache.service runs, it could potentially try to import
5+
# a pool, which is not desired.
6+
#
7+
# To prevent this behavior, we explicitly disable this service from
8+
# running when inside of the container.
9+
#
10+
[Unit]
11+
ConditionVirtualization=!container
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# During upgrade verification, the root filesystem will be booted as a
3+
# container using systemd-nspawn. We don't "sandbox" the container, so
4+
# when zfs-import-scan.service runs, it could potentially try to import
5+
# a pool, which is not desired.
6+
#
7+
# To prevent this behavior, we explicitly disable this service from
8+
# running when inside of the container.
9+
#
10+
[Unit]
11+
ConditionVirtualization=!container
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# During upgrade verification, the root filesystem will be booted as a
3+
# container using systemd-nspawn. We don't "sandbox" the container, so
4+
# when zfs-mount.service runs, it'll automatically mount all "domain0"
5+
# mountpoints (or "dcenter" mountpoints for our DCenter systems). These
6+
# mounts in the container can then impact software running outside of
7+
# the container; e.g. "zfs destroy" can fail with EBUSY.
8+
#
9+
# Thus, to workaround this problem, we explicitly disable this service
10+
# from running when inside of the container.
11+
#
12+
[Unit]
13+
ConditionVirtualization=!container
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# During upgrade verification, the root filesystem will be booted as a
3+
# container using systemd-nspawn. We don't "sandbox" the container, so
4+
# when zfs-share.service runs, it'll automatically mount all "domain0"
5+
# mountpoints (or "dcenter" mountpoints for our DCenter systems). These
6+
# mounts in the container can then impact software running outside of
7+
# the container; e.g. "zfs destroy" can fail with EBUSY.
8+
#
9+
# Thus, to workaround this problem, we explicitly disable this service
10+
# from running when inside of the container.
11+
#
12+
[Unit]
13+
ConditionVirtualization=!container

files/common/usr/lib/sysctl.d/30-delphix-ports.conf

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@
1515
#
1616

1717
#
18-
# Local reserved ports for NFSv3
18+
# Local reserved ports
1919
# The persistent setting to back /proc/sys/net/ipv4/ip_local_reserved_ports
2020
#
21+
# iSCSI ports:
22+
# 53260 iSCSI listen for encrypted targets
23+
# 53261 srv side iSCSI stunnel listen
24+
#
25+
# NFS ports:
2126
# 54043 RPC mountd listen
2227
# 54044 RPC statd listen
2328
# 54045 RPC lockd/nlockmgr
2429
# 54046 srv side tunnel listen
2530
#
26-
net.ipv4.ip_local_reserved_ports = 54043-54046
31+
net.ipv4.ip_local_reserved_ports = 53260-53261,54043-54046

files/common/var/lib/delphix-platform/ansible/10-delphix-platform/roles/delphix-platform/tasks/main.yml

+76-66
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,16 @@
7676
#
7777
# Restrict cron permissions. All jobs are owned by root so there's no
7878
# reason to allow others any level of access. This is also necessary to
79-
# satisfy external auditing of CIS security benchmarks.
79+
# satisfy external auditing of CIS security benchmarks. Also ensuring
80+
# the permissions on /etc/ssh/sshd_config are configured.
8081
#
8182
- file:
82-
path: /etc/crontab
83+
path: "{{ item }}"
8384
state: file
8485
mode: 0600
86+
with_items:
87+
- /etc/crontab
88+
- /etc/ssh/sshd_config
8589

8690
- file:
8791
path: "{{ item }}"
@@ -228,34 +232,14 @@
228232
- 'delphix'
229233
- 'root'
230234

231-
- lineinfile:
232-
path: /etc/ssh/sshd_config
233-
regexp: "^#?{{ item.key }} "
234-
line: "{{ item.key }} {{ item.value }}"
235-
with_items:
236-
#
237-
# Configure SSH to allow PAM "conversations" (interactions with the user).
238-
#
239-
- { key: "ChallengeResponseAuthentication", value: "yes" }
240-
#
241-
# Harden the appliance by disabling ssh-agent(1), tcp, UNIX domain, and
242-
# X11 forwarding. Note that this doesn't improve security unless users are
243-
# also denied shell access.
244-
#
245-
- { key: "AllowAgentForwarding", value: "no" }
246-
- { key: "AllowStreamLocalForwarding", value: "no" }
247-
- { key: "AllowTcpForwarding", value: "no" }
248-
- { key: "X11Forwarding", value: "no" }
249-
250235
#
251-
# The CRA project mandated a 30 minute timeout for any idle connections.
252-
# By enabling an inactivity timeout we ensure that idle connections are
253-
# closed. Thus any sessions that are accidentally left opened at a
254-
# customer site will timeout preventing customers from gaining access to
255-
# our engine.
236+
# The 'ClientAliveInterval' setting determines the amount of time
237+
# (in seconds) the sshd server will wait to receive data from the
238+
# client before sending a request for response.
256239
#
257240
- set_fact:
258-
ssh_client_alive_interval: "1800"
241+
ssh_client_alive_interval: "300"
242+
ssh_client_alive_count_max: "3"
259243

260244
#
261245
# With that said (see comment above), the Azure marketplace does not
@@ -264,23 +248,39 @@
264248
#
265249
- set_fact:
266250
ssh_client_alive_interval: "180"
267-
when: platform == "azure"
251+
ssh_client_alive_count_max: "0"
252+
when:
253+
- platform == "azure"
268254

269255
- lineinfile:
270256
path: /etc/ssh/sshd_config
271257
regexp: "^#?{{ item.key }} "
272258
line: "{{ item.key }} {{ item.value }}"
273259
with_items:
274-
- { key: "ClientAliveInterval", value: "{{ ssh_client_alive_interval }}" }
275-
- { key: "ClientAliveCountMax", value: "0" }
276-
when:
277260
#
278-
# For developer convenience, we only enable the CRA mandated timeout
279-
# for external variants. The idle timeout can be a burden when we
280-
# need to run long running processes over SSH on our internal
281-
# systems (e.g. for development, testing, etc).
261+
# Configure SSH to allow PAM "conversations" (interactions with the user).
282262
#
283-
- variant is regex("external-.*")
263+
- { key: "ChallengeResponseAuthentication", value: "yes" }
264+
#
265+
# Harden the appliance by disabling ssh-agent(1), tcp, UNIX domain, and
266+
# X11 forwarding. Note that this doesn't improve security unless users are
267+
# also denied shell access.
268+
#
269+
- { key: "AllowAgentForwarding", value: "no" }
270+
- { key: "AllowStreamLocalForwarding", value: "no" }
271+
- { key: "AllowTcpForwarding", value: "no" }
272+
- { key: "Ciphers", value: "[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]" }
273+
- { key: "ClientAliveCountMax", value: "{{ ssh_client_alive_count_max }}" }
274+
- { key: "ClientAliveInterval", value: "{{ ssh_client_alive_interval }}" }
275+
- { key: "HostKeyAlgorithms", value: "-ssh-rsa*" }
276+
- { key: "KexAlgorithms", value: "curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256"}
277+
- { key: "LoginGraceTime", value: "60"}
278+
- { key: "MACs", value: "[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512"}
279+
- { key: "MaxAuthTries", value: "4" }
280+
- { key: "MaxStartups", value: "10:30:60"}
281+
- { key: "PermitRootLogin", value: "no" }
282+
- { key: "X11Forwarding", value: "no" }
283+
notify: "sshd config changed"
284284

285285
- blockinfile:
286286
path: /etc/profile
@@ -300,12 +300,18 @@
300300
#
301301
- variant is regex("external-.*")
302302
#
303-
# Harden the appliance by disabling SFTP.
303+
# Harden the appliance by disabling SFTP on external variants.
304304
#
305305
- replace:
306306
path: /etc/ssh/sshd_config
307307
regexp: '^(Subsystem.*sftp.*)'
308308
replace: '#\1'
309+
when:
310+
#
311+
# Disable sftp on external variants and leave it enabled on internal
312+
# variants for developer convenience and to facilitate test automation.
313+
#
314+
- variant is regex("external-.*")
309315

310316
#
311317
# Ssh leads to the CLI, not bash, so let's remove all the linuxy shell goodies,
@@ -322,36 +328,13 @@
322328
replace: '#\1'
323329

324330
#
325-
# Prevent sshd from offering weak message authentication codes to clients.
331+
# Restrict su access to users that are part of the root group (gid 0).
332+
# On a Delphix engine, this is restricted to the delphix user.
326333
#
327-
# The "MACs" configuration parameter in sshd_config takes a list of algorithms
328-
# as its parameter. This list may be prefixed by a '+' or '-' operator
329-
# (indicating that the given list should be appended to or removed from the
330-
# existing MAC set, respectively), or neither operator (indicating that the
331-
# given list should replace the existing MAC set). If there already exists a
332-
# "MACs -..." line, we can append to this list. If otherwise, we need to add
333-
# this as a separate line in the configuration.
334-
#
335-
- shell: grep -c -E "^MACs(\s+)-" /etc/ssh/sshd_config || true
336-
register: grep_sshd_config_macs_to_remove
337-
338-
- shell: grep -c -E "^MACs(\s+)-(.*)hmac-sha1\*,umac-64\*" /etc/ssh/sshd_config || true
339-
register: grep_sshd_config_macs_already_removed
340-
341-
- lineinfile:
342-
path: /etc/ssh/sshd_config
343-
backrefs: yes
344-
regexp: '^MACs[\s]+-(.*)$'
345-
line: 'MACs -\1,hmac-sha1*,umac-64*'
346-
notify: "sshd config changed"
347-
when: grep_sshd_config_macs_to_remove.stdout != "0" and grep_sshd_config_macs_already_removed == "0"
348-
349-
- lineinfile:
350-
path: /etc/ssh/sshd_config
351-
insertafter: EOF
352-
line: "MACs -hmac-sha1*,umac-64*"
353-
notify: "sshd config changed"
354-
when: grep_sshd_config_macs_to_remove.stdout == "0"
334+
- replace:
335+
dest: /etc/pam.d/su
336+
regexp: '^#?[\s]*(auth[\s]+required[\s]+pam_wheel\.so.*)$'
337+
replace: '\1'
355338

356339
#
357340
# Enable SNMP client tools to load MIBs by default.
@@ -681,3 +664,30 @@
681664
when:
682665
- variant == "internal-buildserver"
683666
- not ansible_is_chroot
667+
668+
- name: Add systemctl bash completion
669+
copy:
670+
dest: "/etc/bash_completion.d/systemctl"
671+
content: |
672+
if [[ -r /usr/share/bash-completion/completions/systemctl ]]; then
673+
. /usr/share/bash-completion/completions/systemctl && complete -F _systemctl systemctl
674+
fi
675+
676+
- name: Source bash completion
677+
blockinfile:
678+
dest: "/export/home/delphix/.bashrc"
679+
block: |
680+
. /etc/bash_completion.d/systemctl
681+
. /etc/bash_completion.d/zfs
682+
PATH=$PATH:/opt/delphix/server/bin
683+
684+
#
685+
# CIS: Set default umask (DLPX-87205)
686+
# We need to set default umask as 027 in the /etc/bash.bashrc file,
687+
# so that the same can be applied for all the users on the engine.
688+
#
689+
- blockinfile:
690+
path: /etc/bash.bashrc
691+
block: |
692+
# Set default umask value.
693+
umask 027
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
datasource_list: [ OpenStack ]
1+
datasource_list: [ Oracle ]

0 commit comments

Comments
 (0)