summaryrefslogtreecommitdiffstats
path: root/meta-security/recipes-security/cynara/cynara/0005-Allow-to-tune-sockets.patch
blob: e954c7f2167b249e23f6dc96b9ddb81174c39e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
From ebde8e9fdba7bc1c8152f7e45c551030a36ece82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
Date: Thu, 25 Jan 2018 13:47:37 +0100
Subject: [PATCH] Allow to tune sockets
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Allow to change the directory of sockets
through a true integration of SOCKET_DIR

Allow to override the socket's group of
 - /run/cynara/cynara-agent.socket
 - /run/cynara/cynara-monitor-get.socket

through the newly defined variable CYNARA_ADMIN_SOCKET_GROUP

Change-Id: I7d58854c328e948e3d6d7fa3fc00569fd08f8aef
Signed-off-by: José Bollo <jose.bollo@iot.bzh>

---
 systemd/CMakeLists.txt               | 19 +++++++++++++++----
 systemd/cynara-admin.socket          | 14 --------------
 systemd/cynara-admin.socket.in       | 14 ++++++++++++++
 systemd/cynara-agent.socket          | 15 ---------------
 systemd/cynara-agent.socket.in       | 15 +++++++++++++++
 systemd/cynara-monitor-get.socket    | 15 ---------------
 systemd/cynara-monitor-get.socket.in | 15 +++++++++++++++
 systemd/cynara.socket                | 14 --------------
 systemd/cynara.socket.in             | 14 ++++++++++++++
 9 files changed, 73 insertions(+), 62 deletions(-)
 delete mode 100644 systemd/cynara-admin.socket
 create mode 100644 systemd/cynara-admin.socket.in
 delete mode 100644 systemd/cynara-agent.socket
 create mode 100644 systemd/cynara-agent.socket.in
 delete mode 100644 systemd/cynara-monitor-get.socket
 create mode 100644 systemd/cynara-monitor-get.socket.in
 delete mode 100644 systemd/cynara.socket
 create mode 100644 systemd/cynara.socket.in

diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
index 20accf0..1b75c12 100644
--- a/systemd/CMakeLists.txt
+++ b/systemd/CMakeLists.txt
@@ -16,13 +16,24 @@
 # @author      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
 #
 
+SET(CYNARA_ADMIN_SOCKET_GROUP
+    "security_fw"
+    CACHE STRING
+    "Group to apply on administrative sockets")
+
+
+CONFIGURE_FILE(cynara.socket.in             cynara.socket @ONLY)
+CONFIGURE_FILE(cynara-admin.socket.in       cynara-admin.socket @ONLY)
+CONFIGURE_FILE(cynara-agent.socket.in       cynara-agent.socket @ONLY)
+CONFIGURE_FILE(cynara-monitor-get.socket.in cynara-monitor-get.socket @ONLY)
+
 INSTALL(FILES
     ${CMAKE_SOURCE_DIR}/systemd/cynara.service
     ${CMAKE_SOURCE_DIR}/systemd/cynara.target
-    ${CMAKE_SOURCE_DIR}/systemd/cynara.socket
-    ${CMAKE_SOURCE_DIR}/systemd/cynara-admin.socket
-    ${CMAKE_SOURCE_DIR}/systemd/cynara-agent.socket
-    ${CMAKE_SOURCE_DIR}/systemd/cynara-monitor-get.socket
+    ${CMAKE_BINARY_DIR}/systemd/cynara.socket
+    ${CMAKE_BINARY_DIR}/systemd/cynara-admin.socket
+    ${CMAKE_BINARY_DIR}/systemd/cynara-agent.socket
+    ${CMAKE_BINARY_DIR}/systemd/cynara-monitor-get.socket
     DESTINATION
     ${SYSTEMD_UNIT_DIR}
 )
