Skip to content

Commit 6fcbafb

Browse files
committed
Swap usernames for uids
1 parent 9154eee commit 6fcbafb

13 files changed

+40
-32
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.18.0 (2017-12-02)
4+
5+
* Ensure directories are created with uids instead of usernames
6+
* Ensure chown and chgrp permissions are assigned to uids
7+
* Ensure sudo commands use the uid
8+
39
## 1.17.1 (2017-11-02)
410

511
* Fix regression in ansible role creation of backup script template

group_vars/images

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ admin_type: LIVE IMAGE
55
admin_type_lowcase: live image
66
ssh_path: /usr/local/etc/ssh
77

8-
jidoteki_admin_version: 1.17.1
8+
jidoteki_admin_version: 1.18.0

roles/admin/tasks/main.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Jidoteki Admin tasks
2+
#
3+
# user/group 998 = sftpadmin, 997 = admin, 50 = staff, 0 = root
24

35
- name: Create admin home directories
46
file: >
57
state=directory
68
path={{ prefix }}{{ item }}
7-
owner=admin
8-
group=admin
9+
owner=997
10+
group=997
911
mode=1750
1012
recurse=no
1113
with_items:
@@ -18,8 +20,8 @@
1820
file: >
1921
state=directory
2022
path={{ prefix }}{{ item }}
21-
owner=root
22-
group=root
23+
owner=0
24+
group=0
2325
mode=0755
2426
with_items:
2527
- "{{ admin_path }}/bin"
@@ -32,8 +34,8 @@
3234
file: >
3335
state=directory
3436
path={{ prefix }}{{ item }}
35-
owner=sftpadmin
36-
group=admin
37+
owner=998
38+
group=997
3739
mode=0770
3840
recurse=no
3941
with_items:
@@ -45,8 +47,8 @@
4547
file: >
4648
state=directory
4749
path={{ prefix }}{{ item }}
48-
owner=root
49-
group=admin
50+
owner=0
51+
group=997
5052
mode=1775
5153
with_items:
5254
- "{{ admin_path }}/log"
@@ -58,8 +60,8 @@
5860
template: >
5961
src={{ item }}.j2
6062
dest="{{ prefix }}{{ admin_path }}/bin/{{ item }}"
61-
owner=root
62-
group=root
63+
owner=0
64+
group=0
6365
mode=0755
6466
with_items:
6567
- update_backup.sh
@@ -80,8 +82,8 @@
8082
template: >
8183
src=wrapper.sh.j2
8284
dest="{{ prefix }}{{ admin_path }}/bin/wrapper.sh"
83-
owner=root
84-
group=admin
85+
owner=0
86+
group=997
8587
mode=0750
8688
tags:
8789
- admin

