packaging: Improving support of lastlog
[platform/upstream/openssh.git] / packaging / openssh.spec
1 %define _appdefdir      %{_prefix}/share/X11/app-defaults
2 %define xversion 1.2.4.1
3
4 Name:           openssh
5 Version:        6.6p1
6 Release:        0
7 Summary:        Secure Shell Client and Server (Remote Login Program)
8 License:        BSD-3-Clause and MIT
9 Group:          System/Network
10 Url:            http://www.openssh.com/
11 Source:         ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz
12 Source2:        sshd.pamd
13 Source8:        ssh-askpass
14 Source11:       sshd-gen-keys-start
15 Source12:       sshd.service
16 Source13:       sshd.socket
17 Source14:       sshd@.service
18 Source1001:     openssh.manifest
19
20 BuildRequires:  systemd
21 BuildRequires:  autoconf
22 BuildRequires:  openssl-devel
23 BuildRequires:  pam-devel
24 Requires:       /usr/bin/netstat
25 Requires:       pam-modules-extra
26 Requires(pre):  pwdutils coreutils
27
28 %{!?_initddir:%global _initddir %{_initrddir}}
29
30 %description
31 SSH (Secure Shell) is a program for logging into and executing commands
32 on a remote machine. It is intended to replace rsh (rlogin and rsh) and
33 provides openssl (secure encrypted communication) between two untrusted
34 hosts over an insecure network.
35
36 xorg-x11 (X Window System) connections and arbitrary TCP/IP ports can
37 also be forwarded over the secure channel.
38
39 %prep
40 %setup -q 
41 cp %{SOURCE1001} .
42
43 %build
44 autoreconf -fiv
45 PIEFLAGS="-fpie"
46 export CFLAGS="%{optflags} $PIEFLAGS -fstack-protector"
47 export CXXFLAGS="%{optflags} $PIEFLAGS -fstack-protector"
48 export LDFLAGS="-pie"
49 %configure \
50     --with-ssl-engine \
51     --sysconfdir=%{_sysconfdir}/ssh \
52     --libexecdir=%{_libexecdir}/ssh \
53     --with-pam \
54     --without-lastlog \
55     --with-privsep-path=%{_localstatedir}/lib/empty \
56     --with-sandbox=rlimit \
57     --disable-strip \
58     --with-xauth=%{_prefix}/bin/xauth \
59     --target=%{_target_cpu}-tizen-linux
60 %__make %{?_smp_mflags}
61
62 %install
63 make DESTDIR=%{buildroot}/ install
64 install -d -m 755 %{buildroot}%{_sysconfdir}/pam.d
65 install -d -m 755 %{buildroot}%{_localstatedir}/lib/sshd
66 install -m 644 %{S:2} %{buildroot}%{_sysconfdir}/pam.d/sshd
67 # install shell script to automate the process of adding your public key to a remote machine
68 install -m 755 contrib/ssh-copy-id %{buildroot}%{_bindir}
69 install -m 644 contrib/ssh-copy-id.1 %{buildroot}%{_mandir}/man1
70 sed -e "s,@LIBEXEC@,%{_libexecdir},g" < %{S:8} > %{buildroot}%{_libexecdir}/ssh/ssh-askpass
71 rm -f %{buildroot}%{_datadir}/Ssh.bin
72 sed -i -e s@/usr/libexec@%{_libexecdir}@g %{buildroot}%{_sysconfdir}/ssh/sshd_config
73
74 install -D -m 0755 %{SOURCE11} %{buildroot}%{_sbindir}/sshd-gen-keys-start
75 # systemd
76 install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/sshd.service
77 install -D -m 0644 %{SOURCE13} %{buildroot}%{_unitdir}/sshd.socket
78 install -D -m 0644 %{SOURCE14} %{buildroot}%{_unitdir}/sshd@.service
79
80 mkdir -p %{buildroot}/%{_unitdir}/sockets.target.wants
81 ln -s ../sshd.socket %{buildroot}/%{_unitdir}/sockets.target.wants/sshd.socket
82
83 rm -rf %{buildroot}/%{_mandir}/cat*
84 rm -rf %{buildroot}/%{_mandir}/man*
85
86 %pre
87 getent group sshd >/dev/null || %{_sbindir}/groupadd -o -r sshd
88 getent passwd sshd >/dev/null || %{_sbindir}/useradd -r -g sshd -d %{_localstatedir}/lib/sshd -s /bin/false -c "SSH daemon" sshd
89
90 %files
91 %manifest %{name}.manifest
92 %defattr(-,root,root)
93 %dir %attr(755,root,root) %{_localstatedir}/lib/sshd
94 %attr(0755,root,root) %dir %{_sysconfdir}/ssh
95 %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/moduli
96 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ssh/ssh_config
97 %attr(0640,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config
98 %attr(0644,root,root) %config %{_sysconfdir}/pam.d/sshd
99 %attr(0755,root,root) %{_bindir}/ssh
100 %{_bindir}/scp
101 %{_bindir}/sftp
102 %{_bindir}/slogin
103 %{_bindir}/ssh-*
104 %{_sbindir}/*
105 %attr(0755,root,root) %dir %{_libexecdir}/ssh
106 %attr(0755,root,root) %{_libexecdir}/ssh/sftp-server
107 %attr(0755,root,root) %{_libexecdir}/ssh/ssh-keysign
108 %attr(0755,root,root) %{_libexecdir}/ssh/ssh-pkcs11-helper
109 %attr(0755,root,root) %{_libexecdir}/ssh/ssh-askpass
110 %{_sbindir}/sshd-gen-keys-start
111 %{_unitdir}/sshd.service
112 %{_unitdir}/sshd@.service
113 %{_unitdir}/sockets.target.wants/*.socket
114 %{_unitdir}/sshd.socket
115
116 %changelog