summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eb347d2)
raw | patch | inline | side by side (parent: eb347d2)
author | opensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Sat, 27 Mar 2010 23:16:50 +0000 (23:16 +0000) | ||
committer | opensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Sat, 27 Mar 2010 23:16:50 +0000 (23:16 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17315 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/corefunctions.pm | patch | blob | history |
index 71d783463799d32877df9347ec1f2f9383c05a92..016e6b888ee0d91d2c9b5db40be6d84c885fdbb8 100644 (file)
package corefunctions;
-use Exporter;
-@ISA = qw(Exporter);
-my @events = (
- "get_events",
- "registered",
- 'new_syslog_config',
- "new_ntp_config",
- "new_ldap_config",
- "new_key",
- "generate_hw_digest", # no implementations
- "detect_hardware",
- "confirm_new_key",
- "ping",
- "import_events", # no implementations
- );
-@EXPORT = @events;
use strict;
use warnings;
+use Exporter;
use Fcntl;
use GOSA::GosaSupportDaemon;
use File::Basename;
+@ISA = qw(Exporter);
+my @events = (
+ "get_events",
+ "registered",
+ 'new_syslog_config',
+ "new_ntp_config",
+ "new_ldap_config",
+ "new_key",
+ "generate_hw_digest", # no implementations
+ "detect_hardware",
+ "confirm_new_key",
+ "ping",
+ "import_events", # no implementations
+ );
+@EXPORT = @events;
+
my ($ldap_enabled, $offline_enabled, $ldap_config, $pam_config, $nss_config, $fai_logpath, $ldap_config_exit_hook);
my $chrony_file = "/etc/chrony/chrony.conf";
open (FILE, "$file");
close(FILE);
}
- open(FILE, ">> $file") or &main::daemon_log("ERROR in corefunctions.pm: can not open '$file' to write '$string'", 1);;
+ open(FILE, ">>", "$file") or &main::daemon_log("ERROR in corefunctions.pm: can not open '$file' to write '$string'", 1);;
print FILE $string."\n";
close(FILE);
}
}
# Substitute existing server with new syslog server
- open (FILE, "<$syslog_file");
- my @file = <FILE>;
- close FILE;
+ open ($FILE, "<","$syslog_file");
+ my @file = <$FILE>;
+ close($FILE);
my $syslog_server_line = "*.*\t@".$syslog_server."\n";
foreach my $line (@file) {
if ($line =~ /^\*\.\*\s+@/) {
}
# Write changes to file and close it
- open (FILE, "+>$syslog_file");
- print FILE join("", @file);
- close FILE;
+ open ($FILE, "+>","$syslog_file");
+ print $FILE join("", @file);
+ close($FILE);
&main::daemon_log("INFO: Wrote new configuration file: $syslog_file", 5);
# Restart syslog deamon
}
# Substitute existing server with new ntp server
- open (FILE, "<$chrony_file");
- my @file = <FILE>;
- close FILE;
+ open ($FILE, "<","$chrony_file");
+ my @file = <$FILE>;
+ close($FILE);
my @new_file;
foreach my $line (@file) {
if ($line =~ /^server\s+/) {
}
# Write changes to file and close it
- open (FILE, ">$chrony_file");
- print FILE join("", @new_file);
- close FILE;
+ open ($FILE, ">","$chrony_file");
+ print $FILE join("", @new_file);
+ close($FILE);
&main::daemon_log("INFO: Wrote new configuration file: $chrony_file", 5);
# Restart chrony deamon
# Setup ldap.conf
my $file1;
my $file2;
- open(file1, "> $ldap_config");
- print file1 "# This file was automatically generated by gosa-si-client. Do not change.\n";
- print file1 "URI";
+ open($file1, ">","$ldap_config");
+ print $file1 "# This file was automatically generated by gosa-si-client. Do not change.\n";
+ print $file1 "URI";
foreach $element (@ldap_uris) {
- print file1 " $element";
+ print $file1 " $element";
}
- print file1 "\nBASE $ldap_base\n";
+ print $file1 "\nBASE $ldap_base\n";
foreach $element (@ldap_options) {
- print file1 "$element\n";
+ print $file1 "$element\n";
}
- close (file1);
+ close ($file1);
daemon_log("INFO: Wrote $ldap_config", 5);
# Setup pam_ldap.conf / libnss-ldap.conf
- open(file1, "> $pam_config");
- open(file2, "> $nss_config");
- print file1 "# This file was automatically generated by gosa-si-client. Do not change.\n";
- print file2 "# This file was automatically generated by gosa-si-client. Do not change.\n";
- print file1 "uri";
- print file2 "uri";
+ open($file1, ">","$pam_config");
+ open($file2, ">","$nss_config");
+ print $file1 "# This file was automatically generated by gosa-si-client. Do not change.\n";
+ print $file2 "# This file was automatically generated by gosa-si-client. Do not change.\n";
+ print $file1 "uri";
+ print $file2 "uri";
foreach $element (@ldap_uris) {
- print file1 " $element";
- print file2 " $element";
+ print $file1 " $element";
+ print $file2 " $element";
}
- print file1 "\nbase $ldap_base\n";
- print file2 "\nbase $ldap_base\n";
+ print $file1 "\nbase $ldap_base\n";
+ print $file2 "\nbase $ldap_base\n";
foreach $element (@pam_options) {
- print file1 "$element\n";
+ print $file1 "$element\n";
}
foreach $element (@nss_options) {
- print file2 "$element\n";
+ print $file2 "$element\n";
}
- close (file2);
+ close ($file2);
daemon_log("INFO: Wrote $nss_config", 5);
- close (file1);
+ close ($file1);
daemon_log("INFO: Wrote $pam_config", 5);
# Create goto.secrets if told so - for compatibility reasons
if (defined $goto_admin){
- open(file1, "> /etc/goto/secret");
- close(file1);
+ open($file1, ">","/etc/goto/secret");
+ close($file1);
chown(0,0, "/etc/goto/secret");
chmod(0600, "/etc/goto/secret");
- open(file1, "> /etc/goto/secret");
- print file1 "GOTOADMIN=\"$goto_admin\"\nGOTOSECRET=\"$goto_secret\"\n";
- close(file1);
+ open($file1, ">","/etc/goto/secret");
+ print $file1 "GOTOADMIN=\"$goto_admin\"\nGOTOSECRET=\"$goto_secret\"\n";
+ close($file1);
daemon_log("INFO: Wrote /etc/goto/secret", 5);
}
my $ldap_server= $ldap_uris[0];
$ldap_server=~ s/^ldap:\/\/([^:]+).*$/$1/;
- open(file1, "> $cfg_name");
- print file1 "LDAP_BASE=\"$ldap_base\"\n";
- print file1 "LDAP_SERVER=\"$ldap_server\"\n";
- print file1 "LDAP_URIS=\"@ldap_uris\"\n";
- print file1 "ADMIN_BASE=\"$admin_base\"\n";
- print file1 "DEPARTMENT=\"$department\"\n";
- print file1 "RELEASE=\"$release\"\n";
- print file1 "UNIT_TAG=\"".(defined $unit_tag ? "$unit_tag" : "")."\"\n";
- print file1 "UNIT_TAG_FILTER=\"".(defined $unit_tag ? "(gosaUnitTag=$unit_tag)" : "")."\"\n";
- close(file1);
+ open($file1, ">","$cfg_name");
+ print $file1 "LDAP_BASE=\"$ldap_base\"\n";
+ print $file1 "LDAP_SERVER=\"$ldap_server\"\n";
+ print $file1 "LDAP_URIS=\"@ldap_uris\"\n";
+ print $file1 "ADMIN_BASE=\"$admin_base\"\n";
+ print $file1 "DEPARTMENT=\"$department\"\n";
+ print $file1 "RELEASE=\"$release\"\n";
+ print $file1 "UNIT_TAG=\"".(defined $unit_tag ? "$unit_tag" : "")."\"\n";
+ print $file1 "UNIT_TAG_FILTER=\"".(defined $unit_tag ? "(gosaUnitTag=$unit_tag)" : "")."\"\n";
+ close($file1);
daemon_log("INFO: Wrote $cfg_name", 5);
# Write offline config
$cfg_name= "/etc/ldap/ldap-offline.conf";
# Get first LDAP server
- open(file1, "> $cfg_name");
- print file1 "LDAP_BASE=\"$ldap_base\"\n";
- print file1 "LDAP_SERVER=\"127.0.0.1\"\n";
- print file1 "LDAP_URIS=\"ldap://127.0.0.1\"\n";
- print file1 "ADMIN_BASE=\"$admin_base\"\n";
- print file1 "DEPARTMENT=\"$department\"\n";
- print file1 "RELEASE=\"$release\"\n";
- print file1 "UNIT_TAG=\"".(defined $unit_tag ? "$unit_tag" : "")."\"\n";
- print file1 "UNIT_TAG_FILTER=\"".(defined $unit_tag ? "(gosaUnitTag=$unit_tag)" : "")."\"\n";
- close(file1);
+ open($file1, ">","$cfg_name");
+ print $file1 "LDAP_BASE=\"$ldap_base\"\n";
+ print $file1 "LDAP_SERVER=\"127.0.0.1\"\n";
+ print $file1 "LDAP_URIS=\"ldap://127.0.0.1\"\n";
+ print $file1 "ADMIN_BASE=\"$admin_base\"\n";
+ print $file1 "DEPARTMENT=\"$department\"\n";
+ print $file1 "RELEASE=\"$release\"\n";
+ print $file1 "UNIT_TAG=\"".(defined $unit_tag ? "$unit_tag" : "")."\"\n";
+ print $file1 "UNIT_TAG_FILTER=\"".(defined $unit_tag ? "(gosaUnitTag=$unit_tag)" : "")."\"\n";
+ close($file1);
daemon_log("INFO: Wrote $cfg_name", 5);
}