From 6f059fa388e04edc0094f3a1d5da02b0d837a20e Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Tue, 13 Jan 2004 15:31:02 +0000 Subject: put default option in configuration file --- ftp_wizard/Proftpd.pm | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'ftp_wizard/Proftpd.pm') diff --git a/ftp_wizard/Proftpd.pm b/ftp_wizard/Proftpd.pm index ad42e864..ca8a466b 100755 --- a/ftp_wizard/Proftpd.pm +++ b/ftp_wizard/Proftpd.pm @@ -46,6 +46,27 @@ my $o = { defaultimage => "$ENV{__WIZ_HOME__}ftp_wizard/images/FTP.png" }; +my %opt = ( + "SystemLog" => "/var/log/proftpd/proftpd.log", + "TransferLog" => "/var/log/proftpd/xferlog", + "Extendedlog" => "/var/log/proftpd/ftp.log", + "LogFormat default" => "\"%h %l %u %t \"%r\" %s %b\"", + "LogFormat auth" => "\"%v [%P] %h %t \"%r\" %s\"", + "LogFormat write" => "\"%h %l %u %t \"%r\" %s %b\"", + "ServerIdent" => "off", + "DeferWelcome" => "on", + "DisplayConnect" => "/etc/banner-proftpd", + "AccessDenyMsg" => "\" !-!! ACCESS DENY !!-! SEEMS YOU HAVE NO RIGHT THERE !!\"", + "AccessGrantMsg" => "\" -- Guest access granted for %u --\"", + "IdentLookups" => "off", + "UseReverseDNS" => "off", + "TimesGMT" => "off", + "DirFakeUser" => "off nobody", + "DirFakeGroup" => "off nobody", + "DeleteAbortedStores" => "off", + "PersistentPasswd" => "off", + ); + $o->{pages} = { welcome => { name => N("FTP Server Configuration Wizard") . "\n\n" . N("This wizard will help you configuring the FTP Server for your network."), @@ -185,7 +206,6 @@ sub change_options { my ($var, $var_in_conf) = @_; my $file = "/etc/proftpd.conf"; my $status; - print "now in change options\n"; if ($var == 1) { $status = "on" } else { $status = "off" } if ( any { /^$var_in_conf/ } cat_($file)) { substInFile { s/$var_in_conf.*/$var_in_conf $status/ } $file; @@ -194,6 +214,17 @@ sub change_options { } } +sub add_options { + my ($var, $value) = @_; + my $file = "/etc/proftpd.conf"; + if ( any { /^$var/ } cat_($file)) { + substInFile { s/$var.*/$var $value/ } $file; + } else { + append_to_file($file, "$var $value\n") + } +} + + sub do_it { $::testing and return; my $wiz_ftp_internal = $o->{var}{wiz_ftp_external} ? 1 : true $o->{var}{wiz_ftp_internal}; @@ -303,7 +334,12 @@ sub do_it { substInFile { s/DefaultRoot.*/$data/ } $file; } else { append_to_file($file, "$data\n"); - } + } + + my $cle, my $val; + while (($cle, $val) = each %opt) { + add_options($cle, $val); + } if (services::is_service_running('proftpd')) { services::restart('proftpd') -- cgit v1.2.1