f079787c7149a8c13bbc356b6379a4b230cb2810
[external/openssh.git] / packaging / openssh.spec
1 Name:           openssh
2 Version:        5.6p1
3 Release:        1
4 %define sshd_uid    74
5 %define sshd_gid    74
6 Summary:        The OpenSSH implementation of SSH protocol versions 1 and 2
7 Url:            http://www.openssh.com/portable.html
8 Source0:        openssh-%{version}.tar.bz2
9 Source1:        openssh-nukeacss.sh
10 Source4:        sshd.service
11 Source5:        sshd@.service
12 Source6:        sshd.socket
13 Source7:        sshd-keygen.service
14 Source8:        sshd-keygen
15 Source1001:     openssh.manifest
16
17 Patch0:         0001-customize-configuration.patch
18 Patch1:         0002-log-in-chroot.patch
19 Patch2:         0003-rand-clean.patch
20 Patch3:         0004-big-uid.patch
21 Patch4:         0005-client-loop.patch
22 Patch5:         0006-CVE-2010-4478.patch
23 Patch6:         0007-Do-not-put-ssh-keys-in-etc.patch
24
25 License:        BSD
26 Group:          Applications/Internet
27
28 BuildRequires:  autoconf
29 BuildRequires:  automake
30 BuildRequires:  nss-devel
31 BuildRequires:  perl
32 BuildRequires:  util-linux
33 BuildRequires:  xauth
34 BuildRequires:  zlib-devel
35 BuildRequires:  pkgconfig(ncurses)
36 BuildRequires:  pkgconfig(openssl)
37
38 %package clients
39 Summary:        The OpenSSH client applications
40 Group:          Applications/Internet
41 Requires:       openssh = %{version}
42
43 %package server
44 Summary:        The OpenSSH server daemon
45 Group:          System/Daemons
46 Requires:       openssh = %{version}
47
48
49 %description
50 SSH (Secure SHell) is a program for logging into and executing
51 commands on a remote machine. SSH is intended to replace rlogin and
52 rsh, and to provide secure encrypted communications between two
53 untrusted hosts over an insecure network. X11 connections and
54 arbitrary TCP/IP ports can also be forwarded over the secure channel.
55
56 OpenSSH is OpenBSD's version of the last free version of SSH, bringing
57 it up to date in terms of security and features, as well as removing
58 all patented algorithms to separate libraries.
59
60 This package includes the core files necessary for both the OpenSSH
61 client and server. To make this package useful, you should also
62 install openssh-clients, openssh-server, or both.
63
64 %description clients
65 OpenSSH is a free version of SSH (Secure SHell), a program for logging
66 into and executing commands on a remote machine. This package includes
67 the clients necessary to make encrypted connections to SSH servers.
68 You'll also need to install the openssh package on OpenSSH clients.
69
70 %description server
71 OpenSSH is a free version of SSH (Secure SHell), a program for logging
72 into and executing commands on a remote machine. This package contains
73 the secure shell daemon (sshd). The sshd daemon allows SSH clients to
74 securely connect to your SSH server. You also need to have the openssh
75 package installed.
76
77 %prep
78 %setup -q
79 %patch0 -p1
80 %patch1 -p1
81 %patch2 -p1
82 %patch3 -p1
83 %patch4 -p1
84 %patch5 -p1
85
86 %build
87 cp %{S:1001} .
88
89 CFLAGS="%{optflags}"; export CFLAGS
90 CFLAGS="$CFLAGS -fpie"
91 export CFLAGS
92 LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
93
94 %reconfigure \
95         --sysconfdir=%{_sysconfdir}/ssh \
96         --libexecdir=%{_libexecdir}/openssh \
97         --datadir=%{_datadir}/openssh \
98         --with-rsh=%{_bindir}/rsh \
99         --with-default-path=/usr/local/bin:/bin:/usr/bin \
100         --with-superuser-path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin \
101         --with-privsep-path=%{_localstatedir}/empty/sshd \
102         --enable-vendor-patchlevel="FC-%{version}-%{release}" \
103         --disable-strip \
104         --without-zlib-version-check \
105         --with-nss \
106         --without-kerberos5
107
108 make
109
110 %install
111 mkdir -p -m755 %{buildroot}%{_sysconfdir}/ssh
112 mkdir -p -m755 %{buildroot}%{_libexecdir}/openssh
113 mkdir -p -m755 %{buildroot}%{_localstatedir}/empty/sshd
114
115 %make_install
116 rm -f %{buildroot}%{_sysconfdir}/ssh/ldap.conf
117
118 install -d %{buildroot}%{_libexecdir}/openssh
119 install -m755 contrib/ssh-copy-id %{buildroot}%{_bindir}/
120
121 # systemd integration
122 install -D -m 0644 %{SOURCE4} %{buildroot}/%{_libdir}/systemd/system/sshd.service
123 install -D -m 0644 %{SOURCE5} %{buildroot}/%{_libdir}/systemd/system/sshd@.service
124 install -D -m 0644 %{SOURCE6} %{buildroot}/%{_libdir}/systemd/system/sshd.socket
125 install -D -m 0644 %{SOURCE7} %{buildroot}/%{_libdir}/systemd/system/sshd-keygen.service
126 mkdir -p %{buildroot}/%{_libdir}/systemd/system/multi-user.target.wants
127 ln -s ../sshd.socket %{buildroot}/%{_libdir}/systemd/system/multi-user.target.wants/sshd.socket
128 install -D -m 0755 %{SOURCE8} %{buildroot}%{_sbindir}/sshd-keygen
129 mkdir -p %{buildroot}/%{_libdir}/systemd/system/multi-user.target.wants
130 ln -s ../sshd-keygen.service %{buildroot}/%{_libdir}/systemd/system/multi-user.target.wants/sshd-keygen.service
131
132 rm -f %{buildroot}%{_sysconfdir}/profile.d/gnome-ssh-askpass.*
133
134 mkdir -p %{buildroot}/var/empty/sshd
135
136 %remove_docs
137
138 rm -rf %{buildroot}%{_datadir}/man
139
140
141 %post server
142 if [ $1 -eq 1 ] ; then
143     /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
144     /usr//bin/systemctl enable sshd.service >/dev/null 2>&1 || :
145     /usr//bin/systemctl enable sshd-keygen.service >/dev/null 2>&1 || :
146 fi
147
148 %postun server
149 /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
150 if [ $1 -ge 1 ] ; then
151     # Package upgrade, not uninstall
152     /usr//bin/systemctl try-restart sshd.service >/dev/null 2>&1 || :
153 fi
154
155 %preun server
156 if [ $1 -eq 0 ] ; then
157     # Package removal, not upgrade
158     /usr/bin/systemctl --no-reload disable sshd.service > /dev/null 2>&1 || :
159     /usr//bin/systemctl stop sshd.service > /dev/null 2>&1 || :
160 fi
161
162
163 %files
164 %manifest openssh.manifest
165 %attr(0755,root,root) %dir %{_sysconfdir}/ssh
166 %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/moduli
167
168 %attr(0755,root,root) %{_bindir}/ssh-keygen
169 %attr(0755,root,root) %dir %{_libexecdir}/openssh
170 %attr(4755,root,root) %{_libexecdir}/openssh/ssh-keysign
171
172 %files clients
173 %manifest openssh.manifest
174 %attr(0755,root,root) %{_bindir}/ssh
175 %attr(0755,root,root) %{_bindir}/scp
176 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ssh/ssh_config
177 %attr(0755,root,root) %{_bindir}/slogin
178 %attr(2755,root,nobody) %{_bindir}/ssh-agent
179 %attr(0755,root,root) %{_bindir}/ssh-add
180 %attr(0755,root,root) %{_bindir}/ssh-keyscan
181 %attr(0755,root,root) %{_bindir}/sftp
182 %attr(0755,root,root) %{_bindir}/ssh-copy-id
183 %attr(0755,root,root) %{_libexecdir}/openssh/ssh-pkcs11-helper
184
185 %files server
186 %manifest openssh.manifest
187 %dir %attr(0711,root,root)
188 %attr(0750,root,root) /var/empty/sshd
189 %attr(0755,root,root) %{_sbindir}/sshd
190 %attr(0755,root,root) %{_libexecdir}/openssh/sftp-server
191 %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config
192 %{_libdir}/systemd/system/sshd.service
193 %{_libdir}/systemd/system/sshd.socket
194 %{_libdir}/systemd/system/sshd@.service
195 %{_libdir}/systemd/system/sshd-keygen.service
196 %{_libdir}/systemd/system/multi-user.target.wants/sshd.socket
197 %{_libdir}/systemd/system/multi-user.target.wants/sshd-keygen.service
198 %{_sbindir}/sshd-keygen
199