2 Summary: Cynara service with client libraries
5 Group: Security/Application Privilege
7 Source0: %{name}-%{version}.tar.gz
8 Source1000: %{name}-rpmlintrc
9 Source1001: cynara.manifest
10 Source1002: libcynara-client.manifest
11 Source1003: libcynara-admin.manifest
12 Source1004: cynara-tests.manifest
13 Source1005: libcynara-agent.manifest
14 Source1006: libcynara-commons.manifest
15 Source1007: libcynara-creds-commons.manifest
16 Source1008: libcynara-creds-dbus.manifest
17 Source1009: libcynara-creds-socket.manifest
18 Source1010: libcynara-session.manifest
19 Source1011: cynara-db-migration.manifest
20 Source1012: cyad.manifest
21 Requires: default-ac-domains
22 Requires(pre): pwdutils
23 Requires(pre): cynara-db-migration >= %{version}-%{release}
25 Requires(postun): pwdutils
26 Requires(postun): cynara-db-migration >= %{version}-%{release}
29 BuildRequires: pkgconfig(libsystemd-daemon)
30 BuildRequires: pkgconfig(libsystemd-journal)
33 %global user_name %{name}
34 %global group_name %{name}
36 %global state_path %{_localstatedir}/%{name}/
37 %global lib_path %{_libdir}/%{name}/
38 %global tests_dir %{_datarootdir}/%{name}/tests/
39 %global conf_path %{_sysconfdir}/%{name}/
41 %if !%{defined build_type}
42 %define build_type RELEASE
45 %if %{?build_type} == "DEBUG"
47 BuildRequires: libdw-devel
48 BuildRequires: pkgconfig(libunwind)
53 service, client libraries (libcynara-client, libcynara-admin),
54 agent library, helper libraries (libcynara-session, libcynara-creds-common, libcynara-creds-dbus,
55 libcynara-creds-socket) and tests (cynara-tests)
58 Summary: Cynara development files
59 Requires: libcynara-admin = %{version}-%{release}
60 Requires: libcynara-agent = %{version}-%{release}
61 Requires: libcynara-client = %{version}-%{release}
62 Requires: libcynara-commons = %{version}-%{release}
63 Requires: libcynara-creds-commons = %{version}-%{release}
64 Requires: libcynara-creds-dbus = %{version}-%{release}
65 Requires: libcynara-creds-socket = %{version}-%{release}
66 Requires: libcynara-session = %{version}-%{release}
67 Requires: pkgconfig(dbus-1)
68 Requires: pkgconfig(libsystemd-journal)
69 Obsoletes: libcynara-admin-devel
70 Obsoletes: libcynara-agent-devel
71 Obsoletes: libcynara-client-async-devel
72 Obsoletes: libcynara-client-commons-devel
73 Obsoletes: libcynara-client-devel
74 Obsoletes: libcynara-commons-devel
75 Obsoletes: libcynara-creds-commons-devel
76 Obsoletes: libcynara-creds-dbus-devel
77 Obsoletes: libcynara-creds-socket-devel
78 Obsoletes: libcynara-plugin-devel
79 Obsoletes: libcynara-session-devel
80 Obsoletes: libcynara-storage-devel
83 Cynara development files
86 Summary: Cynara - cynara test binaries
87 BuildRequires: pkgconfig(gmock)
92 %package -n libcynara-client
93 Summary: Cynara - client libraries
94 Requires: cynara = %{version}-%{release}
95 Obsoletes: libcynara-client-commons
96 Obsoletes: libcynara-client-async
98 %description -n libcynara-client
99 Client libraries for checking policies: synchronous and asynchronous
101 %package -n libcynara-admin
102 Summary: Cynara - admin client library
103 Requires: cynara = %{version}-%{release}
105 %description -n libcynara-admin
106 admin client library for setting, listing and removing policies
108 %package -n libcynara-agent
109 Summary: Cynara - agent client library
110 Requires: cynara = %{version}-%{release}
112 %description -n libcynara-agent
113 agent client library for communication with cynara service and plugins
115 %package -n libcynara-commons
116 Summary: Cynara - cynara commons library
117 Obsoletes: libcynara-storage
119 %description -n libcynara-commons
120 cynara common library with common functionalities
122 %package -n libcynara-creds-commons
123 Summary: Base library for cynara credentials helpers
125 %description -n libcynara-creds-commons
126 Base library for cynara credentials helpers
128 %package -n libcynara-creds-dbus
129 Summary: Cynara credentials helpers library for dbus clients
130 BuildRequires: pkgconfig(dbus-1)
133 %description -n libcynara-creds-dbus
134 Cynara credentials helpers library for dbus clients
136 %package -n libcynara-creds-socket
137 Summary: Cynara credentials helpers library for socket clients
139 %description -n libcynara-creds-socket
140 Cynara credentials helpers library for socket clients
142 %package -n libcynara-session
143 Summary: Cynara helper client session string creation library
145 %description -n libcynara-session
146 Cynara helper client session string creation library
148 %package -n cynara-db-migration
149 Summary: Migration tools for Cynara's database
151 %description -n cynara-db-migration
152 Migration tools for Cynara's database
155 Summary: Cynara's command-line tool
158 Command-line tool to manage Cynara's database
162 cp -a %{SOURCE1001} .
163 cp -a %{SOURCE1002} .
164 cp -a %{SOURCE1003} .
165 cp -a %{SOURCE1004} .
166 cp -a %{SOURCE1005} .
167 cp -a %{SOURCE1006} .
168 cp -a %{SOURCE1007} .
169 cp -a %{SOURCE1008} .
170 cp -a %{SOURCE1009} .
171 cp -a %{SOURCE1010} .
172 cp -a %{SOURCE1011} .
173 cp -a %{SOURCE1012} .
177 %if 0%{?sec_build_binary_debug_enable}
178 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
181 %if %{?build_type} == "DEBUG"
182 export CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE"
185 export CXXFLAGS="$CXXFLAGS -DCYNARA_STATE_PATH=\\\"%{state_path}\\\" \
186 -DCYNARA_LIB_PATH=\\\"%{lib_path}\\\" \
187 -DCYNARA_TESTS_DIR=\\\"%{tests_dir}\\\" \
188 -DCYNARA_CONFIGURATION_DIR=\\\"%{conf_path}\\\""
189 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
193 -DCMAKE_BUILD_TYPE=%{?build_type} \
194 -DCMAKE_VERBOSE_MAKEFILE=ON
195 make %{?jobs:-j%jobs}
201 mkdir -p %{buildroot}/%{conf_path}
202 cp ./conf/creds.conf %{buildroot}/%{conf_path}/creds.conf
204 mkdir -p %{buildroot}/usr/lib/systemd/system/sockets.target.wants
205 mkdir -p %{buildroot}/%{state_path}
206 mkdir -p %{buildroot}/%{tests_dir}/empty_db
207 mkdir -p %{buildroot}/%{lib_path}/plugin/client
208 mkdir -p %{buildroot}/%{lib_path}/plugin/service
210 cp -a db* %{buildroot}/%{tests_dir}
211 ln -s ../cynara.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara.socket
212 ln -s ../cynara-admin.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara-admin.socket
213 ln -s ../cynara-agent.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara-agent.socket
216 id -g %{group_name} > /dev/null 2>&1
217 if [ $? -eq 1 ]; then
218 groupadd %{group_name} -r > /dev/null 2>&1
221 id -u %{user_name} > /dev/null 2>&1
222 if [ $? -eq 1 ]; then
223 useradd -d /var/lib/empty -s /sbin/nologin -r -g %{group_name} %{user_name} > /dev/null 2>&1
226 if [ $1 -gt 1 ] ; then
227 OLDVERSION="$(rpm -q --qf '%%{version}' %{name})"
228 %{_sbindir}/cynara/cynara-db-migration.sh upgrade -f ${OLDVERSION} -t %{version}
230 %{_sbindir}/cynara/cynara-db-migration.sh install -t %{version}
234 ### Add file capabilities if needed
235 ### setcap/getcap binary are useful. To use them you must install libcap and libcap-tools packages
236 ### In such case uncomment Requires with those packages
238 systemctl daemon-reload
241 systemctl enable %{name}.service
244 chsmack -a System %{state_path}
246 systemctl restart %{name}.service
251 systemctl stop cynara.service
256 %{_sbindir}/cynara/cynara-db-migration.sh uninstall -f %{version}
257 userdel -r %{user_name} > /dev/null 2>&1
258 groupdel %{user_name} > /dev/null 2>&1
259 systemctl daemon-reload
262 %post -n libcynara-client -p /sbin/ldconfig
264 %postun -n libcynara-client -p /sbin/ldconfig
266 %post -n libcynara-admin -p /sbin/ldconfig
268 %postun -n libcynara-admin -p /sbin/ldconfig
270 %post -n libcynara-agent -p /sbin/ldconfig
272 %postun -n libcynara-agent -p /sbin/ldconfig
274 %post -n libcynara-commons -p /sbin/ldconfig
276 %postun -n libcynara-commons -p /sbin/ldconfig
278 %post -n libcynara-creds-commons -p /sbin/ldconfig
280 %postun -n libcynara-creds-commons -p /sbin/ldconfig
282 %post -n libcynara-creds-dbus -p /sbin/ldconfig
284 %postun -n libcynara-creds-dbus -p /sbin/ldconfig
286 %post -n libcynara-creds-socket -p /sbin/ldconfig
288 %postun -n libcynara-creds-socket -p /sbin/ldconfig
290 %post -n libcynara-session -p /sbin/ldconfig
292 %postun -n libcynara-session -p /sbin/ldconfig
295 %manifest cynara.manifest
297 %attr(755,root,root) /usr/bin/cynara
298 %attr(-,root,root) /usr/lib/systemd/system/cynara.service
299 %attr(-,root,root) /usr/lib/systemd/system/cynara.target
300 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/cynara.socket
301 %attr(-,root,root) /usr/lib/systemd/system/cynara.socket
302 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/cynara-admin.socket
303 %attr(-,root,root) /usr/lib/systemd/system/cynara-admin.socket
304 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/cynara-agent.socket
305 %attr(-,root,root) /usr/lib/systemd/system/cynara-agent.socket
306 %dir %attr(700,cynara,cynara) %{state_path}
307 %dir %attr(755,cynara,cynara) %{lib_path}/plugin/service
309 %files -n cynara-devel
310 %{_includedir}/cynara/*.h
311 %{_includedir}/cynara/log/*.h
312 %{_includedir}/cynara/plugin/*.h
313 %{_includedir}/cynara/types/*.h
314 %{_libdir}/pkgconfig/*.pc
317 %files -n cynara-tests
318 %manifest cynara-tests.manifest
319 %attr(755,root,root) /usr/bin/cynara-tests
320 %attr(755,root,root) %{tests_dir}/db*/*
321 %dir %attr(755,root,root) %{tests_dir}/empty_db
323 %files -n libcynara-client
324 %manifest libcynara-client.manifest
326 %{_libdir}/libcynara-client.so.*
327 %{_libdir}/libcynara-client-async.so.*
328 %{_libdir}/libcynara-client-commons.so.*
329 %dir %attr(755,cynara,cynara) %{lib_path}/plugin/client
331 %files -n libcynara-admin
332 %manifest libcynara-admin.manifest
334 %{_libdir}/libcynara-admin.so.*
336 %files -n libcynara-agent
337 %manifest libcynara-agent.manifest
339 %{_libdir}/libcynara-agent.so.*
341 %files -n libcynara-commons
342 %manifest libcynara-commons.manifest
344 %{_libdir}/libcynara-commons.so.*
345 %{_libdir}/libcynara-storage.so.*
347 %files -n libcynara-creds-commons
348 %manifest libcynara-creds-commons.manifest
350 %{_libdir}/libcynara-creds-commons.so.*
351 %{conf_path}creds.conf
353 %files -n libcynara-creds-dbus
354 %manifest libcynara-creds-dbus.manifest
356 %{_libdir}/libcynara-creds-dbus.so.*
358 %files -n libcynara-creds-socket
359 %manifest libcynara-creds-socket.manifest
361 %{_libdir}/libcynara-creds-socket.so.*
363 %files -n libcynara-session
364 %manifest libcynara-session.manifest
366 %{_libdir}/libcynara-session.so.*
368 %files -n cynara-db-migration
369 %manifest cynara-db-migration.manifest
370 %attr(700,root,root) %{_sbindir}/cynara/cynara-db-migration.sh
373 %manifest cyad.manifest
374 %attr(700,root,root) %{_sbindir}/cyad