RDEV-1145 added company name to the welcom message

This commit is contained in:
przemyslaw.szeremeta 2019-10-24 12:14:40 +02:00
parent 3c0268fd91
commit 4a59fe7da0
5 changed files with 24 additions and 24 deletions

View File

@ -1,6 +1,11 @@
make:
compile:
gcc -fPIC -fno-stack-protector -std=c99 -c rublonPam.c src/pamApp.c src/coreHandler.c src/signatureWrapper.c lib/cfg_parse.c lib/cJSON.c lib/qrcodegen.c
debug:
gcc -fPIC -g -std=c99 -c rublonPam.c src/pamApp.c src/coreHandler.c src/signatureWrapper.c lib/cfg_parse.c lib/cJSON.c lib/qrcodegen.c
ld -x --shared -o pam_rublon.so -lcurl rublonPam.o pamApp.o coreHandler.o signatureWrapper.o cfg_parse.o cJSON.o qrcodegen.o
make: compile
ld -x --shared -o pam_rublon.so -lcurl rublonPam.o pamApp.o coreHandler.o signatureWrapper.o cfg_parse.o cJSON.o qrcodegen.o
selinux:
checkmodule -M -m -o login_rublon.mod login_rublon.te
semodule_package -o login_rublon.pp -m login_rublon.mod
@ -17,3 +22,6 @@ install:
install -m 644 pam_rublon.so $(DESTDIR)/usr/lib64/security/
clean:
rm rublonPam.o pamApp.o coreHandler.o signatureWrapper.o cfg_parse.o cJSON.o qrcodegen.o
debug-rebuild: clean debug install

View File

@ -7,24 +7,6 @@
#include <security/pam_appl.h>
#include <security/pam_modules.h>
void displayHeader(pam_handle_t *pamh) {
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++. `;+++++++++++++++: ++++++++` `+++++++++++++++++++++++++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` ++++++++++++++: ++++++++` `+++++++++++++++++++++++++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` +++++++++++++: ++++++++` `+++++++++++++++++++++++++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` ''` ++';;'++;;;++: +:,+++++` `++++++.`.+++++;;;'+..++++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` +++ ++ `++ ++: +++` `++++ `+++ ` .++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` ++: ++ `++ ++: ++` `+++ `++ ++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` `++ `++ ++: `' ++` `+++ `' ++ +: ++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` +++ `++ ++: +++ ;+` `++, +++ '+ .++ ++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` ` .+++ `++ ++: +++ ;+` `++, +++ '+ .++ ++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` +. +++` ,` ++: `; ++` +++ `; ++ .++ ++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` ++ +++ ++: ++, ++ .++ .++ ++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++` +++ `++, +++: ++++ +++ .+++ .++ ++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "++++++++++++++++++++;.,++++++++++;:+++++++;.,+++++.`,++++++++++++++++++++");
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
PAM_EXTERN int pam_sm_setcred( pam_handle_t *pamh, int flags, int argc, const char **argv ) {
return PAM_SUCCESS;
}
@ -34,7 +16,6 @@ PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const c
}
PAM_EXTERN int pam_sm_authenticate( pam_handle_t *pamh, int flags,int argc, const char **argv ) {
displayHeader(pamh);
int access = startRublon(pamh);

View File

@ -257,7 +257,7 @@ bool isOneOfSelectedMethods(char *selectedMethod, char *methods[], int methodsSi
return false;
}
int postInit(pam_handle_t *pamh, cJSON **availableMethods, char **transactionId, char *systemToken, char *secretKey, const char *appUserId, char *userEmail, char *rublonApiServer) {
int postInit(pam_handle_t *pamh, cJSON **availableMethods, struct ApplicationInfoStruct* info, char **transactionId, char *systemToken, char *secretKey, const char *appUserId, char *userEmail, char *rublonApiServer) {
char *status = NULL;
char *transactionStatus = NULL;
char *exception = NULL;
@ -286,6 +286,9 @@ int postInit(pam_handle_t *pamh, cJSON **availableMethods, char **transactionId,
tosAccepted = parseNestedJsonInt(curlResponse,"result","tosAccepted");
*availableMethods = methods;
info->companyName = cJSON_GetObjectItem(resp, "companyName")->valuestring;
info->applicationName = cJSON_GetObjectItem(resp, "applicationName")->valuestring;
if(gdprAccepted != 1 || tosAccepted != 1) {
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "\nYou have to read and accept our:\n- Terms of Use: https://core.rublon.net/terms_of_use\n- Privacy Policy: https://core.rublon.net/privacy_policy\n");
do{

View File

@ -20,10 +20,15 @@
#define TOTP_SMS_INPUT_CODE_SIZE 6
#define SIGNATURE_SIZE 64
struct ApplicationInfoStruct{
char* companyName;
char* applicationName;
};
bool isOneOfSelectedMethods(char *selectedMethod, char *methods[], int methodsSize);
int startRublon(pam_handle_t *pamh);
void curlHandlerThread(pam_handle_t *pamh, char *jsonObj, char *url, char *secretKey, char **accessToken, char **status, char **exception);
int postInit(pam_handle_t *pamh, cJSON **availableMethods, char **transactionId, char *systemToken, char *secretKey, const char *appUserId, char *userEmail, char *rublonApiServer);
int postInit(pam_handle_t *pamh, cJSON **availableMethods, struct ApplicationInfoStruct* info, char **transactionId, char *systemToken, char *secretKey, const char *appUserId, char *userEmail, char *rublonApiServer);
int postMethod(pam_handle_t *pamh, char *secretKey, char *tId, char *selectedMethod, char *rublonApiServer, char *systemToken, bool onlyOneMethod);
int postVerifySSH(pam_handle_t *pamh, char *secretKey, char *transactionId, char *selectedMethod, char *rublonApiServer, char *systemToken, char **accessToken);
int postConfirmCode(pam_handle_t *pamh, char *secretKey, char *systemToken, char *transactionId, char *selectedMethod, char *rublonApiServer, bool onlyOneMethod);

View File

@ -81,6 +81,7 @@ int startRublon(pam_handle_t *pamh) {
char *accessToken = NULL;
cJSON *methods;
bool codeRequired = false;
struct ApplicationInfoStruct appInfo;
struct args *threadArgs = (struct args *)malloc(sizeof(struct args));
pam_get_user(pamh, &pamUser, NULL);
@ -94,8 +95,10 @@ int startRublon(pam_handle_t *pamh) {
asprintf(&userEmail, "%s%s%s", pamUser,"@",userDomain);
transactionId = NULL;
int initStatus = postInit(pamh, &methods, &transactionId , systemToken, secretKey, appUserId, userEmail, rublonApiServer);
int initStatus = postInit(pamh, &methods, &appInfo, &transactionId , systemToken, secretKey, appUserId, userEmail, rublonApiServer);
pam_prompt(pamh, PAM_TEXT_INFO, NULL, "\nRublon MFA for %s", appInfo.applicationName);
threadArgs->pamh = pamh;
threadArgs->transactionId = transactionId;
threadArgs->rublonApiServer = rublonApiServer;