Browse code

Add tftp server.

Add tftp server and xinet.

Xiaolin Li authored on 2015/08/08 03:37:42
Showing 6 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,109 @@
0
+Summary:	The client for the Trivial File Transfer Protocol (TFTP)
1
+Name:		tftp
2
+Version:	5.2
3
+Release:	1%{?dist}
4
+License:	BSD
5
+URL:		http://www.kernel.org
6
+Group:		Applications/Internet
7
+Vendor:		VMware, Inc.
8
+Distribution: Photon
9
+Source0:	http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.gz
10
+%define sha1 tftp=2fe37983ffeaf4063ffaba514c4848635c622d8b
11
+Source1:        tftpd-hpa.service
12
+Source2:        tftpd-hpa.socket
13
+
14
+%description
15
+The Trivial File Transfer Protocol (TFTP) is normally used only for
16
+booting diskless workstations.  The tftp package provides the user
17
+interface for TFTP, which allows users to transfer files to and from a
18
+remote machine.  This program and TFTP provide very little security,
19
+and should not be enabled unless it is expressly needed.
20
+
21
+%package server
22
+Group: System Environment/Daemons
23
+Summary: The server for the Trivial File Transfer Protocol (TFTP).
24
+Requires: xinetd
25
+
26
+%description server
27
+The Trivial File Transfer Protocol (TFTP) is normally used only for
28
+booting diskless workstations.  The tftp-server package provides the
29
+server for TFTP, which allows users to transfer files to and from a
30
+remote machine. TFTP provides very little security, and should not be
31
+enabled unless it is expressly needed.
32
+%prep
33
+%setup -q -n tftp-hpa-%{version}
34
+
35
+%build
36
+
37
+%configure
38
+make %{?_smp_mflags}
39
+
40
+%install
41
+rm -rf %{buildroot}
42
+mkdir -p %{buildroot}}%{_bindir}
43
+mkdir -p %{buildroot}}%{_mandir}/man{1,8}
44
+mkdir -p %{buildroot}}%{_sbindir}
45
+mkdir -p %{buildroot}%{_sysconfdir}/xinetd.d
46
+
47
+%makeinstall
48
+make INSTALLROOT=%{buildroot} \
49
+    SBINDIR=%{_sbindir} MANDIR=%{_mandir} \
50
+	install
51
+install -m755 -d %{buildroot}%{_sysconfdir}/xinetd.d/ %{buildroot}/var/lib/tftpboot
52
+#pushd %{buildroot}
53
+mkdir -p %{buildroot}/lib/systemd/system
54
+cp %{SOURCE1} %{buildroot}/lib/systemd/system/tftpd-hpa.service
55
+cp %{SOURCE2} %{buildroot}/lib/systemd/system/tftpd-hpa.socket
56
+#popd
57
+cat << EOF >> %{buildroot}%{_sysconfdir}/xinetd.d/tftp
58
+# default: off
59
+# description: The tftp server serves files using the trivial file transfer \
60
+#	protocol.  The tftp protocol is often used to boot diskless \
61
+#	workstations, download configuration files to network-aware printers, \
62
+#	and to start the installation process for some operating systems.
63
+service tftp
64
+{
65
+	socket_type		= dgram
66
+	protocol		= udp
67
+	wait			= yes
68
+	user			= root
69
+	server			= /usr/sbin/in.tftpd
70
+	server_args		= -s /var/lib/tftpboot
71
+	disable			= no
72
+	per_source		= 11
73
+	cps			= 100 2
74
+	flags			= IPv4
75
+}
76
+EOF
77
+
78
+%clean
79
+rm -rf %{buildroot}
80
+
81
+%post server
82
+/sbin/ldconfig 
83
+%systemd_post tftpd-hpa.service tftpd-hpa.socket
84
+
85
+%preun server
86
+%systemd_preun tftpd-hpa.service tftpd-hpa.socket
87
+
88
+%postun server
89
+/sbin/ldconfig
90
+%systemd_postun_with_restart tftpd-hpa.service
91
+
92
+%files
93
+%defattr(-,root,root)
94
+%{_bindir}/tftp
95
+%{_mandir}/man1/
96
+
97
+%files server
98
+%defattr(-,root,root)
99
+%config(noreplace) %{_sysconfdir}/xinetd.d/tftp
100
+%dir %attr(0750,nobody,nobody) /var/lib/tftpboot
101
+%{_sbindir}/in.tftpd
102
+%{_mandir}/man8/*
103
+/lib/systemd/system/tftpd-hpa.service
104
+/lib/systemd/system/tftpd-hpa.socket
105
+
106
+%changelog
107
+*	Mon Jul 27 2015 Xiaolin Li <xiaolinl@vmware.com> 5.2-1
108
+-	Initial build.	First version
0 109
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+[Unit]
1
+Description = HPA's tftp server
2
+Requires = tftpd-hpa.socket
3
+
4
+[Service]
5
+ExecStart = /usr/sbin/in.tftpd -v --secure /var/lib/tftpboot
6
+StandardInput = socket
7
+User = tftp
8
+Group = tftp
0 9
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+[Unit]
1
+Description = Listen for tftp connections
2
+
3
+[Socket]
4
+ListenDatagram = 69
5
+BindToDevice = eth0
6
+
7
+[Install]
8
+WantedBy = sockets.target
0 9
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+[Unit]
1
+Description=Xinetd A Powerful Replacement For Inetd
2
+After=syslog.target network.target
3
+Documentation=man:xinetd
4
+Documentation=man:xinetd.conf
5
+Documentation=man:xinetd.log
6
+
7
+[Service]
8
+Type=forking
9
+PIDFile=/var/run/xinetd.pid
10
+ExecStart=/usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
11
+ExecReload=/usr/bin/kill -HUP $MAINPID
12
+
13
+[Install]
14
+WantedBy=multi-user.target
15
+
0 16
new file mode 100644
... ...
@@ -0,0 +1,77 @@
0
+Summary:  	xinetd -- A better inetd.
1
+Name:		xinetd
2
+Version:	2.3.15
3
+Release:	1%{?dist}
4
+License:	BSD
5
+URL:		http://www.xinetd.org/
6
+Group:		System Environment/Daemons
7
+Vendor:     	VMware, Inc.
8
+Distribution: 	Photon
9
+Source0:	%{name}-%{version}.tar.gz
10
+%define sha1 xinetd=168d54aeb181e271e68f4c53847c3e6b2574dba6
11
+Source1:        xinetd.service
12
+
13
+
14
+%description
15
+Xinetd is a powerful inetd replacement. Xinetd has access control 
16
+mechanisms, extensive logging capabilities, the ability to make 
17
+services available based on time, can place limits on the number 
18
+of servers that can be started, and has a configurable defence 
19
+mechanism to protect against port scanners, among other things.
20
+ 
21
+%prep
22
+%setup -q
23
+
24
+%build
25
+  ./configure \
26
+	--sbindir=%{buildroot}/%{_sbindir} 	\
27
+	--mandir=%{buildroot}/%{_datadir}/man 
28
+  make
29
+  strip xinetd/xinetd
30
+
31
+%install
32
+rm -rf %{buildroot}
33
+mkdir -p %{buildroot}/%{_sbindir}
34
+mkdir -p %{buildroot}/etc/rc.d/init.d
35
+mkdir -p %{buildroot}/etc/xinetd.d
36
+
37
+%makeinstall  
38
+#install -m 0755 xinetd6 %{buildroot}/%{_sbindir}
39
+install -m 0755 contrib/xinetd %{buildroot}/etc/rc.d/init.d/xinetd
40
+install -m 0600 contrib/xinetd.conf %{buildroot}/etc/
41
+cp contrib/xinetd.d/* %{buildroot}/etc/xinetd.d
42
+#pushd %{buildroot}
43
+mkdir -p %{buildroot}/lib/systemd/system
44
+cp %{SOURCE1} %{buildroot}/lib/systemd/system/xinetd.service
45
+#popd
46
+install -vdm755 %{buildroot}/etc/systemd/system/multi-user.target.wants
47
+ln -sfv ../../../../lib/systemd/system/xinetd.service  %{buildroot}/etc/systemd/system/multi-user.target.wants/xinetd.service
48
+%clean
49
+rm -rf %{buildroot}
50
+
51
+%post
52
+/sbin/ldconfig 
53
+%systemd_post xinetd.service
54
+
55
+%preun
56
+%systemd_preun xinetd.service
57
+
58
+%postun
59
+/sbin/ldconfig
60
+%systemd_postun_with_restart xinetd.service
61
+
62
+%files
63
+%defattr(-, root, root)
64
+%doc CHANGELOG COPYRIGHT README xinetd/sample.conf contrib/empty.conf 
65
+%{_sbindir}/*
66
+%{_datadir}/man/*/*
67
+%attr(0750, root, root) %config(noreplace) /etc/rc.d/init.d/xinetd
68
+%attr(0750, root, root) %config(noreplace) /etc/xinetd.conf
69
+%attr(0750, root, root) %config(noreplace) /etc/xinetd.d/*
70
+/lib/systemd/system/xinetd.service
71
+/etc/systemd/system/multi-user.target.wants/xinetd.service
72
+
73
+%changelog
74
+*   Fri Aug 07 2015 Xiaolin Li  <xiaolinl@vmware.com> 2.3.15-1
75
+-   Initial build. First version
76
+ 
... ...
@@ -25,7 +25,7 @@
25 25
                 "haveged", "haveged-devel", "vim-extra",
26 26
                 "postgresql", "openjdk", "apr", "apr-util", "httpd", "openvswitch", "eventlog", "syslog-ng", "syslog-ng-devel", "zookeeper", "fuse", "fleet",
27 27
                 "nss-altfiles", "apache-maven", "subversion", "mesos", "python3", "python3-libs", "python3-devel", "python3-tools", "fakeroot-ng", "ctags",
28
-                "libtirpc", "libtirpc-devel", "lsof", "nfs-utils", "cve-check-tool", "flannel", "rpm-build"]
28
+                "libtirpc", "libtirpc-devel", "lsof", "nfs-utils", "cve-check-tool", "flannel", "rpm-build", "xinetd", "tftp", "tftp-server"]
29 29
 }
30 30
 
31 31