summaryrefslogtreecommitdiffstats
path: root/knetworkconf/backends/service-list.pl.in
blob: 3b7f2a17d2d97c0b0d8b26517e8992e6ba19ea40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#!/usr/bin/env perl
#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-

# Functions for getting service descriptions.
#
# Copyright (C) 2002 Ximian, Inc.
#
# Authors: Carlos Garnacho Parro <garnacho@tuxerver.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


# This function determines if a service is "forbidden" or not (if runlevel-admin must show it or not)
sub gst_service_list_service_is_forbidden
{
	my ($service) = @_;
	my ($ret);

  my ($service_forbidden_list) =
    [
     # These are the forbidden services I found in Red Hat
     "halt",
     "functions",
     "killall",
     # These are the forbidden services I found in Debian Woody	
     "single",
     "sendsigs",
     "reboot",
     "rcS",
     "modutils",
     "hostname\.sh",
     "devpts\.sh",
     "console-screen\.sh",
     "checkroot\.sh",
     "checkfs\.sh",
     "bootmisc\.sh",
     "bootclean\.sh",
     "checkfs\.sh",
     "keymap\.sh",
     "hwclockfirst\.sh",
     "etc-setserial",
     "procps\.sh",
     "mountall\.sh",
     "dns-clean",
     "ifupdown",
     "networking",
     "mountnfs\.sh",
     "mountkernfs",
     "mountvirtfs",
     "setserial",
     "hwclock\.sh",
     "urandom",
     "nviboot",
     "pppd-dns",
     "skeleton",
     "xfree86-common",
     "rc",
     ".*\.dpkg-old",
     ".*~",
     # this shouldn't be shown in slackware
     "inet2",
     # those were found in gentoo
     "bootmisc",
     "checkfs",
     "checkroot",
     "clock",
     "consolefont",
     "crypto-loop",
     "domainname",
     "hostname",
     "keymaps",
     "localmount",
     "net\..*",
     "numlock",
     "depscan\.sh",
     "functions\.sh",
     "halt\.sh",
     "reboot\.sh",
     "rmnologin",
     "runscript\.sh",
     "serial",
     "shutdown\.sh",
     "switch",
     # those were found in FreeBSD
     "DAEMON",
     "LOGIN",
     "NETWORKING",
     "SERVERS",
     "addswap",
     "adjkerntz",
     "archdep",
     "atm2\.sh",
     "atm3\.sh",
     "ccd",
     "cleanvar",
     "devdb",
     "devfs",
     "dhclient",
     "diskless",
     "dumpon",
     "fsck",
     "hostname",
     "initdiskless",
     "initrandom",
     "ldconfig",
     "local",
     "localdaemons",
     "mountcritlocal",
     "mountcritremote",
     "msgs",
     "netif",
     "network1",
     "network2",
     "network3",
     "nisdomain",
     "othermta",
     "pccard",
     "pcvt",
     "pwcheck",
     "random",
     "rcconf\.sh",
     "root",
     "savecore",
     "securelevel",
     "serial",
     "sppp",
     "swap1",
     "syscons",
     "sysctl",
     "ttys",
     "virecover",
     # These are the services found in SuSE
     "rc[sS0-9]\.d",
     "boot",
     "boot\..*",
    ];

  foreach $i (@$service_forbidden_list)
  {
    return 1 if ($service =~ "^$i\$");
  }
	
  return undef;
}


# Ok, maybe we should define this roles stuff a bit:
#
# SYSTEM: all system related services that only powerusers care of
# SOUND:  any service related to sound
# WEB_SERVER: any web server
# COMMAND_SCHEDULER: any service which runs scheduled commands
# NETWORK: network related services that only powerusers care of
# PRINTER_SERVICE: printing daemons in general
# DYNAMIC_DNS: Dinamic DNS services
# DICT:
# MTA: Mail transport agents
# MAIL_FETCHER: services that fetch the mail from other accounts
# DISPLAY_MANAGER: Display managers
# SYSTEM_LOGGER: system log services
# DATABASE_SERVER: database servers
# FILE_SERVER: file servers
# NTP_SERVER: Network time protocol servers
# SECURE_SHELL_SERVER: Secure shell servers
# AUTOMOUNTER: automounter daemons and so
# ANTIVIRUS:
# FILE_SHARING: for emule-like services
# FTP_SERVER:
#
#
# If you feel that there are more important/necessary roles,
# mail me at carlosg@gnome.org

