Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26e4189551 | ||
|
|
f0efb943d8 | ||
|
|
f7c89057b3 | ||
|
|
32d376716d | ||
|
|
ae84a30d03 | ||
|
|
470ea11ba7 |
2 changed files with 26 additions and 7 deletions
|
|
@ -1,9 +1,25 @@
|
|||
#!/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 --outfile /etc/pki/ocserv/private/ca.key >/dev/null 2>&1
|
||||
certtool --generate-privkey --key-type=$KEY_TYPE --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
|
||||
|
|
@ -17,7 +33,7 @@ fi
|
|||
|
||||
#generate server certificate/key
|
||||
if test ! -f /etc/pki/ocserv/private/server.key;then
|
||||
certtool --generate-privkey --outfile /etc/pki/ocserv/private/server.key >/dev/null 2>&1
|
||||
certtool --generate-privkey --key-type=$KEY_TYPE --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,7 +101,6 @@ BuildRequires: rubygem-ronn-ng
|
|||
Recommends: gnutls-utils
|
||||
Recommends: iproute
|
||||
Recommends: pam
|
||||
Requires(pre): shadow-utils
|
||||
%if %{use_systemd}
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
|
|
@ -142,6 +141,11 @@ 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
|
||||
|
|
@ -172,10 +176,6 @@ 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,6 +226,8 @@ install -D -m 0755 %{SOURCE11} %{buildroot}/%{_initrddir}/%{name}
|
|||
|
||||
%make_install
|
||||
|
||||
install -m0644 -D ocserv.sysusers.conf %{buildroot}%{_sysusersdir}/ocserv.conf
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
|
||||
|
|
@ -256,6 +258,7 @@ install -D -m 0755 %{SOURCE11} %{buildroot}/%{_initrddir}/%{name}
|
|||
%else
|
||||
%{_initrddir}/%{name}
|
||||
%endif
|
||||
%{_sysusersdir}/ocserv.conf
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue