Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
369d5f5c5e |
2 changed files with 7 additions and 26 deletions
|
|
@ -1,25 +1,9 @@
|
|||
#!/bin/sh
|
||||
#default key type:rsa
|
||||
KEY_TYPE="rsa"
|
||||
|
||||
#check key type 'rsa', 'rsa-pss', 'dsa', 'ecdsa', 'ed25519, 'ed448', 'x25519', and 'x448'
|
||||
if [ $# -gt 0 ]; then
|
||||
case "$1" in
|
||||
rsa|rsa-pss|dsa|ecdsa|ed25519|ed448|x25519|x448)
|
||||
KEY_TYPE="$1"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [rsa|rsa-pss|dsa|ecdsa|ed25519|ed448|x25519|x448]"
|
||||
echo "Default key type: rsa"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#generate CA certificate/key
|
||||
if test ! -f /etc/pki/ocserv/private/ca.key;then
|
||||
mkdir -p /etc/pki/ocserv/private
|
||||
certtool --generate-privkey --key-type=$KEY_TYPE --outfile /etc/pki/ocserv/private/ca.key >/dev/null 2>&1
|
||||
certtool --generate-privkey --outfile /etc/pki/ocserv/private/ca.key >/dev/null 2>&1
|
||||
echo "cn=`hostname -f` CA" >/etc/pki/ocserv/ca.tmpl
|
||||
echo "expiration_days=-1" >>/etc/pki/ocserv/ca.tmpl
|
||||
echo "serial=1" >>/etc/pki/ocserv/ca.tmpl
|
||||
|
|
@ -33,7 +17,7 @@ fi
|
|||
|
||||
#generate server certificate/key
|
||||
if test ! -f /etc/pki/ocserv/private/server.key;then
|
||||
certtool --generate-privkey --key-type=$KEY_TYPE --outfile /etc/pki/ocserv/private/server.key >/dev/null 2>&1
|
||||
certtool --generate-privkey --outfile /etc/pki/ocserv/private/server.key >/dev/null 2>&1
|
||||
echo "cn=`hostname -f`" >/etc/pki/ocserv/server.tmpl
|
||||
echo "serial=2" >>/etc/pki/ocserv/server.tmpl
|
||||
echo "expiration_days=-1" >>/etc/pki/ocserv/server.tmpl
|
||||
|
|
|
|||
13
ocserv.spec
13
ocserv.spec
|
|
@ -101,6 +101,7 @@ BuildRequires: rubygem-ronn-ng
|
|||
Recommends: gnutls-utils
|
||||
Recommends: iproute
|
||||
Recommends: pam
|
||||
Requires(pre): shadow-utils
|
||||
%if %{use_systemd}
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
|
|
@ -141,11 +142,6 @@ sed -i 's/run-as-group = nogroup/run-as-group = nobody/g' tests/data/*.config
|
|||
echo "int main() { return 77; }" > tests/valid-hostname.c
|
||||
%endif
|
||||
|
||||
# Create a sysusers.d config file
|
||||
cat >ocserv.sysusers.conf <<EOF
|
||||
u ocserv - 'ocserv' %{_localstatedir}/lib/ocserv -
|
||||
EOF
|
||||
|
||||
%build
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} <= 6
|
||||
|
|
@ -176,6 +172,10 @@ autoreconf -fvi
|
|||
make %{?_smp_mflags}
|
||||
|
||||
%pre
|
||||
getent group ocserv &>/dev/null || groupadd -r ocserv
|
||||
getent passwd ocserv &>/dev/null || \
|
||||
/usr/sbin/useradd -r -g ocserv -s /sbin/nologin -c ocserv \
|
||||
-d %{_localstatedir}/lib/ocserv ocserv
|
||||
mkdir -p %{_sysconfdir}/pki/ocserv/public
|
||||
mkdir -p -m 700 %{_sysconfdir}/pki/ocserv/private
|
||||
mkdir -p %{_sysconfdir}/pki/ocserv/cacerts
|
||||
|
|
@ -226,8 +226,6 @@ install -D -m 0755 %{SOURCE11} %{buildroot}/%{_initrddir}/%{name}
|
|||
|
||||
%make_install
|
||||
|
||||
install -m0644 -D ocserv.sysusers.conf %{buildroot}%{_sysusersdir}/ocserv.conf
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
|
||||
|
|
@ -258,7 +256,6 @@ install -m0644 -D ocserv.sysusers.conf %{buildroot}%{_sysusersdir}/ocserv.conf
|
|||
%else
|
||||
%{_initrddir}/%{name}
|
||||
%endif
|
||||
%{_sysusersdir}/ocserv.conf
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue