[system-tools-backends-clone] Enable ServicesList filtering to hide critical services



commit 82a1ddeb544e8438b030563a7a4ad8459c398dad
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Fri Jan 29 19:27:51 2010 +0100

    Enable ServicesList filtering to hide critical services
    
    Use the list of "forbidden" services that was present in ServicesList.pm to filter services we send to the clients. This list includes every service that should not be easily disabled since they could hurt the system. With this change, clients can show all services to the user, instead of limiting to those they know about.
    
    Add many services from Ubuntu, which are likely to exist on other distributions. In particular, we now hide gdm and dbus since disabling those is rarely needed and can be dangerous - it would be equivalent to shooting us in the arm, anyway.

 Init/Services.pm     |   16 +++++++++-------
 Init/ServicesList.pm |   32 +++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 8 deletions(-)
---
diff --git a/Init/Services.pm b/Init/Services.pm
index f7b014f..7d27d95 100644
--- a/Init/Services.pm
+++ b/Init/Services.pm
@@ -176,7 +176,9 @@ sub get_upstart_services
 		@info = &get_upstart_service_info ($service);
 		# Only manage traditional init.d scripts, ignore services with jobs installed
 		$script = $info[0];
-		if (!-e "$init_path/$script.conf")
+
+		if (!&Init::ServicesList::is_forbidden ($script)
+		    && !-e "$init_path/$script.conf")
 		{
                         push @arr, \ info  if (scalar (@info));
                 }
@@ -409,7 +411,7 @@ sub get_sysv_services
 		my (@info);
 
 		@info = &get_sysv_service_info ($service);
-    push @arr, \ info  if (scalar (@info));
+		push @arr, \ info  if (scalar (@info) && !&Init::ServicesList::is_forbidden ($info[0]));
 	}
 
 	return \ arr;
@@ -795,7 +797,7 @@ sub get_bsd_services
     my (@info);
 
     @info = &get_bsd_service_info ($$scripts{$name}, $name);
-    push @arr, \ info if (scalar (@info));
+    push @arr, \ info if (scalar (@info) && !&Init::ServicesList::is_forbidden ($info[0]));
   }
 
   return \ arr;
@@ -991,7 +993,7 @@ sub get_gentoo_services
     my (@info);
 
     @info = &get_gentoo_service_info ($service, $runlevels_services);
-    push @arr, \ info if scalar (@info);
+    push @arr, \ info if (scalar (@info) && !&Init::ServicesList::is_forbidden ($info[0]));
   }
 
   return \ arr;
@@ -1132,7 +1134,7 @@ sub get_rcng_services
 
     $service =~ s/.*\///;
     @info = &get_rcng_service_info ($service);
-    push @arr, \ info if (scalar (@info));
+    push @arr, \ info if (scalar (@info) && !&Init::ServicesList::is_forbidden ($info[0]));
   }
 
   return \ arr;
@@ -1312,7 +1314,7 @@ sub get_suse_services
 
     $service =~ s/.*\///;
     @info = &get_suse_service_info ($service);
-    push @arr, \ info  if (scalar (@info));
+    push @arr, \ info  if (scalar (@info) && !&Init::ServicesList::is_forbidden ($info[0]));
   }
 
   return \ arr;
@@ -1474,7 +1476,7 @@ sub get_smf_services
     my (@info);
 
     @info = &get_smf_service_info ($service);
-    push @arr, \ info if scalar (@info);
+    push @arr, \ info if scalar (@info && !&Init::ServicesList::is_forbidden ($info[0]));
   }
 
   return \ arr;
diff --git a/Init/ServicesList.pm b/Init/ServicesList.pm
index c8297f2..a497cec 100644
--- a/Init/ServicesList.pm
+++ b/Init/ServicesList.pm
@@ -66,7 +66,7 @@ sub is_forbidden
      "skeleton",
      "xfree86-common",
      "rc",
-     ".*\.dpkg-old",
+     ".*\.dpkg.*",
      ".*~",
      # this shouldn't be shown in slackware
      "inet2",
@@ -147,6 +147,36 @@ sub is_forbidden
      "rc[sS0-9]\.d",
      "boot",
      "boot\..*",
+     # These were found in Ubuntu (9.10)
+     "binfmt-support",
+     "consolescreen.sh",
+     "console-setup",
+     "dbus",
+     "dkms_autoinstaller",
+     "gdm",
+     "gdm-new",
+     "grub-common",
+     "kexec",
+     "kexec-load",
+     "keyboard-setup",
+     "killprocs",
+     "linux-restricted-modules-common",
+     "mountdebugfs",
+     "policykit",
+     "readahead",
+     "readahead-desktop",
+     "rc.local",
+     "screen-cleanup",
+     "stop-bootlogd",
+     "stop-bootlogd-single",
+     "stop-readahead",
+     "sysstat",
+     "umountfs",
+     "umountnfs\.sh",
+     "umountroot",
+     "ureadahead",
+     "wpa-ifupdown",
+     "x11-common",
     ];
 
   foreach $i (@$service_forbidden_list)



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