initial commit of file from CVS for smeserver-tftp-server on Sat Sep 7 21:08:06 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 21:08:06 +10:00
parent 2e9f176f5e
commit dd2326f8b1
27 changed files with 522 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
{
$DB->hosts_allow_spec('tftp', 'in.tftpd');
}

View File

@@ -0,0 +1,7 @@
[Unit]
Description=Tftp Server
Requires=tftp.socket
Documentation=man:in.tftpd
After=network-online.target
Wants=network-online.target

View File

@@ -0,0 +1,50 @@
{
my $blocksize = $tftp{blocksize} || "1468";
my $verbosity = "-v";
my $log = $tftp{log};
my $refuse = $tftp{refuse};
my $privilege = $tftp{privilege} || "";
my $user = $tftp{user} || "";
# Now only relevant if you run under xinetd
my $timeout = $tftp{timeout} || "";
if ( $log eq "verbose" ) {
$verbosity = "-vv";
}
elsif ( $log eq "disabled" ) {
$verbosity = "";
}
if ( $refuse ne "" ) {
$refuse = "-r $refuse";
}
if ( $blocksize <= "512" ) {
$blocksize = "512";
}
elsif ( $blocksize >= "65464" ) {
$blocksize = "65464";
}
if ( $privilege eq "rw" ) {
$privilege = "-c";
} elsif ($privilege = "ro" ) {
$privilege = "";
}
if ( $user ne "" ) {
$user = "-u $user";
}
$OUT .= "\n";
$OUT .= "[Service]\n";
$OUT .= "# Options: man in.tftpd\n";
$OUT .= "# ExecStartPre=/bin/sleep 10\n";
$OUT .= " \n";
$OUT .= "ExecStart=\n";
$OUT .= "ExecStart=/usr/sbin/in.tftpd -s /tftpboot $verbosity -B $blocksize $user $refuse $privilege\n";
$OUT .= " \n";
$OUT .= "StandardInput=socket\n";
}

View File

@@ -0,0 +1,4 @@
[Install]
WantedBy=sme-server.target
Also=tftp.socket

View File

@@ -0,0 +1,21 @@
{
my $interfaceIP = "127.0.0.1";
my $localIP = ${LocalIP};
my $port = $tftp{UDPPort};
my $access = $tftp{access};
if ( $access eq "public" ) {
$interfaceIP = "0.0.0.0";
}
elsif ( $access eq "private" ) {
$interfaceIP = $localIP;
}
$OUT .= "[Socket]\n";
$OUT .= "ListenDatagram=\n";
$OUT .= "ListenDatagram=$interfaceIP:$port\n";
$OUT .= "FreeBind=True\n";
}