[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [HS]/etc/sudoers



Le Mon, 5 Dec 2016 20:51:35 +0100,
Christophe Musseau <christo.2so@gmail.com> a écrit :

> Bonsoir la liste.
> 
> Je souhaiterais empêcher les utilisateurs ayant accès à la commande
> sudo d'éditer le fichier /etc/sudoers.
> J'ai bien inséré la ligne dans mon fichier:
> nom_Utilisateur ALL=(ALL:ALL) ALL,!/usr/sbin/visudo
> J'ai ensuite lancé un:
> #chown 700 /etc/sudoers
> Mais l'utilisateur peut de son côté éditer le fichier et le modifier
> par: $sudo vim /etc/sudoers
> 
> Bref, peut-être que je me leurre. A partir du moment où je donne
> accès à la commande sudo à des utilisateurs, je me tire une balle
> dans le pied pour ce qui est de la sécurité de ce fichier.
> 
> Merci pour vos éventuelles idées
> 
> 

Pour ma part, tout est interdit.
Je n'autorise que quelques commandes.

Exemple pour l'utilisateur toto
# /etc/sudoers.d/toto
#
# This file MUST be edited with the 'visudo -f ' command as root.
#
# See the man page for details on how to write a sudoers file.
#

# Host alias specification
# Address range from which command can be used
Host_Alias	NOC = 192.168.1.0/255.255.255.0
Host_Alias	LOC = machine.fqdn, machine,localhost

# User alias specification
User_Alias	ADMIN_TEAM = root, toto

# Cmnd alias specification
# tail in /var/log directory only
Cmnd_Alias	TAIL = /usr/bin/tail /var/log/*
# Debian tools for administration
Cmnd_Alias	DEBIAN_TOOLS = 	/usr/bin/aptitude, \
				/usr/bin/apt-cache, \
				/usr/bin/apt-file, \
				/usr/bin/apt-get, \
				/usr/bin/synaptic, \
				/usr/bin/dpkg, \
				/usr/bin/dpkg-reconfigure
# stop running system
Cmnd_Alias	START_STOP = 	/sbin/halt, \
				/sbin/reboot
# managing network interface
Cmnd_Alias	NETWORK = 	/sbin/ifup, \
				/sbin/ifdown, \
				/etc/init.d/fwbuilder, \
				/usr/bin/wireshark, \
				/usr/bin/tshark, \
				/sbin/iwlist, \
				/sbin/iwconfig, \
				/usr/sbin/wifi-radar, \
				/usr/sbin/wpa_gui, \
				/opt/wicd/gui.py

# User privilege specification
root	ALL=(ALL:ALL) ALL

ADMIN_TEAM 	NOC = NOPASSWD: DEBIAN_TOOLS, TAIL
toto		LOC = NOPASSWD: DEBIAN_TOOLS, TAIL, START_STOP,NETWORK



-- 
Jack.R


Reply to: