summaryrefslogtreecommitdiffstats
path: root/ftp_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'ftp_wizard')
-rwxr-xr-xftp_wizard/Proftpd.pm4
-rw-r--r--ftp_wizard/ftp.wiz229
-rw-r--r--ftp_wizard/scripts/ProFtpconf.pm163
3 files changed, 3 insertions, 393 deletions
diff --git a/ftp_wizard/Proftpd.pm b/ftp_wizard/Proftpd.pm
index 45247a33..c4bb6b0c 100755
--- a/ftp_wizard/Proftpd.pm
+++ b/ftp_wizard/Proftpd.pm
@@ -2,7 +2,9 @@
# Drakwizard
-# Copyright (C) 2003 Florent Villard <warly@mandrakesoft.com>
+# Copyright (C) 2003 Mandrakesoft
+#
+# Author: Florent Villard <warly@mandrakesoft.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/ftp_wizard/ftp.wiz b/ftp_wizard/ftp.wiz
deleted file mode 100644
index 5c7a055c..00000000
--- a/ftp_wizard/ftp.wiz
+++ /dev/null
@@ -1,229 +0,0 @@
-<?xml version="1.0"?>
-
-
-<Wizard
- name="general"
- libScript="__WIZ_HOME__/common/scripts/functions.sh"
- wizardTitle="FTP wizard"
- imagePosition="top"
- defaultImage="__WIZ_HOME__/ftp_wizard/images/FTP.png"
- perlModule="__WIZ_HOME__/ftp_wizard/scripts/ProFtpconf.pm"
- rpm="proftpd"
- summaryFunc="do_it"
->
-
- <Variable
- name="wiz_ftp_internal"
- shellVariable="wiz_ftp_internal"
- >
- </Variable>
-
- <Variable
- name="wiz_ftp_external"
- shellVariable="wiz_ftp_external"
- >
- </Variable>
-
- <Variable
- name="wiz_ftp_anon"
- shellVariable="wiz_ftp_external"
- >
- </Variable>
-
- <Variable
- name="wiz_ftp_home"
- shellVariable="wiz_ftp_external"
- >
- </Variable>
-
- <Page
- helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-ftp.html"
- name="welcome"
- func="check"
- executionLevel="NORMAL"
- nextFinish="false"
- canBack="false"
- canCancel="true"
- >
-
- <Target
- targetName="must be root"
- jumpIndex="1"
- >
- </Target>
-
- <Target
- targetName="ftp connections"
- jumpIndex="0"
- >
- </Target>
-
- <Target
- targetName="error_dhcp"
- jumpIndex="2"
- >
- </Target>
-
- <Info
- helpText="FTP Server Configuration Wizard"
- >
- </Info>
-
-
- <Info
- helpText="This wizard will help you configuring the FTP Server for your network."
- >
- </Info>
- </Page>
-
- <Page
- helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-ftp.html"
- name="must be root"
- nextButtonText="OK"
- executionLevel="NORMAL"
- nextFinish="true"
- canBack="true"
- canCancel="true"
- >
-
- <Info
- helpText="Sorry, you must be root to do this..."
- >
- </Info>
- </Page>
-
- <Page
- helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-web.html"
- name="error_dhcp"
- jumpPage="ftp connections"
- executionLevel="NORMAL"
- nextFinish="false"
- canBack="true"
- canCancel="true"
- >
-
- <Info
- helpText="Warning\nYou are in dhcp, server may not work with your configuration."
- >
- </Info>
- </Page>
-
- <Page
- helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-ftp.html"
- name="ftp connections"
- executionLevel="NORMAL"
- nextFinish="false"
- canBack="true"
- canCancel="true"
- >
-
- <Info
- helpText="FTP Server"
- >
- </Info>
-
-
- <Info
- helpText="Your server can act as an FTP Server toward your internal network (intranet) and as an FTP Server for the Internet."
- >
- </Info>
-
-
- <Info
- helpText="Select the kind of FTP service you want to activate:"
- >
- </Info>
-
-
- <Boolean
- name="wiz_ftp_internal"
- variableName="wiz_ftp_internal"
- forceEnabled="1"
- forceDisabled="0"
- helpText="Enable the FTP Server for the Intranet"
- >
- </Boolean>
-
-
- <Boolean
- name="wiz_ftp_external"
- variableName="wiz_ftp_external"
- forceEnabled="1"
- forceDisabled="0"
- helpText="Enable the FTP Server for the Internet"
- >
- </Boolean>
-
-
- <Info
- helpText="Don't check any box if you don't want to activate your FTP Server."
- >
- </Info>
- </Page>
-
- <Page
- helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-ftp.html"
- name="confirmation"
- func="do_it"
- jumpPage="congratulations"
- nextButtonText="Configure"
- executionLevel="NORMAL"
- nextFinish="false"
- canBack="true"
- canCancel="true"
- >
-
- <Info
- helpText="Configuring the FTP Server"
- >
- </Info>
-
-
- <Info
- helpText="The wizard collected the following parameters
-needed to configure your FTP Server"
- >
- </Info>
-
- <Freetext
- variableName="wiz_ftp_internal"
- helpText="Intranet FTP Server:"
- editable="false"
- >
- </Freetext>
-
- <Freetext
- variableName="wiz_ftp_external"
- helpText="Internet FTP Server:"
- editable="false"
- >
- </Freetext>
-
- <Info
- helpText="To accept these values, and configure your server, click the Next button or use the Back button to correct them."
- >
- </Info>
- </Page>
-
- <Page
- helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-ftp.html"
- name="congratulations"
- nextButtonText="Quit"
- executionLevel="NORMAL"
- nextFinish="true"
- canBack="false"
- canCancel="false"
- >
-
- <Info
- helpText="Congratulations"
- >
- </Info>
-
-
- <Info
- helpText="The wizard successfully configured your Intranet/Internet FTP Server"
- >
- </Info>
- </Page>
-</Wizard>
diff --git a/ftp_wizard/scripts/ProFtpconf.pm b/ftp_wizard/scripts/ProFtpconf.pm
deleted file mode 100644
index 854245cc..00000000
--- a/ftp_wizard/scripts/ProFtpconf.pm
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/usr/bin/perl
-
-# Drakwizard
-
-# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com)
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-package ProFtpconf;
-require "__WIZ_HOME__/common/scripts/IFCFG.pm";
-use MDK::Common;
-use strict;
-require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-
-sub true {
- my ($val) = @_;
-
- $val eq "1" || $val eq "\'1\'" || $val eq "\"1\"" ||
- $val eq "true" || $val eq "\'true\'" || $val eq "\"true\"" and
- return 1;
- 0;
-}
-
-sub check_dir {
- -d $ENV{wiz_dir} and return 10;
- 1;
-}
-
-sub get_dir {
- my $file = "/etc/proftpd.conf";
- die "no ftp configuration file found ! warning." if (!-f $file);
- open(NEW, "< $file") or die "error while opening $file: $!";
-
- while (<NEW>) { # we need 3 elements to consider section as known
- if (m/^\s*<drakwizard>/s...m/^\s*<\/drakwizard>/s ) {
- if (m/^\s*<Anonymous\s*(.*)>/s ) {
- return $1;
- }
- }
- }
- return "";
-}
-
-my $o = IFCFG->new();
-
-sub check {
- $> and return 1;
- $o->is_dhcp() and return 2;
- 0;
-}
-
-sub print_anonymous() {
- print '
-#<drakwizard>
-<Anonymous '.$_[0].'>
- User ftp
- Group ftp
- UserAlias anonymous ftp
- MaxClients 10
- <Limit WRITE>
- DenyAll
- </Limit>
-</Anonymous>
-#</drakwizard>
-';
-}
-
-sub do_it {
- my $wiz_ftp_internal = $ENV{wiz_ftp_external} ? 1 : true $ENV{wiz_ftp_internal};
- my $wiz_ftp_external = true $ENV{wiz_ftp_external};
- my $file = "/etc/proftpd.conf";
- die "no ftp configuration file found ! warning." if (!-f $file);
- MDK::Common::cp_af($file, $file . ".orig");
- open(NEW, "< $file") or die "error while opening $file: $!";
- my $allow = "all";
- if ($wiz_ftp_internal && !$wiz_ftp_external) {
- ($allow) = $o->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/;
- $allow .= " 127.0.0.1";
- }
- elsif (!$wiz_ftp_external) {
- $allow = "none";
- }
- my $file = "/etc/proftpd.conf";
- open (NEW, "< $file");
- my $exist = 0;
- while (<NEW>) { # we need 3 elements to consider section as known
- if (m/^\s*<Global>/s...m/^\s*<\/Global>/s ) {
- if (m/^\s*<Limit LOGIN>/s...m/^\s*<\/Limit>/s ) {
- if (/^\s*(?!\#)\s*Order .*$/) {
- $exist++;
- }
- if (/^\s*(?!\#)\s*Allow .*$/) {
- $exist++;
- }
- if (/^\s*(?!\#)\s*Deny .*$/) {
- $exist++;
- }
- }
- }
- }
- close (NEW);
- if ($exist < 3) { # Odd parameters are commented if exists to then add a known section
- substInFile {
- if (m/^\s*<Global>/s...m/^\s*<\/Global>/s ) {
- if (m/^\s*<Limit LOGIN>/s...m/^\s*<\/Limit>/s ) {
- s/^\s*(?!\#)\s*Order .*$/\#$&\n/s;
- s/^\s*(?!\#)\s*Allow .*$/\#$&\n/s;
- s/^\s*(?!\#)\s*Deny .*$/\#$&\n/s;
- }
- }
- } $file;
- open (NEW, ">> $file");
- print NEW '
-#<drakwizard>
-<Global>
- <Limit LOGIN>
- Order allow,deny
- Allow from '.$allow.'
- Deny from all
- </Limit>
-</Global>
-#</drakwizard>';
- close NEW;
- }
- else { # the known section (3 parameters ) is replaced with our needs
- substInFile {
- if (m/^\s*<Global>/s...m/^\s*<\/Global>/s ) {
- if (m/^\s*<Limit LOGIN>/s...m/^\s*<\/Limit>/s ) {
- if (/^\s*(?!\#)\s*Order .*$/i) {
- if (!/\s*Order\s*allow,\s*deny\s*$/) {
- s//\#$&\n Order allow,deny\n/;
- }
- }
- if (/^\s*(?!\#)\s*Allow .*$/i) {
- if (!/\s*Allow\s*from\s*$allow\s*$/) {
- s//\#$&\n Allow from $allow/;
- }
- }
- if (/^\s*(?!\#)\s*Deny .*$/i) {
- if (!/\s*Deny\s*from\s*all\s*$/) {
- s//\#$&\n Deny from all\n/;
- }
- }
- }
- }
- } $file;
- }
- system("/etc/rc.d/init.d/proftpd restart");
- 10;
-}
-1;