Files
smeserver-proftpd/root/etc/e-smith/templates/etc/proftpd.conf/60AnonymousIBay
Jean-Philippe Pialasse 4be10f2b17 * Sat Feb 15 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- disable anonymous by default [SME: 931]
- add passive port [SME: 12454]
- TLSv1.3 filtered out as not supported by 1.3.6 branch [SME: 12925]
- fix wrong group defined for ibays [SME: 7914]
- drop runit for full systemd service unit [SME: 12874]
2025-02-16 02:09:38 -05:00

85 lines
2.1 KiB
Plaintext

{
#------------------------------------------------------------
# How to handle logins from information bay accounts: chroot to the
# files part of the information bay directory.
#------------------------------------------------------------
return "# Anonymous access disabled by default" unless(( $ftp{DisableAnonymous} || "yes") eq "yes");
use esmith::AccountsDB;
use Net::IPv4Addr qw(ipv4_parse);
$OUT .= "";
my $adb = esmith::AccountsDB->open_ro();
my @local = map { join '/', ipv4_parse($_) } @local_access;
my @all = ('all');
foreach my $ibay ($adb->ibays)
{
my $key = $ibay->key;
my %properties = $ibay->props;
next if ($key eq "Primary");
my $pass;
my $access = $ibay->prop('PublicAccess') || 'none';
if ($access eq 'none')
{
@allow = ('127.0.0.1');
$pass = 1;
}
elsif ($access eq 'local')
{
@allow = @local;
$pass = 0;
}
elsif ($access eq 'local-pw')
{
@allow = @local;
$pass = 1;
}
elsif ($access eq 'global')
{
@allow = @all;
$pass = 0;
}
elsif ($access eq 'global-pw')
{
@allow = @all;
$pass = 1;
}
elsif ($access eq 'global-pw-remote')
{
@allow = @all;
$pass = 1;
}
# variables: $allow (IP), $pass (bool)
if ( ($ibay->prop('DisableAnonymous') || 'no') ne 'yes' )
{
$OUT .= "\n";
$OUT .= "<Anonymous /home/e-smith/files/ibays/$key/files>\n";
$OUT .= " User $key\n";
$OUT .= " Group $key\n";
$OUT .= " AnonRequirePassword " . ($pass ? "on" : "off") . "\n";
$OUT .= " UseFtpUsers on\n";
$OUT .= " MaxClients 10\n";
$OUT .= " DisplayLogin welcome.msg\n";
$OUT .= " DisplayChdir .message\n";
$OUT .= " <Limit LOGIN>\n";
$OUT .= " Order Allow,Deny\n";
$OUT .= " Allow from $_\n" foreach @allow;
$OUT .= " Deny from all\n";
$OUT .= " </Limit>\n";
$OUT .= " <Directory *>\n";
$OUT .= " <Limit WRITE>\n";
$OUT .= " DenyAll\n";
$OUT .= " </Limit>\n";
$OUT .= " </Directory>\n";
$OUT .= "</Anonymous>\n";
}
}
}