sub gst_service_get_role
{
  my ($script) = @_;

  my %service_roles = (
    "acpid" => "SYSTEM",
    "alsa" => "SOUND",
    "am-utils" => "AUTOMOUNTER",
    "amavis" => "ANTIVIRUS",
    "amavis-ng" => "ANTIVIRUS",
    "apache" => "WEB_SERVER",
    "apache-perl" => "WEB_SERVER",
    "apache-ssl" => "WEB_SERVER",
    "apache2" => "WEB_SERVER",
    "anacron" => "COMMAND_SCHEDULER",
    "apmd" => "SYSTEM",
    "atd" => "COMMAND_SCHEDULER", #FIXME
    "atftpd" => "FTP_SERVER",
    "aumix" => "SOUND",
    "autofs" => "AUTOMOUNTER",
    "bind" => "NETWORK",
    "binfmt-support" => "SYSTEM",
    "bootlogd" => "SYSTEM",
    "chargen" => "NETWORK",
    "chargen-udp" => "NETWORK",
    "cherokee" => "WEB_SERVER",
    "clamav-daemon" => "ANTIVIRUS",
    "courier" => "MTA",
    "courier-mta" => "MTA",
    "cpufreqd" => "SYSTEM",
    "cron" => "COMMAND_SCHEDULER",
    "crond" => "COMMAND_SCHEDULER",
    "cupsd" => "PRINTER_SERVICE",
    "cups" => "PRINTER_SERVICE",
    "cupsys" => "PRINTER_SERVICE",
    "daytime" => "NETWORK",
    "daytime-udp" => "NETWORK",
    "dbus-1" => "SYSTEM",
    "ddclient" => "DYNAMIC_DNS",
    "dhis-client" => "DYNAMIC_DNS",
    "dictd" => "DICT",
    "echo" => "NETWORK",
    "echo-udp" => "NETWORK",
    "esound" => "SOUND",
    "exim" => "MTA",
    "fam" => "SYSTEM",
    "fcron" => "COMMAND_SCHEDULER",
    "firstboot" => "SYSTEM",
    "festival" => "SOUND",	 #FIXME
    "fetchmail" => "MAIL_FETCHER",
    "freenet6" => "NETWORK",
    "ftpd" => "FTP_SERVER",
    "gdm" => "DISPLAY_MANAGER",
    "gpm" => "SYSTEM",			#FIXME
    "hdparm" => "SYSTEM",
    "hotplug" => "SYSTEM",
    "httpd"	=> "WEB_SERVER",
    "inetd" => "NETWORK",
    "iptables" => "NETWORK",
    "irda" => "SYSTEM",
    "isakmpd" => "NETWORK",
    "isdn" => "NETWORK",
    "joystick" => "SYSTEM",
    "tdm"	=> "DISPLAY_MANAGER",
    "keytable" => "SYSTEM",
    "klogd"	=> "SYSTEM_LOGGER",
    "kudzu"	=> "SYSTEM",
    "lircd"	=> "SYSTEM",
    "lircmd" => "SYSTEM",
    "local" => "SYSTEM",
    "lpd" => "PRINTER_SERVICE",
    "lpdng" => "PRINTER_SERVICE",
    "mailscanner" => "ANTIVIRUS",
    "makedev" => "SYSTEM",
    "metalog" => "SYSTEM_LOGGER",
    "mldonkey-server" => "FILE_SHARING",
    "modules" => "SYSTEM",
    "module-init-tools" => "SYSTEM",
    "mysql" => "DATABASE_SERVER",
    "muddleftpd" => "FTP_SERVER",
    "named" => "NETWORK",
    "netfs" => "SYSTEM",
    "network" => "SYSTEM",
    "nfs"	=> "FILE_SERVER",
    "nfs-user-server"	=> "FILE_SERVER",
    "nfs-kernel-server"	=> "FILE_SERVER",
    "nfslock" => "SYSTEM",
    "nscd" => "NETWORK",
    "ntpd" => "NTP_SERVER",
    "ntpdate" => "NTP_SERVER",
    "ntp-client" => "NTP_CLIENT",
    "ntp-simple" => "NTP_SERVER",
    "oftpd" => "FTP_SERVER",
    "oops" => "NETWORK",
    "pcmcia" => "SYSTEM",
    "pdnsd" => "NETWORK",
    "pipsecd" => "NETWORK",
    "portmap" => "NETWORK",
    "postfix" => "MTA",
    "postgresql" => "DATABASE_SERVER",
    "postgresql-7.4" => "DATABASE_SERVER",
    "postgresql-8.0" => "DATABASE_SERVER",
    "ppp"	=> "NETWORK",
    "proftpd" => "FTP_SERVER",
    "privoxy" => "NETWORK",
    "pure-ftpd" => "FTP_SERVER",
    "qmail" => "MTA",
    "random" => "SYSTEM",
    "rawdevices" => "SYSTEM",
    "rhnsd" => "SYSTEM",
    "rsync" => "NETWORK",
    "rsyncd" => "NETWORK",
    "samba" => "FILE_SERVER",
    "saslauthd" => "SYSTEM",	 # FIXME: maybe a SECURITY role makes sense?
    "sendmail" => "MTA",
    "servers" => "NETWORK",
    "services" => "NETWORK",
    "setserial" => "SYSTEM",
    "sgi_fam" => "SYSTEM",
    "smartmontools" => "SYSTEM",
    "spamassassin" => "SYSTEM",
    "snmpd"	=> "NETWORK",
    "ssh"	=> "SECURE_SHELL_SERVER",
    "sshd" => "SECURE_SHELL_SERVER",
    "sysklogd" => "SYSTEM_LOGGER",
    "syslog" => "SYSTEM_LOGGER",
    "tftpd-hpa" => "FTP_SERVER",
    "time" => "NETWORK",
    "time-udp" => "NETWORK",
    "urandom" => "SYSTEM",
    "vcron" => "COMMAND_SCHEDULER",
    "vmware" => "SYSTEM",	 # FIXME
    "vsftpd" => "FTP_SERVER",
    "wdm"	=> "DISPLAY_MANAGER",
    "webmin" => "SYSTEM",	 # FIXME as well
    "winbind" => "NETWORK",
    "wine" => "SYSTEM",	 # FIXME like vmware
    "wu-ftpd" => "FTP_SERVER",
    "wzdftpd" => "FTP_SERVER",
    "xdm" => "DISPLAY_MANAGER",
    "xfs" => "SYSTEM",
    "xinetd" => "NETWORK",
    "zmailer" => "MTA",
  );

  my ($role) = $service_roles{$script};

  return $role if ($role);
  return "UNKNOWN";
}

1;