003 File Manager
Current Path:
/usr/src/crypto/openssh
usr
/
src
/
crypto
/
openssh
/
📁
..
📄
.depend
(129.94 KB)
📄
.gitignore
(341 B)
📄
.skipped-commit-ids
(1.85 KB)
📄
CREDITS
(5.36 KB)
📄
ChangeLog
(299.53 KB)
📄
FREEBSD-upgrade
(5.68 KB)
📄
FREEBSD-vendor
(131 B)
📄
INSTALL
(9.36 KB)
📄
LICENCE
(14.83 KB)
📄
Makefile.in
(24.73 KB)
📄
OVERVIEW
(6.16 KB)
📄
PROTOCOL
(18 KB)
📄
PROTOCOL.agent
(220 B)
📄
PROTOCOL.certkeys
(11.91 KB)
📄
PROTOCOL.chacha20poly1305
(4.52 KB)
📄
PROTOCOL.key
(1.5 KB)
📄
PROTOCOL.krl
(5.13 KB)
📄
PROTOCOL.mux
(8.87 KB)
📄
README
(2.39 KB)
📄
README.dns
(1.57 KB)
📄
README.platform
(3.95 KB)
📄
README.privsep
(2.25 KB)
📄
README.tun
(4.78 KB)
📄
TODO
(2.54 KB)
📄
aclocal.m4
(5.56 KB)
📄
addrmatch.c
(10.97 KB)
📄
atomicio.c
(4.4 KB)
📄
atomicio.h
(2.14 KB)
📄
audit-bsm.c
(11.82 KB)
📄
audit-linux.c
(3.46 KB)
📄
audit.c
(5.69 KB)
📄
audit.h
(2.27 KB)
📄
auth-bsdauth.c
(3.65 KB)
📄
auth-krb5.c
(6.93 KB)
📄
auth-options.c
(23.45 KB)
📄
auth-options.h
(2.75 KB)
📄
auth-pam.c
(35.07 KB)
📄
auth-pam.h
(1.89 KB)
📄
auth-passwd.c
(6.42 KB)
📄
auth-rhosts.c
(8.89 KB)
📄
auth-shadow.c
(4.25 KB)
📄
auth-sia.c
(3.15 KB)
📄
auth-sia.h
(1.4 KB)
📄
auth-skey.c
(2.75 KB)
📄
auth.c
(32.86 KB)
📄
auth.h
(7.95 KB)
📄
auth2-chall.c
(9.77 KB)
📄
auth2-gss.c
(9.63 KB)
📄
auth2-hostbased.c
(8.08 KB)
📄
auth2-kbdint.c
(2.2 KB)
📄
auth2-none.c
(2.29 KB)
📄
auth2-passwd.c
(2.36 KB)
📄
auth2-pubkey.c
(28.79 KB)
📄
auth2.c
(22.23 KB)
📄
authfd.c
(14.47 KB)
📄
authfd.h
(3.05 KB)
📄
authfile.c
(12.59 KB)
📄
authfile.h
(2.34 KB)
📄
bitmap.c
(4.44 KB)
📄
bitmap.h
(1.9 KB)
📄
blacklist.c
(2.81 KB)
📄
blacklist_client.h
(2.09 KB)
📄
buildpkg.sh.in
(17.64 KB)
📄
canohost.c
(4.72 KB)
📄
canohost.h
(842 B)
📄
chacha.c
(5.28 KB)
📄
chacha.h
(1000 B)
📄
channels.c
(133.25 KB)
📄
channels.h
(12.96 KB)
📄
cipher-aes.c
(4.54 KB)
📄
cipher-aesctr.c
(2.06 KB)
📄
cipher-aesctr.h
(1.3 KB)
📄
cipher-chachapoly.c
(3.72 KB)
📄
cipher-chachapoly.h
(1.58 KB)
📄
cipher-ctr.c
(3.57 KB)
📄
cipher.c
(13.57 KB)
📄
cipher.h
(3.15 KB)
📄
cleanup.c
(1.01 KB)
📄
clientloop.c
(66.05 KB)
📄
clientloop.h
(3.69 KB)
📄
compat.c
(6.62 KB)
📄
compat.h
(2.77 KB)
📄
config.guess
(42.74 KB)
📄
config.h
(53.02 KB)
📄
config.sub
(35.49 KB)
📄
configure.ac
(147.81 KB)
📁
contrib
📄
crc32.c
(4.92 KB)
📄
crc32.h
(1.44 KB)
📄
crypto_api.h
(1.12 KB)
📄
defines.h
(21.73 KB)
📄
dh.c
(15.14 KB)
📄
dh.h
(2.59 KB)
📄
digest-libc.c
(5.69 KB)
📄
digest-openssl.c
(4.95 KB)
📄
digest.h
(2.51 KB)
📄
dispatch.c
(3.52 KB)
📄
dispatch.h
(2.2 KB)
📄
dns.c
(9.15 KB)
📄
dns.h
(2.03 KB)
📄
ed25519.c
(3.1 KB)
📄
entropy.c
(6.34 KB)
📄
entropy.h
(1.47 KB)
📄
fatal.c
(1.63 KB)
📄
fe25519.c
(8.13 KB)
📄
fe25519.h
(2.31 KB)
📄
fixalgorithms
(422 B)
📄
fixpaths
(499 B)
📄
freebsd-configure.sh
(1.07 KB)
📄
freebsd-namespace.sh
(1.93 KB)
📄
freebsd-post-merge.sh
(224 B)
📄
freebsd-pre-merge.sh
(429 B)
📄
ge25519.c
(11.04 KB)
📄
ge25519.h
(1.35 KB)
📄
ge25519_base.data
(164.61 KB)
📄
groupaccess.c
(3.5 KB)
📄
groupaccess.h
(1.53 KB)
📄
gss-genr.c
(7.99 KB)
📄
gss-serv-krb5.c
(5.63 KB)
📄
gss-serv.c
(10.32 KB)
📄
hash.c
(623 B)
📄
hmac.c
(5.08 KB)
📄
hmac.h
(1.62 KB)
📄
hostfile.c
(21.7 KB)
📄
hostfile.h
(3.8 KB)
📄
includes.h
(3.85 KB)
📄
install-sh
(13.67 KB)
📄
kex.c
(25.9 KB)
📄
kex.h
(7.32 KB)
📄
kexc25519.c
(4.62 KB)
📄
kexc25519c.c
(5.11 KB)
📄
kexc25519s.c
(4.99 KB)
📄
kexdh.c
(3.27 KB)
📄
kexdhc.c
(6.13 KB)
📄
kexdhs.c
(6.06 KB)
📄
kexecdh.c
(3.49 KB)
📄
kexecdhc.c
(6.22 KB)
📄
kexecdhs.c
(5.94 KB)
📄
kexgex.c
(3.67 KB)
📄
kexgexc.c
(7.63 KB)
📄
kexgexs.c
(7.35 KB)
📄
krb5_config.h
(315 B)
📄
krl.c
(35.63 KB)
📄
krl.h
(2.67 KB)
📄
log.c
(10.67 KB)
📄
log.h
(2.64 KB)
📄
loginrec.c
(41.91 KB)
📄
loginrec.h
(4.6 KB)
📄
logintest.c
(8.58 KB)
📄
mac.c
(7.24 KB)
📄
mac.h
(1.96 KB)
📄
match.c
(9.14 KB)
📄
match.h
(1.16 KB)
📄
md5crypt.c
(3.98 KB)
📄
md5crypt.h
(744 B)
📄
mdoc2man.awk
(8.38 KB)
📄
misc.c
(43.77 KB)
📄
misc.h
(5.69 KB)
📄
mkinstalldirs
(633 B)
📄
moduli
(552 KB)
📄
moduli.5
(3.6 KB)
📄
moduli.c
(20.46 KB)
📄
monitor.c
(50.56 KB)
📄
monitor.h
(3.83 KB)
📄
monitor_fdpass.c
(4.71 KB)
📄
monitor_fdpass.h
(1.49 KB)
📄
monitor_wrap.c
(27.44 KB)
📄
monitor_wrap.h
(3.84 KB)
📄
msg.c
(2.75 KB)
📄
msg.h
(1.49 KB)
📄
mux.c
(65.73 KB)
📄
myproposal.h
(5.62 KB)
📄
nchan.c
(12.06 KB)
📄
nchan.ms
(3.86 KB)
📄
nchan2.ms
(3.38 KB)
📄
opacket.c
(5.55 KB)
📄
opacket.h
(5.98 KB)
📁
openbsd-compat
📄
openssh.xml.in
(2.77 KB)
📄
opensshd.init.in
(1.86 KB)
📄
packet.c
(70.79 KB)
📄
packet.h
(7.39 KB)
📄
pathnames.h
(5.69 KB)
📄
pkcs11.h
(41.37 KB)
📄
platform-misc.c
(1.09 KB)
📄
platform-pledge.c
(1.86 KB)
📄
platform-tracing.c
(1.69 KB)
📄
platform.c
(4.71 KB)
📄
platform.h
(1.43 KB)
📄
poly1305.c
(4.54 KB)
📄
poly1305.h
(645 B)
📄
progressmeter.c
(7.48 KB)
📄
progressmeter.h
(1.44 KB)
📄
readconf.c
(81 KB)
📄
readconf.h
(7.83 KB)
📄
readpass.c
(4.99 KB)
📁
regress
📄
rijndael.c
(51.57 KB)
📄
rijndael.h
(2.07 KB)
📄
sandbox-capsicum.c
(3.39 KB)
📄
sandbox-darwin.c
(2.49 KB)
📄
sandbox-null.c
(1.62 KB)
📄
sandbox-pledge.c
(1.83 KB)
📄
sandbox-rlimit.c
(2.43 KB)
📄
sandbox-seccomp-filter.c
(9.88 KB)
📄
sandbox-solaris.c
(2.9 KB)
📄
sandbox-systrace.c
(6.27 KB)
📄
sc25519.c
(7.16 KB)
📄
sc25519.h
(2.83 KB)
📄
scp.1
(5.56 KB)
📄
scp.c
(39.14 KB)
📄
servconf.c
(79.73 KB)
📄
servconf.h
(10.13 KB)
📄
serverloop.c
(26.03 KB)
📄
serverloop.h
(1000 B)
📄
session.c
(66.72 KB)
📄
session.h
(2.59 KB)
📄
sftp-client.c
(49.62 KB)
📄
sftp-client.h
(4.29 KB)
📄
sftp-common.c
(6.83 KB)
📄
sftp-common.h
(2.02 KB)
📄
sftp-glob.c
(3.38 KB)
📄
sftp-server-main.c
(1.49 KB)
📄
sftp-server.8
(4.98 KB)
📄
sftp-server.c
(42.36 KB)
📄
sftp.1
(14.53 KB)
📄
sftp.c
(59.73 KB)
📄
sftp.h
(3.33 KB)
📄
smult_curve25519_ref.c
(6.71 KB)
📄
ssh-add.1
(6.45 KB)
📄
ssh-add.c
(17.69 KB)
📄
ssh-agent.1
(7.16 KB)
📄
ssh-agent.c
(33.19 KB)
📄
ssh-dss.c
(5.55 KB)
📄
ssh-ecdsa.c
(5.54 KB)
📄
ssh-ed25519.c
(4.21 KB)
📄
ssh-gss.h
(4.71 KB)
📄
ssh-keygen.1
(26.5 KB)
📄
ssh-keygen.c
(78.58 KB)
📄
ssh-keyscan.1
(3.82 KB)
📄
ssh-keyscan.c
(17.83 KB)
📄
ssh-keysign.8
(2.95 KB)
📄
ssh-keysign.c
(8.26 KB)
📄
ssh-pkcs11-client.c
(6.65 KB)
📄
ssh-pkcs11-helper.8
(1.33 KB)
📄
ssh-pkcs11-helper.c
(9.79 KB)
📄
ssh-pkcs11.c
(19.56 KB)
📄
ssh-pkcs11.h
(1.06 KB)
📄
ssh-rsa.c
(11.89 KB)
📄
ssh-sandbox.h
(1.09 KB)
📄
ssh-xmss.c
(5 KB)
📄
ssh.1
(44.3 KB)
📄
ssh.c
(61.58 KB)
📄
ssh.h
(2.6 KB)
📄
ssh2.h
(5.66 KB)
📄
ssh_api.c
(13.81 KB)
📄
ssh_api.h
(4.33 KB)
📄
ssh_config
(1.53 KB)
📄
ssh_config.5
(51.41 KB)
📄
ssh_namespace.h
(44.25 KB)
📄
sshbuf-getput-basic.c
(11.81 KB)
📄
sshbuf-getput-crypto.c
(5.64 KB)
📄
sshbuf-misc.c
(3.53 KB)
📄
sshbuf.c
(8.96 KB)
📄
sshbuf.h
(12.2 KB)
📄
sshconnect.c
(43.92 KB)
📄
sshconnect.h
(2.3 KB)
📄
sshconnect2.c
(59.05 KB)
📄
sshd.8
(30.87 KB)
📄
sshd.c
(64.58 KB)
📄
sshd_config
(3.18 KB)
📄
sshd_config.5
(50.55 KB)
📄
ssherr.c
(5.04 KB)
📄
ssherr.h
(3.28 KB)
📄
sshkey-xmss.c
(28.17 KB)
📄
sshkey-xmss.h
(2.89 KB)
📄
sshkey.c
(102.94 KB)
📄
sshkey.h
(10.09 KB)
📄
sshlogin.c
(5.25 KB)
📄
sshlogin.h
(935 B)
📄
sshpty.c
(5.59 KB)
📄
sshpty.h
(1.03 KB)
📄
sshtty.c
(2.95 KB)
📄
survey.sh.in
(1.68 KB)
📄
ttymodes.c
(10.1 KB)
📄
ttymodes.h
(4.85 KB)
📄
uidswap.c
(7.09 KB)
📄
uidswap.h
(680 B)
📄
umac.c
(44.91 KB)
📄
umac.h
(4.58 KB)
📄
umac128.c
(414 B)
📄
utf8.c
(8.09 KB)
📄
utf8.h
(1.17 KB)
📄
uuencode.c
(2.94 KB)
📄
uuencode.h
(1.5 KB)
📄
verify.c
(668 B)
📄
version.h
(385 B)
📄
xmalloc.c
(2.41 KB)
📄
xmalloc.h
(1.08 KB)
📄
xmss_commons.c
(630 B)
📄
xmss_commons.h
(450 B)
📄
xmss_fast.c
(32.16 KB)
📄
xmss_fast.h
(3.64 KB)
📄
xmss_hash.c
(3.35 KB)
📄
xmss_hash.h
(841 B)
📄
xmss_hash_address.c
(1.2 KB)
📄
xmss_hash_address.h
(836 B)
📄
xmss_wots.c
(4.74 KB)
📄
xmss_wots.h
(1.86 KB)
Editing: audit-bsm.c
/* * TODO * * - deal with overlap between this and sys_auth_allowed_user * sys_auth_record_login and record_failed_login. */ /* * Copyright 1988-2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* #pragma ident "@(#)bsmaudit.c 1.1 01/09/17 SMI" */ #include "includes.h" #if defined(USE_BSM_AUDIT) #include <sys/types.h> #include <errno.h> #include <netdb.h> #include <stdarg.h> #include <string.h> #include <unistd.h> #ifdef BROKEN_BSM_API #include <libscf.h> #endif #include "ssh.h" #include "log.h" #include "hostfile.h" #include "auth.h" #include "xmalloc.h" #ifndef AUE_openssh # define AUE_openssh 32800 #endif #include <bsm/audit.h> #include <bsm/libbsm.h> #include <bsm/audit_uevents.h> #include <bsm/audit_record.h> #include <locale.h> #if defined(HAVE_GETAUDIT_ADDR) #define AuditInfoStruct auditinfo_addr #define AuditInfoTermID au_tid_addr_t #define SetAuditFunc(a,b) setaudit_addr((a),(b)) #define SetAuditFuncText "setaudit_addr" #define AUToSubjectFunc au_to_subject_ex #define AUToReturnFunc(a,b) au_to_return32((a), (int32_t)(b)) #else #define AuditInfoStruct auditinfo #define AuditInfoTermID au_tid_t #define SetAuditFunc(a,b) setaudit(a) #define SetAuditFuncText "setaudit" #define AUToSubjectFunc au_to_subject #define AUToReturnFunc(a,b) au_to_return((a), (u_int)(b)) #endif #ifndef cannot_audit extern int cannot_audit(int); #endif extern void aug_init(void); extern void aug_save_auid(au_id_t); extern void aug_save_uid(uid_t); extern void aug_save_euid(uid_t); extern void aug_save_gid(gid_t); extern void aug_save_egid(gid_t); extern void aug_save_pid(pid_t); extern void aug_save_asid(au_asid_t); extern void aug_save_tid(dev_t, unsigned int); extern void aug_save_tid_ex(dev_t, u_int32_t *, u_int32_t); extern int aug_save_me(void); extern int aug_save_namask(void); extern void aug_save_event(au_event_t); extern void aug_save_sorf(int); extern void aug_save_text(char *); extern void aug_save_text1(char *); extern void aug_save_text2(char *); extern void aug_save_na(int); extern void aug_save_user(char *); extern void aug_save_path(char *); extern int aug_save_policy(void); extern void aug_save_afunc(int (*)(int)); extern int aug_audit(void); extern int aug_na_selected(void); extern int aug_selected(void); extern int aug_daemon_session(void); #ifndef HAVE_GETTEXT # define gettext(a) (a) #endif extern Authctxt *the_authctxt; static AuditInfoTermID ssh_bsm_tid; #ifdef BROKEN_BSM_API /* For some reason this constant is no longer defined in Solaris 11. */ #define BSM_TEXTBUFSZ 256 #endif /* Below is the low-level BSM interface code */ /* * aug_get_machine is only required on IPv6 capable machines, we use a * different mechanism in audit_connection_from() for IPv4-only machines. * getaudit_addr() is only present on IPv6 capable machines. */ #if defined(HAVE_AUG_GET_MACHINE) || !defined(HAVE_GETAUDIT_ADDR) extern int aug_get_machine(char *, u_int32_t *, u_int32_t *); #else static int aug_get_machine(char *host, u_int32_t *addr, u_int32_t *type) { struct addrinfo *ai; struct sockaddr_in *in4; struct sockaddr_in6 *in6; int ret = 0, r; if ((r = getaddrinfo(host, NULL, NULL, &ai)) != 0) { error("BSM audit: getaddrinfo failed for %.100s: %.100s", host, r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r)); return -1; } switch (ai->ai_family) { case AF_INET: in4 = (struct sockaddr_in *)ai->ai_addr; *type = AU_IPv4; memcpy(addr, &in4->sin_addr, sizeof(struct in_addr)); break; #ifdef AU_IPv6 case AF_INET6: in6 = (struct sockaddr_in6 *)ai->ai_addr; *type = AU_IPv6; memcpy(addr, &in6->sin6_addr, sizeof(struct in6_addr)); break; #endif default: error("BSM audit: unknown address family for %.100s: %d", host, ai->ai_family); ret = -1; } freeaddrinfo(ai); return ret; } #endif #ifdef BROKEN_BSM_API /* In Solaris 11 the audit daemon has been moved to SMF. In the process they simply dropped getacna() from the API, since it read from a now non-existent config file. This function re-implements getacna() to read from the SMF repository instead. */ int getacna(char *auditstring, int len) { scf_handle_t *handle = NULL; scf_property_t *property = NULL; scf_value_t *value = NULL; int ret = 0; handle = scf_handle_create(SCF_VERSION); if (handle == NULL) return -2; /* The man page for getacna on Solaris 10 states we should return -2 in case of error and set errno to indicate the error. We don't bother with errno here, though, since the only use of this function below doesn't check for errors anyway. */ ret = scf_handle_bind(handle); if (ret == -1) return -2; property = scf_property_create(handle); if (property == NULL) return -2; ret = scf_handle_decode_fmri(handle, "svc:/system/auditd:default/:properties/preselection/naflags", NULL, NULL, NULL, NULL, property, 0); if (ret == -1) return -2; value = scf_value_create(handle); if (value == NULL) return -2; ret = scf_property_get_value(property, value); if (ret == -1) return -2; ret = scf_value_get_astring(value, auditstring, len); if (ret == -1) return -2; scf_value_destroy(value); scf_property_destroy(property); scf_handle_destroy(handle); return 0; } #endif /* * Check if the specified event is selected (enabled) for auditing. * Returns 1 if the event is selected, 0 if not and -1 on failure. */ static int selected(char *username, uid_t uid, au_event_t event, int sf) { int rc, sorf; char naflags[512]; struct au_mask mask; mask.am_success = mask.am_failure = 0; if (uid < 0) { /* get flags for non-attributable (to a real user) events */ rc = getacna(naflags, sizeof(naflags)); if (rc == 0) (void) getauditflagsbin(naflags, &mask); } else rc = au_user_mask(username, &mask); sorf = (sf == 0) ? AU_PRS_SUCCESS : AU_PRS_FAILURE; return(au_preselect(event, &mask, sorf, AU_PRS_REREAD)); } static void bsm_audit_record(int typ, char *string, au_event_t event_no) { int ad, rc, sel; uid_t uid = -1; gid_t gid = -1; pid_t pid = getpid(); AuditInfoTermID tid = ssh_bsm_tid; if (the_authctxt != NULL && the_authctxt->valid) { uid = the_authctxt->pw->pw_uid; gid = the_authctxt->pw->pw_gid; } rc = (typ == 0) ? 0 : -1; sel = selected(the_authctxt->user, uid, event_no, rc); debug3("BSM audit: typ %d rc %d \"%s\"", typ, rc, string); if (!sel) return; /* audit event does not match mask, do not write */ debug3("BSM audit: writing audit new record"); ad = au_open(); (void) au_write(ad, AUToSubjectFunc(uid, uid, gid, uid, gid, pid, pid, &tid)); (void) au_write(ad, au_to_text(string)); (void) au_write(ad, AUToReturnFunc(typ, rc)); #ifdef BROKEN_BSM_API /* The last argument is the event modifier flags. For some seemingly undocumented reason it was added in Solaris 11. */ rc = au_close(ad, AU_TO_WRITE, event_no, 0); #else rc = au_close(ad, AU_TO_WRITE, event_no); #endif if (rc < 0) error("BSM audit: %s failed to write \"%s\" record: %s", __func__, string, strerror(errno)); } static void bsm_audit_session_setup(void) { int rc; struct AuditInfoStruct info; au_mask_t mask; if (the_authctxt == NULL) { error("BSM audit: session setup internal error (NULL ctxt)"); return; } if (the_authctxt->valid) info.ai_auid = the_authctxt->pw->pw_uid; else info.ai_auid = -1; info.ai_asid = getpid(); mask.am_success = 0; mask.am_failure = 0; (void) au_user_mask(the_authctxt->user, &mask); info.ai_mask.am_success = mask.am_success; info.ai_mask.am_failure = mask.am_failure; info.ai_termid = ssh_bsm_tid; rc = SetAuditFunc(&info, sizeof(info)); if (rc < 0) error("BSM audit: %s: %s failed: %s", __func__, SetAuditFuncText, strerror(errno)); } static void bsm_audit_bad_login(const char *what) { char textbuf[BSM_TEXTBUFSZ]; if (the_authctxt->valid) { (void) snprintf(textbuf, sizeof (textbuf), gettext("invalid %s for user %s"), what, the_authctxt->user); bsm_audit_record(4, textbuf, AUE_openssh); } else { (void) snprintf(textbuf, sizeof (textbuf), gettext("invalid user name \"%s\""), the_authctxt->user); bsm_audit_record(3, textbuf, AUE_openssh); } } /* Below is the sshd audit API code */ void audit_connection_from(const char *host, int port) { AuditInfoTermID *tid = &ssh_bsm_tid; char buf[1024]; if (cannot_audit(0)) return; debug3("BSM audit: connection from %.100s port %d", host, port); /* populate our terminal id structure */ #if defined(HAVE_GETAUDIT_ADDR) tid->at_port = (dev_t)port; aug_get_machine((char *)host, &(tid->at_addr[0]), &(tid->at_type)); snprintf(buf, sizeof(buf), "%08x %08x %08x %08x", tid->at_addr[0], tid->at_addr[1], tid->at_addr[2], tid->at_addr[3]); debug3("BSM audit: iptype %d machine ID %s", (int)tid->at_type, buf); #else /* this is used on IPv4-only machines */ tid->port = (dev_t)port; tid->machine = inet_addr(host); snprintf(buf, sizeof(buf), "%08x", tid->machine); debug3("BSM audit: machine ID %s", buf); #endif } void audit_run_command(const char *command) { /* not implemented */ } void audit_session_open(struct logininfo *li) { /* not implemented */ } void audit_session_close(struct logininfo *li) { /* not implemented */ } void audit_event(ssh_audit_event_t event) { char textbuf[BSM_TEXTBUFSZ]; static int logged_in = 0; const char *user = the_authctxt ? the_authctxt->user : "(unknown user)"; if (cannot_audit(0)) return; switch(event) { case SSH_AUTH_SUCCESS: logged_in = 1; bsm_audit_session_setup(); snprintf(textbuf, sizeof(textbuf), gettext("successful login %s"), user); bsm_audit_record(0, textbuf, AUE_openssh); break; case SSH_CONNECTION_CLOSE: /* * We can also get a close event if the user attempted auth * but never succeeded. */ if (logged_in) { snprintf(textbuf, sizeof(textbuf), gettext("sshd logout %s"), the_authctxt->user); bsm_audit_record(0, textbuf, AUE_logout); } else { debug("%s: connection closed without authentication", __func__); } break; case SSH_NOLOGIN: bsm_audit_record(1, gettext("logins disabled by /etc/nologin"), AUE_openssh); break; case SSH_LOGIN_EXCEED_MAXTRIES: snprintf(textbuf, sizeof(textbuf), gettext("too many tries for user %s"), the_authctxt->user); bsm_audit_record(1, textbuf, AUE_openssh); break; case SSH_LOGIN_ROOT_DENIED: bsm_audit_record(2, gettext("not_console"), AUE_openssh); break; case SSH_AUTH_FAIL_PASSWD: bsm_audit_bad_login("password"); break; case SSH_AUTH_FAIL_KBDINT: bsm_audit_bad_login("interactive password entry"); break; default: debug("%s: unhandled event %d", __func__, event); } } #endif /* BSM */
Upload File
Create Folder