initial commit of file from CVS for smeserver-tftp-server on Sat Sep 7 21:08:06 AEST 2024
This commit is contained in:
1
root/etc/e-smith/db/configuration/defaults/tftp/UDPPort
Normal file
1
root/etc/e-smith/db/configuration/defaults/tftp/UDPPort
Normal file
@@ -0,0 +1 @@
|
||||
69
|
1
root/etc/e-smith/db/configuration/defaults/tftp/access
Normal file
1
root/etc/e-smith/db/configuration/defaults/tftp/access
Normal file
@@ -0,0 +1 @@
|
||||
private
|
@@ -0,0 +1 @@
|
||||
/tftpboot
|
1
root/etc/e-smith/db/configuration/defaults/tftp/log
Normal file
1
root/etc/e-smith/db/configuration/defaults/tftp/log
Normal file
@@ -0,0 +1 @@
|
||||
normal
|
@@ -0,0 +1 @@
|
||||
ro
|
1
root/etc/e-smith/db/configuration/defaults/tftp/status
Normal file
1
root/etc/e-smith/db/configuration/defaults/tftp/status
Normal file
@@ -0,0 +1 @@
|
||||
disabled
|
1
root/etc/e-smith/db/configuration/defaults/tftp/timeout
Normal file
1
root/etc/e-smith/db/configuration/defaults/tftp/timeout
Normal file
@@ -0,0 +1 @@
|
||||
default
|
1
root/etc/e-smith/db/configuration/defaults/tftp/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/tftp/type
Normal file
@@ -0,0 +1 @@
|
||||
service
|
1
root/etc/e-smith/db/configuration/defaults/tftp/user
Normal file
1
root/etc/e-smith/db/configuration/defaults/tftp/user
Normal file
@@ -0,0 +1 @@
|
||||
nobody
|
@@ -0,0 +1,7 @@
|
||||
{
|
||||
my $tftpd = $DB->get('tftpd') or return;
|
||||
if ( $tftpd->prop('privilege') eq "r" )
|
||||
{
|
||||
$tftpd->set_prop('privilege' => "ro");
|
||||
}
|
||||
}
|
7
root/etc/e-smith/db/configuration/migrate/tftpd.timeout
Normal file
7
root/etc/e-smith/db/configuration/migrate/tftpd.timeout
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
my $tftpd = $DB->get('tftpd') or return;
|
||||
if ( $tftpd->prop('timeout') eq "normal" )
|
||||
{
|
||||
$tftpd->set_prop('timeout' => "default");
|
||||
}
|
||||
}
|
7
root/etc/e-smith/db/configuration/migrate/tftpd.user
Normal file
7
root/etc/e-smith/db/configuration/migrate/tftpd.user
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
my $tftpd = $DB->get('tftpd') or return;
|
||||
if ( $tftpd->prop('user') eq "root" )
|
||||
{
|
||||
$tftpd->set_prop('user' => "nobody");
|
||||
}
|
||||
}
|
10
root/etc/e-smith/db/configuration/migrate/tftpd.v10
Normal file
10
root/etc/e-smith/db/configuration/migrate/tftpd.v10
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
my $tftpd = $DB->get("tftpd") or return;
|
||||
|
||||
my $tftp = $DB->get("tftp") ||
|
||||
$DB->new_record("tftp", { type => "service" });
|
||||
|
||||
$tftp->merge_props($tftpd->props);
|
||||
|
||||
$tftpd->delete;
|
||||
}
|
3
root/etc/e-smith/templates/etc/hosts.allow/tftp
Normal file
3
root/etc/e-smith/templates/etc/hosts.allow/tftp
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
$DB->hosts_allow_spec('tftp', 'in.tftpd');
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
|
||||
[Unit]
|
||||
Description=Tftp Server
|
||||
Requires=tftp.socket
|
||||
Documentation=man:in.tftpd
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
@@ -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";
|
||||
}
|
||||
|
@@ -0,0 +1,4 @@
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
||||
Also=tftp.socket
|
@@ -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";
|
||||
|
||||
}
|
||||
|
0
root/tftpboot/.gitignore
vendored
Normal file
0
root/tftpboot/.gitignore
vendored
Normal file
21
root/usr/lib/systemd/system/tftp.service.d/50koozali.conf
Normal file
21
root/usr/lib/systemd/system/tftp.service.d/50koozali.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
[Unit]
|
||||
Description=Tftp Server
|
||||
Requires=tftp.socket
|
||||
Documentation=man:in.tftpd
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Options: man in.tftpd
|
||||
#ExecStartPre=/bin/sleep 10
|
||||
|
||||
ExecStart=
|
||||
ExecStart=/usr/sbin/in.tftpd -s /tftpboot -v -B 1464 -u nobody
|
||||
|
||||
StandardInput=socket
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy= sme-server.target
|
||||
Also=tftp.socket
|
4
root/usr/lib/systemd/system/tftp.socket.d/50koozali.conf
Normal file
4
root/usr/lib/systemd/system/tftp.socket.d/50koozali.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
[Socket]
|
||||
ListenDatagram=
|
||||
ListenDatagram=127.0.0.1:69
|
||||
FreeBin=true
|
Reference in New Issue
Block a user