Activate DEBUG, don't perform any action on the system
This commit is contained in:
		
							parent
							
								
									9463b4ee27
								
							
						
					
					
						commit
						0c8637b638
					
				|  | @ -1,7 +1,7 @@ | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| # Automatisation de configuration backuppc pour poste linux | # Automatisation de configuration backuppc pour poste MAC | ||||||
| # Institut de Physique de Rennes UMR6251 | # Institut de Physique de Rennes UMR6251 | ||||||
| # Anthony CARRÉ, Jérémy GARDAIS, Guillaume RAFFY — Mars 2016 | # Jérémy GARDAIS, Guillaume RAFFY — Avril 2018 | ||||||
| 
 | 
 | ||||||
| SUCCESS=0 | SUCCESS=0 | ||||||
| ERROR=1 | ERROR=1 | ||||||
|  | @ -18,14 +18,16 @@ function allowUserToConnectToThisMachineUsingSsh() | ||||||
| { | { | ||||||
| 	local userLogin="$1" | 	local userLogin="$1" | ||||||
| 
 | 
 | ||||||
| 	dscl . append '/Groups/com.apple.access_ssh' user "${userLogin}" | 	#dscl . append '/Groups/com.apple.access_ssh' user "${userLogin}" | ||||||
| 	dscl . append /Groups/com.apple.access_ssh groupmembers $(dscl . read "/Users/${userLogin}" GeneratedUID | cut -d " " -f 2) | 	#dscl . append /Groups/com.apple.access_ssh groupmembers $(dscl . read "/Users/${userLogin}" GeneratedUID | cut -d " " -f 2) | ||||||
|  | 	printf '\e[1;31m%-6s\e[m' "DEBUG : Autoriser les accès SSH pour ${userLogin}." | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function ensurePingIsAllowed() | function ensurePingIsAllowed() | ||||||
| { | { | ||||||
| 	sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode off | 	#sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode off | ||||||
|  | 	printf '\e[1;31m%-6s\e[m' "DEBUG : Désactivation du mode furtif (ping)." | ||||||
| 	if [ $? != 0 ]; then | 	if [ $? != 0 ]; then | ||||||
| 		printf '\e[1;31m%-6s\e[m' "La désactivation du mode furtif a échoué"; return "$ERROR" | 		printf '\e[1;31m%-6s\e[m' "La désactivation du mode furtif a échoué"; return "$ERROR" | ||||||
| 	fi | 	fi | ||||||
|  | @ -33,14 +35,16 @@ function ensurePingIsAllowed() | ||||||
| 
 | 
 | ||||||
| function ensureSshdIsRunning() | function ensureSshdIsRunning() | ||||||
| { | { | ||||||
| 	sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null | 	#sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null | ||||||
|  | 	printf '\e[1;31m%-6s\e[m' "DEBUG : Vérification si sshd est déjà en cours." | ||||||
| 	if [ $? != 0 ]; then | 	if [ $? != 0 ]; then | ||||||
| 		# enable 'Remote login' in 'system preferences' | 		# enable 'Remote login' in 'system preferences' | ||||||
| 		sudo launchctl enable system/com.openssh.sshd &> /dev/null | 		sudo launchctl enable system/com.openssh.sshd &> /dev/null | ||||||
| 
 | 
 | ||||||
| 		sudo launchctl load /System/Library/LaunchDaemons/ssh.plist &> /dev/null | 		sudo launchctl load /System/Library/LaunchDaemons/ssh.plist &> /dev/null | ||||||
| 	fi | 	fi | ||||||
| 	sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null | 	#sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null | ||||||
|  | 	printf '\e[1;31m%-6s\e[m' "DEBUG : Activation du serveur ssh." | ||||||
| 	if [ $? != 0 ]; then | 	if [ $? != 0 ]; then | ||||||
| 		printf '\e[1;31m%-6s\e[m' "L'activation du serveur ssh a échoué"; return "$ERROR" | 		printf '\e[1;31m%-6s\e[m' "L'activation du serveur ssh a échoué"; return "$ERROR" | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue