From 17f2c1fa484f92c0bdfa673070314d020e77f922 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 14 Jul 2003 19:25:13 +0000 Subject: translate default values qw(yes no all ignore ...) and provide english (l10n-able) descriptions instead of function names --- perl-install/security/l10n.pm | 62 +++++++++++++++++++++++++++++++++++++++++ perl-install/standalone/draksec | 24 +++++++++++----- 2 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 perl-install/security/l10n.pm diff --git a/perl-install/security/l10n.pm b/perl-install/security/l10n.pm new file mode 100644 index 000000000..0cec52cdd --- /dev/null +++ b/perl-install/security/l10n.pm @@ -0,0 +1,62 @@ +package security::l10n; +# This help was build from stripped python description of msec functions + +use common; + +sub fields { + return ( + 'accept_bogus_error_responses' => N("Accept bogus IPv4 error messages"), + 'accept_broadcasted_icmp_echo' => N("Accept broadcasted icmp echo"), + 'accept_icmp_echo' => N("Accept icmp echo"), + 'allow_autologin' => N("Autologin"), + 'allow_issues' => N("/etc/issue* exist"), + 'allow_reboot' => N("Reboot by the console user"), + 'allow_remote_root_login' => N("Allow remote root login"), + 'allow_root_login' => N("Direct root login"), + 'allow_user_list' => N("List users on display managers (kdm and gdm)"), + 'allow_x_connections' => N("Allow X Window connections"), + 'allow_xserver_to_listen' => N("Authorize TCP connections X Window"), + 'authorize_services' => N("Authorize all services controlled by tcp_wrappers"), + 'create_server_link' => N("Chkconfig obey msec rules"), + 'enable_at_crontab' => N("Enable \"crontab\" and \"at\" for users"), + 'enable_console_log' => N("Syslog reports to console 12"), + 'enable_dns_spoofing_protection' => N("Name resolution spoofing protection"), + 'enable_ip_spoofing_protection' => N("Enable IP spoofing protection"), + 'enable_libsafe' => N("Enable libsafe if libsafe is found on the system"), + 'enable_log_strange_packets' => N("Enable the logging of IPv4 strange packets"), + 'enable_msec_cron' => N("Enable msec hourly security check"), + 'enable_pam_wheel_for_su' => N("Enable su only from the wheel group members or for any user"), + 'enable_password' => N("Use password to authenticate users"), + 'enable_promisc_check' => N("Ethernet cards promiscuity check"), + 'enable_security_check' => N("Daily security check"), + 'enable_sulogin' => N("Sulogin(8) in single user level"), + 'no_password_aging_for' => N("No password aging for"), + 'password_aging' => N("Set password expiration and account inactivation delays"), + 'password_history' => N("Password history length"), + 'password_length' => N("Password minimum length and number of digit and upcase letters"), + 'set_root_umask' => N("Root umask"), + 'set_shell_history_size' => N("Shell history size"), + 'set_shell_timeout' => N("Shell timeout"), + 'set_user_umask' => N("User umask"), + CHECK_OPEN_PORT => N("Check open ports"), + CHECK_PASSWD => N("Check for unsecured accounts"), + CHECK_PERMS => N("Check permissions of files in the users' home"), + CHECK_PROMISC => N("Check if the network devices are in promiscuous mode"), + CHECK_SECURITY => N("Run the daily security checks"), + CHECK_SGID => N("Check additions/removals of sgid files"), + CHECK_SHADOW => N("Check empty password in /etc/shadow"), + CHECK_SUID_MD5 => N("Verify checksum of the suid/sgid files"), + CHECK_SUID_ROOT => N("Check additions/removals of suid root files"), + CHECK_UNOWNED => N("Report unowned files"), + CHECK_WRITABLE => N("Check files/directories writable by everybody"), + CHKROOTKIT_CHECK => N("Run chkrootkit checks"), + MAIL_EMPTY_CONTENT => N("Do not send mails when uneeded"), + MAIL_USER => N("If set, send the mail report to this email address else send it to root"), + MAIL_WARN => N("Report check result by mail"), + RPM_CHECK => N("Run some checks against the rpm database"), + SYSLOG_WARN => N("Report check result to syslog"), + TTY_WARN => N("Reports check result to tty"), + ); +} + +1; diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index a3fe96f0e..bbf444fe4 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -28,6 +28,7 @@ use run_program; use security::level; use security::msec; use security::help; +use security::l10n; #$MODE = 'basic'; #$0 =~ /draksec-firewall$/ and $MODE = 'firewall'; @@ -36,7 +37,7 @@ use security::help; #/^-?-(\S+)$/ and $options{$1} = 1 foreach @ARGV; -my $w; +my ($w, %fields); # factorize this with rpmdrake and harddrake2 sub wait_msg { @@ -76,8 +77,8 @@ Security Administrator: sub new_editable_combo { my ($string_list, $o_default_value) = @_; my $w = new Gtk2::OptionMenu(); - $w->set_popdown_strings(@$string_list) unless is_empty_array_ref $string_list; - $w->entry->set_text($o_default_value) if $o_default_value; + $w->set_popdown_strings(to_i18n(@$string_list)) unless is_empty_array_ref $string_list; + $w->entry->set_text(to_i18n($o_default_value)) if $o_default_value; $w; } @@ -91,6 +92,15 @@ my $msec = new security::msec; $w = ugtk2->new('draksec'); my $window = $w->{window}; +%fields = security::l10n::fields(); + +############################ I18N ################################### +my %inv_translations = map { translate($_) => $_ } N_("ALL"), N_("LOCAL"), N_("N_ON_E"), N_("default"), N_("default"), N_("ignore"), N_("no"), N_("yes"); +my %translations = reverse %inv_translations; + +sub to_i18n { map { $translations{$_} || $_ } @_ } +sub from_i18n { $inv_translations{$_->[0]} } + ############################ MAIN WINDOW ################################### # Set different options to Gtk2::Window unless ($::isEmbedded) { @@ -162,7 +172,7 @@ foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ]) } $entry->set_text($msec->get_function_value($i)); set_help_tip($entry, $default, $i); - [ new Gtk2::Label($i), $values{$i} ]; + [ Gtk2::Label->new($fields{$i} || $i), $values{$i} ]; } sort $msec->list_functions($domain))))), new Gtk2::Label($label)); $options_values{$domain} = \%values; @@ -179,7 +189,7 @@ $notebook->append_page(gtkshow(create_scrolled_window(gtkpack_(new Gtk2::VBox(0, $security_checks_value{$i} = new_editable_combo([ 'yes', 'no', 'default' ], $msec->get_check_value($i)); my $entry = $security_checks_value{$i}->entry; set_help_tip($entry, $msec->get_check_default($i), $i); - [ gtkshow(new Gtk2::Label(translate($i))), $security_checks_value{$i} ]; + [ gtkshow(new Gtk2::Label($fields{$i} || translate($i))), $security_checks_value{$i} ]; } sort $msec->list_checks)))), new Gtk2::Label(N("Periodic Checks"))); @@ -212,7 +222,7 @@ my $bok = gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), log::explanations("Setting security periodic checks"); foreach my $key (keys %security_checks_value) { - $msec->set_check($key, $security_checks_value{$key}->entry->get_text); + $msec->set_check($key, from_i18n($security_checks_value{$key}->entry->get_text)); } $msec->apply_checks; @@ -220,7 +230,7 @@ my $bok = gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), log::explanations("Setting msec functions related to $domain"); foreach my $key (keys %{$options_values{$domain}}) { my $opt = $options_values{$domain}{$key}; - $msec->set_function($key, $opt =~ /Combo/ ? $opt->entry->get_text : $opt->get_text); + $msec->set_function($key, from_i18n($opt =~ /Combo/ ? $opt->entry->get_text : $opt->get_text)); } } $msec->apply_functions; -- cgit v1.2.1