diff --git a/systemd/cynara-admin.socket b/systemd/cynara-admin.socket
deleted file mode 100644
index ed38386..0000000
--- a/systemd/cynara-admin.socket
+++ /dev/null
@@ -1,14 +0,0 @@
-[Socket]
-ListenStream=/run/cynara/cynara-admin.socket
-SocketMode=0600
-SmackLabelIPIn=@
-SmackLabelIPOut=@
-
-Service=cynara.service
-
-[Unit]
-Wants=cynara.target
-Before=cynara.target
-
-[Install]
-WantedBy=sockets.target
diff --git a/systemd/cynara-admin.socket.in b/systemd/cynara-admin.socket.in
new file mode 100644
index 0000000..2364c3e
--- /dev/null
+++ b/systemd/cynara-admin.socket.in
@@ -0,0 +1,14 @@
+[Socket]
+ListenStream=@SOCKET_DIR@/cynara-admin.socket
+SocketMode=0600
+SmackLabelIPIn=@
+SmackLabelIPOut=@
+
+Service=cynara.service
+
+[Unit]
+Wants=cynara.target
+Before=cynara.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/systemd/cynara-agent.socket b/systemd/cynara-agent.socket
deleted file mode 100644
index 5a677e0..0000000
--- a/systemd/cynara-agent.socket
+++ /dev/null
@@ -1,15 +0,0 @@
-[Socket]
-ListenStream=/run/cynara/cynara-agent.socket
-SocketGroup=security_fw
-SocketMode=0060
-SmackLabelIPIn=*
-SmackLabelIPOut=@
-
-Service=cynara.service
-
-[Unit]
-Wants=cynara.target
-Before=cynara.target
-
-[Install]
-WantedBy=sockets.target
diff --git a/systemd/cynara-agent.socket.in b/systemd/cynara-agent.socket.in
new file mode 100644
index 0000000..4f86c9d
--- /dev/null
+++ b/systemd/cynara-agent.socket.in
@@ -0,0 +1,15 @@
+[Socket]
+ListenStream=@SOCKET_DIR@/cynara-agent.socket
+SocketGroup=@CYNARA_ADMIN_SOCKET_GROUP@
+SocketMode=0060
+SmackLabelIPIn=*
+SmackLabelIPOut=@
+
+Service=cynara.service
+
+[Unit]
+Wants=cynara.target
+Before=cynara.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/systemd/cynara-monitor-get.socket b/systemd/cynara-monitor-get.socket
deleted file mode 100644
index a50feeb..0000000
--- a/systemd/cynara-monitor-get.socket
+++ /dev/null
@@ -1,15 +0,0 @@
-[Socket]
-ListenStream=/run/cynara/cynara-monitor-get.socket
-SocketGroup=security_fw
-SocketMode=0060
-SmackLabelIPIn=@
-SmackLabelIPOut=@
-
-Service=cynara.service
-
-[Unit]
-Wants=cynara.target
-Before=cynara.target
-
-[Install]
-WantedBy=sockets.target
diff --git a/systemd/cynara-monitor-get.socket.in b/systemd/cynara-monitor-get.socket.in
new file mode 100644
index 0000000..b88dbf7
--- /dev/null
+++ b/systemd/cynara-monitor-get.socket.in
@@ -0,0 +1,15 @@
+[Socket]
+ListenStream=@SOCKET_DIR@/cynara-monitor-get.socket
+SocketGroup=@CYNARA_ADMIN_SOCKET_GROUP@
+SocketMode=0060
+SmackLabelIPIn=@
+SmackLabelIPOut=@
+
+Service=cynara.service
+
+[Unit]
+Wants=cynara.target
+Before=cynara.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/systemd/cynara.socket b/systemd/cynara.socket
deleted file mode 100644
index fad2745..0000000
--- a/systemd/cynara.socket
+++ /dev/null
@@ -1,14 +0,0 @@
-[Socket]
-ListenStream=/run/cynara/cynara.socket
-SocketMode=0666
-SmackLabelIPIn=*
-SmackLabelIPOut=@
-
-Service=cynara.service
-
-[Unit]
-Wants=cynara.target
-Before=cynara.target
-
-[Install]
-WantedBy=sockets.target
diff --git a/systemd/cynara.socket.in b/systemd/cynara.socket.in
new file mode 100644
index 0000000..ba76549
--- /dev/null
+++ b/systemd/cynara.socket.in
@@ -0,0 +1,14 @@
+[Socket]
+ListenStream=@SOCKET_DIR@/cynara.socket
+SocketMode=0666
+SmackLabelIPIn=*
+SmackLabelIPOut=@
+
+Service=cynara.service
+
+[Unit]
+Wants=cynara.target
+Before=cynara.target
+
+[Install]
+WantedBy=sockets.target