From 2988a6db1fa42aea05c5a2da5517078ee7ec569a Mon Sep 17 00:00:00 2001
From: Marcin Krol <hawk@tld-linux.org>
Date: Tue, 17 Jul 2018 15:16:40 +0000
Subject: [PATCH] - EasyRSA

---
 easy-rsa.spec | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tld.patch     | 21 ++++++++++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 easy-rsa.spec
 create mode 100644 tld.patch

diff --git a/easy-rsa.spec b/easy-rsa.spec
new file mode 100644
index 0000000..fc53a68
--- /dev/null
+++ b/easy-rsa.spec
@@ -0,0 +1,60 @@
+Summary:	Small RSA key management package
+Summary(pl.UTF-8):	Mały pakiet do zarządzania kluczami RSA
+Name:		easy-rsa
+Version:	3.0.4
+Release:	0.1
+License:	GPL v2
+Group:		Applications/Networking
+Source0:	https://github.com/OpenVPN/easy-rsa/releases/download/v%{version}/EasyRSA-%{version}.tgz
+# Source0-md5:	d163f0681b4b2067f107badeb9151629
+Patch0:		tld.patch
+URL:		http://openvpn.net/easyrsa.html
+BuildRequires:	autoconf >= 2.59
+BuildRequires:	automake >= 1:1.9
+Requires:	grep
+Requires:	openssl-tools
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This is a small RSA key management package, based on the openssl
+command line tool, that can be found in the easy-rsa subdirectory of
+the OpenVPN distribution. While this tool is primary concerned with
+key management for the SSL VPN application space, it can also be used
+for building web certificates.
+
+%description -l pl.UTF-8
+To jest mały pakiet do zarządzania kluczami RSA, oparty na narzędziu
+linii poleceń openssl. Pakiet ten pochodzi z podkatalogu easy-rsa
+dystrybucji OpenVPN.
+
+%prep
+%setup -q -n EasyRSA-%{version}
+%patch0 -p1 
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/easy-rsa/keys}
+
+install -p easyrsa $RPM_BUILD_ROOT%{_sbindir}
+mv openssl-easyrsa.cnf $RPM_BUILD_ROOT%{_sysconfdir}/easy-rsa
+mv vars.example $RPM_BUILD_ROOT%{_sysconfdir}/easy-rsa/vars
+mv x509-types $RPM_BUILD_ROOT%{_sysconfdir}/easy-rsa
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc COPYING.md README.md README.quickstart.md doc
+%dir %{_sysconfdir}/easy-rsa
+%attr(750,root,root) %dir %{_sysconfdir}/easy-rsa/keys
+%attr(750,root,root) %dir %{_sysconfdir}/easy-rsa/x509-types
+%attr(640,root,root) %dir %{_sysconfdir}/easy-rsa/x509-types/COMMON
+%attr(640,root,root) %dir %{_sysconfdir}/easy-rsa/x509-types/ca
+%attr(640,root,root) %dir %{_sysconfdir}/easy-rsa/x509-types/client
+%attr(640,root,root) %dir %{_sysconfdir}/easy-rsa/x509-types/code-signing
+%attr(640,root,root) %dir %{_sysconfdir}/easy-rsa/x509-types/server
+%config(noreplace) %attr(640,root,root) %verify(not md5 mtime size) %{_sysconfdir}/easy-rsa/vars
+%config(noreplace) %attr(640,root,root) %verify(not md5 mtime size) %{_sysconfdir}/easy-rsa/openssl-easyrsa.cnf
+%attr(750,root,root) %{_sbindir}/easyrsa
diff --git a/tld.patch b/tld.patch
new file mode 100644
index 0000000..91ca7c6
--- /dev/null
+++ b/tld.patch
@@ -0,0 +1,21 @@
+diff -ur EasyRSA-3.0.4.orig/vars.example EasyRSA-3.0.4/vars.example
+--- EasyRSA-3.0.4.orig/vars.example	2018-01-21 15:37:26.000000000 +0000
++++ EasyRSA-3.0.4/vars.example	2018-07-17 15:07:46.127952424 +0000
+@@ -47,7 +47,7 @@
+ # itself, which is also where the configuration files are located in the
+ # easy-rsa tree.
+ 
+-#set_var EASYRSA	"${0%/*}"
++set_var EASYRSA	"/etc/easy-rsa"
+ 
+ # If your OpenSSL command is not in the system PATH, you will need to define the
+ # path to it here. Normally this means a full path to the executable, otherwise
+@@ -69,7 +69,7 @@
+ # WARNING: init-pki will do a rm -rf on this directory so make sure you define
+ # it correctly! (Interactive mode will prompt before acting.)
+ 
+-#set_var EASYRSA_PKI		"$PWD/pki"
++set_var EASYRSA_PKI		"/etc/easy-rsa/keys"
+ 
+ # Define X509 DN mode.
+ # This is used to adjust what elements are included in the Subject field as the DN
-- 
2.49.0