roles/admin/templates/update_backup.sh.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ stop_backup() {
8989
restore_backup() {
9090
echo "[`date +%s`][{{ admin_type }}] Restoring backup archive to $restore_path" | log_output
9191

92-
sudo -u admin /bin/tar -C "$restore_path" -xf "$backup_archive" || fail_and_exit
92+
sudo -u '#997' /bin/tar -C "$restore_path" -xf "$backup_archive" || fail_and_exit
9393
rm -f "$backup_archive"
9494

9595
echo "[`date +%s`][{{ admin_type }}] Restore complete" | log_output
@@ -101,7 +101,7 @@ trap fail_and_exit INT SIGINT SIGTERM
101101

102102
if [ "$backup_action" = "START" ]; then
103103
echo -n "{\"status\":\"running\"}" > "$backup_json"
104-
chgrp admin "$backup_json"
104+
chgrp 997 "$backup_json"
105105

106106
start_backup || fail_and_exit
107107
elif [ "$backup_action" = "RESTORE" ]; then

roles/admin/templates/update_certs.sh.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ generate_chained_cert() {
106106

107107
replace_old_certs() {
108108
chmod 0640 enterprise.key enterprise.crt enterprise.pem
109-
chown root:staff enterprise.key enterprise.crt
110-
chown root:admin enterprise.pem
109+
chown 0:50 enterprise.key enterprise.crt
110+
chown 0:997 enterprise.pem
111111

112112
mkdir -p /usr/local/etc/pki/tls/private /usr/local/etc/pki/tls/certs /usr/local/etc/pki/tls/cacerts
113113

@@ -119,7 +119,7 @@ replace_old_certs() {
119119

120120
if [ -f "enterprise-ca.crt" ]; then
121121
chmod 0640 enterprise-ca.crt
122-
chown root:staff enterprise-ca.crt
122+
chown 0:50 enterprise-ca.crt
123123
mv -f enterprise-ca.crt /usr/local/etc/pki/tls/cacerts/
124124
[ -f "ca-bundle.crt" ] && mv -f ca-bundle.crt /usr/local/etc/pki/tls/
125125
fi

roles/admin/templates/update_debug.sh.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ compress_debug_files() {
6666
[ -f "${admin_dir}/home/sftp/uploads/${log_file}" ] && { openssl enc -aes-256-cbc -salt -in $log_file -out ${log_file}.enc -pass file:./debug.key || return 1; }
6767

6868
tar -cvf debug-bundle.tar *.enc && \
69-
chmod 640 debug-bundle.tar ; chown root:admin debug-bundle.tar && \
69+
chmod 640 debug-bundle.tar ; chown 0:997 debug-bundle.tar && \
7070
mv -f debug-bundle.tar ${admin_dir}/home/sftp/uploads/ || return 1
7171
}
7272

roles/admin/templates/update_license.sh.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ move_license_file() {
3434

3535
echo "[`date +%s`][{{ admin_type }}] Updating license. Please wait.." 2>&1 | tee -a "${admin_dir}/log/update_license.log"
3636
mv -f license.asc ${admin_dir}/etc/
37-
chmod 640 "${admin_dir}/etc/license.asc" ; chown root:admin "${admin_dir}/etc/license.asc"
37+
chmod 640 "${admin_dir}/etc/license.asc" ; chown 0:997 "${admin_dir}/etc/license.asc"
3838
echo "[`date +%s`][{{ admin_type }}] Updating license successful" 2>&1 | tee -a "${admin_dir}/log/update_license.log"
3939
}
4040

roles/admin/templates/update_logs.sh.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fail_and_exit() {
3333
compress_log_files() {
3434
echo "[`date +%s`][{{ admin_type }}] Generating compressed logs.tar.gz. Please wait.." 2>&1
3535
tar --ignore-failed-read -zcf $log_file ${log_dirs}
36-
chmod 640 $log_file ; chown root:admin $log_file
36+
chmod 640 $log_file ; chown 0:997 $log_file
3737
mv -f $log_file ${admin_dir}/home/sftp/uploads/
3838
echo "[`date +%s`][{{ admin_type }}] Generated logs successful" 2>&1
3939
}

roles/admin/templates/update_replication.sh.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ move_settings_files() {
3434

3535
if [ -f "replication.json" ]; then
3636
mv -f replication.json ${admin_dir}/etc/
37-
chmod 640 "${admin_dir}/etc/replication.json" ; chown root:admin "${admin_dir}/etc/replication.json"
37+
chmod 640 "${admin_dir}/etc/replication.json" ; chown 0:997 "${admin_dir}/etc/replication.json"
3838
fi
3939

4040
if [ -f "replication.conf" ]; then
4141
mv -f replication.conf /usr/local/etc/
42-
chmod 640 "/usr/local/etc/replication.conf" ; chown root:admin "/usr/local/etc/replication.conf"
42+
chmod 640 "/usr/local/etc/replication.conf" ; chown 0:997 "/usr/local/etc/replication.conf"
4343
fi
4444
}
4545

roles/admin/templates/update_settings.sh.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ move_settings_files() {
3535

3636
if [ -f "app.json" ]; then
3737
mv -f app.json ${admin_dir}/etc/
38-
chmod 640 "${admin_dir}/etc/app.json" ; chown root:admin "${admin_dir}/etc/app.json"
38+
chmod 640 "${admin_dir}/etc/app.json" ; chown 0:997 "${admin_dir}/etc/app.json"
3939
fi
4040

4141
if [ -f "network.json" ]; then
4242
mv -f network.json ${admin_dir}/etc/
43-
chmod 640 "${admin_dir}/etc/network.json" ; chown root:admin "${admin_dir}/etc/network.json"
43+
chmod 640 "${admin_dir}/etc/network.json" ; chown 0:997 "${admin_dir}/etc/network.json"
4444
fi
4545

4646
if [ -f "network.conf" ]; then
4747
mv -f network.conf /usr/local/etc/
48-
chmod 640 "/usr/local/etc/network.conf" ; chown root:admin "/usr/local/etc/network.conf"
48+
chmod 640 "/usr/local/etc/network.conf" ; chown 0:997 "/usr/local/etc/network.conf"
4949
fi
5050
}
5151

0 commit comments

Comments
 (0)