ProxyAuth
Linux PAM to authenticate device via Bluetooth device
|
A background program that runs as soon as you are authenticated to check if your device is nearby. It'll lock the computer if the device is not nearby. More...
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
#include <errno.h>
#include <limits.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include "pam_misc.h"
#include "pam_bt_misc.h"
#include "pam_bt_pair.h"
#include "pam_bt_trust.h"
#include "proxy_dbus.h"
Go to the source code of this file.
Macros | |
#define | SERVICE_NAME "Proxy Auth" |
#define | SERVICE_DESC "Continuous Authentication via Bluetooth" |
#define | SERVICE_PROV "ProxyAuth" |
#define | minThroughput 100 |
Functions | |
sdp_session_t * | sdp_connect (const bdaddr_t *src, const bdaddr_t *dst, uint32_t flags) |
int | sdp_close (sdp_session_t *session) |
int | sdp_record_register (sdp_session_t *sess, sdp_record_t *rec, uint8_t flags) |
void | terminate_server (int server, int client, sdp_session_t *session) |
void | set_service (uuid_t *svc_uuid, uuid_t *svc_class_uuid, sdp_list_t **svc_class_list, sdp_record_t *record, uint32_t *svc_uuid_int) |
void | set_bluetooth_service_info (sdp_profile_desc_t *profile, sdp_list_t **profile_list, sdp_record_t *record) |
void | set_browsable (sdp_list_t **root_list, sdp_record_t *record, uuid_t *root_uuid) |
void | set_l2cap_info (sdp_list_t **l2cap_list, sdp_list_t **proto_list, uuid_t *l2cap_uuid) |
void | register_rfcomm_sock (sdp_data_t **channel, sdp_record_t *record, sdp_list_t **rfcomm_list, sdp_list_t **proto_list, sdp_list_t **access_proto_list, uuid_t *rfcomm_uuid, uint8_t *rfcomm_channel) |
sdp_session_t * | register_service (uint8_t rfcomm_channel) |
int | init_server (struct sockaddr_rc *loc_addr, sdp_session_t **session) |
void | lock (struct dbus_obj *data_obj) |
int | check_arg (int argc, char **argv) |
int | is_trusted_client (char *bt_addr, const char *trusted_dir_path) |
int | connect_client (int s, struct sockaddr_rc *rem_addr, socklen_t *opt, char *authorized_dev, struct dbus_obj *data_obj) |
int | main (int argc, char **argv) |
A background program that runs as soon as you are authenticated to check if your device is nearby. It'll lock the computer if the device is not nearby.
Special Thanks to: Ryan Scott for providing how to register service and Albert Huang
Definition in file deauth.c.
#define SERVICE_DESC "Continuous Authentication via Bluetooth" |
int check_arg | ( | int | argc, |
char ** | argv | ||
) |
Return 1 iff the given bluetooth address in the argument is valid
argc | number of arguments (always >= 1 due to program name stored in argv[0]) |
argv | array that contains cmdline arguments |
Definition at line 258 of file deauth.c.
int connect_client | ( | int | s, |
struct sockaddr_rc * | rem_addr, | ||
socklen_t * | opt, | ||
char * | authorized_dev, | ||
struct dbus_obj * | data_obj | ||
) |
Connect a new client. If client is not from a trusted device nor authorized then lock the system.
s | server's socket |
rem_addr | a pointer to sockaddr structure that will store the address of the client socket |
opt | the size of rem_addr |
authorized_dev | the address of the trusted device |
server_data | a struct that contains fd that needs to be closed before termination |
Definition at line 324 of file deauth.c.
int init_server | ( | struct sockaddr_rc * | loc_addr, |
sdp_session_t ** | session | ||
) |
int is_trusted_client | ( | char * | bt_addr, |
const char * | trusted_dir_path | ||
) |
void lock | ( | struct dbus_obj * | data_obj | ) |
int main | ( | int | argc, |
char ** | argv | ||
) |
void register_rfcomm_sock | ( | sdp_data_t ** | channel, |
sdp_record_t * | record, | ||
sdp_list_t ** | rfcomm_list, | ||
sdp_list_t ** | proto_list, | ||
sdp_list_t ** | access_proto_list, | ||
uuid_t * | rfcomm_uuid, | ||
uint8_t * | rfcomm_channel | ||
) |
sdp_session_t* register_service | ( | uint8_t | rfcomm_channel | ) |
int sdp_close | ( | sdp_session_t * | session | ) |
sdp_session_t* sdp_connect | ( | const bdaddr_t * | src, |
const bdaddr_t * | dst, | ||
uint32_t | flags | ||
) |
int sdp_record_register | ( | sdp_session_t * | sess, |
sdp_record_t * | rec, | ||
uint8_t | flags | ||
) |
void set_bluetooth_service_info | ( | sdp_profile_desc_t * | profile, |
sdp_list_t ** | profile_list, | ||
sdp_record_t * | record | ||
) |
void set_browsable | ( | sdp_list_t ** | root_list, |
sdp_record_t * | record, | ||
uuid_t * | root_uuid | ||
) |
void set_l2cap_info | ( | sdp_list_t ** | l2cap_list, |
sdp_list_t ** | proto_list, | ||
uuid_t * | l2cap_uuid | ||
) |
void set_service | ( | uuid_t * | svc_uuid, |
uuid_t * | svc_class_uuid, | ||
sdp_list_t ** | svc_class_list, | ||
sdp_record_t * | record, | ||
uint32_t * | svc_uuid_int | ||
) |
Set the general service ID and service class
svc_uuid | a pointer to store the generated service 128-bit UUID |
svc_class_uuid | a pointer to store the generated Service Class UUID |
svc_class_list | a pointer to an array of service class uuid |
record | |
svc_uuid_int |