summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--audit-bsm.c79
-rw-r--r--configure.ac9
3 files changed, 89 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f5630da4..05749a6a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120120224
2 - (dtucker) [audit-bsm.c configure.ac] bug #1968: enable workarounds for BSM
3 audit breakage in Solaris 11. Patch from Magnus Johansson.
4
120120215 520120215
2 - (tim) [openbsd-compat/bsd-misc.h sshd.c] Fix conflicting return type for 6 - (tim) [openbsd-compat/bsd-misc.h sshd.c] Fix conflicting return type for
3 unsetenv due to rev 1.14 change to setenv.c. Cast unsetenv to void in sshd.c 7 unsetenv due to rev 1.14 change to setenv.c. Cast unsetenv to void in sshd.c
diff --git a/audit-bsm.c b/audit-bsm.c
index f196d4f1e..613559140 100644
--- a/audit-bsm.c
+++ b/audit-bsm.c
@@ -1,4 +1,4 @@
1/* $Id: audit-bsm.c,v 1.7 2011/01/17 10:15:29 dtucker Exp $ */ 1/* $Id: audit-bsm.c,v 1.8 2012/02/23 23:40:43 dtucker Exp $ */
2 2
3/* 3/*
4 * TODO 4 * TODO
@@ -45,6 +45,10 @@
45#include <string.h> 45#include <string.h>
46#include <unistd.h> 46#include <unistd.h>
47 47
48#ifdef BROKEN_BSM_API
49#include <libscf.h>
50#endif
51
48#include "ssh.h" 52#include "ssh.h"
49#include "log.h" 53#include "log.h"
50#include "key.h" 54#include "key.h"
@@ -114,6 +118,12 @@ extern int aug_daemon_session(void);
114extern Authctxt *the_authctxt; 118extern Authctxt *the_authctxt;
115static AuditInfoTermID ssh_bsm_tid; 119static AuditInfoTermID ssh_bsm_tid;
116 120
121#ifdef BROKEN_BSM_API
122/* For some reason this constant is no longer defined
123 in Solaris 11. */
124#define BSM_TEXTBUFSZ 256
125#endif
126
117/* Below is the low-level BSM interface code */ 127/* Below is the low-level BSM interface code */
118 128
119/* 129/*
@@ -161,6 +171,65 @@ aug_get_machine(char *host, u_int32_t *addr, u_int32_t *type)
161} 171}
162#endif 172#endif
163 173
174#ifdef BROKEN_BSM_API
175/*
176 In Solaris 11 the audit daemon has been moved to SMF. In the process
177 they simply dropped getacna() from the API, since it read from a now
178 non-existent config file. This function re-implements getacna() to
179 read from the SMF repository instead.
180 */
181int
182getacna(char *auditstring, int len)
183{
184 scf_handle_t *handle = NULL;
185 scf_property_t *property = NULL;
186 scf_value_t *value = NULL;
187 int ret = 0;
188
189 handle = scf_handle_create(SCF_VERSION);
190 if (handle == NULL)
191 return -2; /* The man page for getacna on Solaris 10 states
192 we should return -2 in case of error and set
193 errno to indicate the error. We don't bother
194 with errno here, though, since the only use
195 of this function below doesn't check for errors
196 anyway.
197 */
198
199 ret = scf_handle_bind(handle);
200 if (ret == -1)
201 return -2;
202
203 property = scf_property_create(handle);
204 if (property == NULL)
205 return -2;
206
207 ret = scf_handle_decode_fmri(handle,
208 "svc:/system/auditd:default/:properties/preselection/naflags",
209 NULL, NULL, NULL, NULL, property, 0);
210 if (ret == -1)
211 return -2;
212
213 value = scf_value_create(handle);
214 if (value == NULL)
215 return -2;
216
217 ret = scf_property_get_value(property, value);
218 if (ret == -1)
219 return -2;
220
221 ret = scf_value_get_astring(value, auditstring, len);
222 if (ret == -1)
223 return -2;
224
225 scf_value_destroy(value);
226 scf_property_destroy(property);
227 scf_handle_destroy(handle);
228
229 return 0;
230}
231#endif
232
164/* 233/*
165 * Check if the specified event is selected (enabled) for auditing. 234 * Check if the specified event is selected (enabled) for auditing.
166 * Returns 1 if the event is selected, 0 if not and -1 on failure. 235 * Returns 1 if the event is selected, 0 if not and -1 on failure.
@@ -213,7 +282,15 @@ bsm_audit_record(int typ, char *string, au_event_t event_no)
213 (void) au_write(ad, au_to_text(string)); 282 (void) au_write(ad, au_to_text(string));
214 (void) au_write(ad, AUToReturnFunc(typ, rc)); 283 (void) au_write(ad, AUToReturnFunc(typ, rc));
215 284
285#ifdef BROKEN_BSM_API
286 /* The last argument is the event modifier flags. For
287 some seemingly undocumented reason it was added in
288 Solaris 11. */
289 rc = au_close(ad, AU_TO_WRITE, event_no, 0);
290#else
216 rc = au_close(ad, AU_TO_WRITE, event_no); 291 rc = au_close(ad, AU_TO_WRITE, event_no);
292#endif
293
217 if (rc < 0) 294 if (rc < 0)
218 error("BSM audit: %s failed to write \"%s\" record: %s", 295 error("BSM audit: %s failed to write \"%s\" record: %s",
219 __func__, string, strerror(errno)); 296 __func__, string, strerror(errno));
diff --git a/configure.ac b/configure.ac
index 54fc7d0cf..acf529b04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.486 2012/01/17 03:03:37 dtucker Exp $ 1# $Id: configure.ac,v 1.487 2012/02/23 23:40:43 dtucker Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -15,7 +15,7 @@
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 16
17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) 17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
18AC_REVISION($Revision: 1.486 $) 18AC_REVISION($Revision: 1.487 $)
19AC_CONFIG_SRCDIR([ssh.c]) 19AC_CONFIG_SRCDIR([ssh.c])
20AC_LANG([C]) 20AC_LANG([C])
21 21
@@ -1434,6 +1434,11 @@ AC_ARG_WITH([audit],
1434 # These are optional 1434 # These are optional
1435 AC_CHECK_FUNCS([getaudit_addr aug_get_machine]) 1435 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1436 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module]) 1436 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
1437 if test "$sol2ver" -eq 11; then
1438 SSHDLIBS="$SSHDLIBS -lscf"
1439 AC_DEFINE([BROKEN_BSM_API], [1],
1440 [The system has incomplete BSM API])
1441 fi
1437 ;; 1442 ;;
1438 linux) 1443 linux)
1439 AC_MSG_RESULT([linux]) 1444 AC_MSG_RESULT([linux])