Browse Source

Changed init permissions of shift file and backups to be more restrictive

Added explenation about this in conf file
Matteo Savatteri 5 years ago
parent
commit
c94891b289
4 changed files with 22 additions and 8 deletions
  1. 10 3
      conf
  2. 10 3
      devconf.sh
  3. 1 1
      helper_functions
  4. 1 1
      rotate_functions

+ 10 - 3
conf

@@ -2,14 +2,21 @@
 # (limitati a ridefinire le variabili,
 # non modificare altro):
 
-# Il file che coniene i turni
+# Il file che coniene i turni.
 # (percorso assoluto)
 SHIFT_FILE="/home/150/turni/turni.db"
 
-# Associa ad ogni ID il nome utente di un 150
+# Associa ad ogni ID il nome utente di un 150.
+# Solamente tali utenti possono registrare
+# un'entrata nel file dei turni.
 ID_0_150="martinacrippa"
 ID_1_150="matteozeccolimarazzini"
 ID_2_150="tommasoforni"
 
-# Il group id o il group name che identifica gli operatori
+# Il group id o il group name che identifica gli operatori.
+# Viene usato da shiftctl come owner group del file dei turni
+# e dei suoi backup. Tali file sono
+# leggibili e scrivibili dalla classe gruppo. Per la classe
+# utente i permessi sono quelli di default per il sistema.
+# Alla classe other tutti i permessi sono revocati
 OPGROUP="1002"

+ 10 - 3
devconf.sh

@@ -40,16 +40,23 @@ then
 	# (limitati a ridefinire le variabili,
 	# non modificare altro):
 	
-	# Il file che coniene i turni
+	# Il file che coniene i turni.
 	# (percorso assoluto)
 	SHIFT_FILE="$(pwd)/turni.db"
 	
-	# Associa ad ogni ID il nome utente di un 150
+	# Associa ad ogni ID il nome utente di un 150.
+	# Solamente tali utenti possono registrare
+	# un'entrata nel file dei turni.
 	ID_0_150="$(whoami)"
 	ID_1_150="operator2"
 	ID_2_150="operator3"
 	
-	# Il group id o il group name che identifica gli operatori
+	# Il group id o il group name che identifica gli operatori.
+	# Viene usato da shiftctl come owner group del file dei turni
+	# e dei suoi backup. Tali file sono
+	# leggibili e scrivibili dalla classe gruppo. Per la classe
+	# utente i permessi sono quelli di default per il sistema.
+	# Alla classe other tutti i permessi sono revocati
 	OPGROUP="$(id -g)"
 	_EOF_
 else

+ 1 - 1
helper_functions

@@ -41,7 +41,7 @@ initialize_dbfile(){
   echoerr "Failed to create shifts file $SHIFT_FILE."
   chgrp "$OPGROUP" "$SHIFT_FILE" &>/dev/null ||\
   echoerr "Failed to change group ownership of shifts file $SHIFT_FILE to $OPGROUP."
-  chmod g+w "$SHIFT_FILE" &>/dev/null ||\
+  chmod g=wr,o= "$SHIFT_FILE" &>/dev/null ||\
   echoerr "Failed to change mode of shifts file $SHIFT_FILE."
 
   return 0

+ 1 - 1
rotate_functions

@@ -14,7 +14,7 @@ bkcomp_dbfile(){
 
   chgrp "$OPGROUP" "$COMPBK_NAME" &>/dev/null ||\
   echoerr "Failed to change group ownership of backed up shifts file $COMPBK_NAME to $OPGROUP."
-  chmod g+w "$COMPBK_NAME" &>/dev/null ||\
+  chmod g=wr,o= "$COMPBK_NAME" &>/dev/null ||\
   echoerr "Failed to change mode of backed up shifts file $COMPBK_NAME."
 
   eval $1="$COMPBK_NAME"