- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我想使用 PAM 对我的 C 网络应用程序的用户进行身份验证,并且我找到了一个 a nice PAM example在 Stack 上,我附在底部。问题是,在我的开发机器中,我有一个 PAM 设置使用的指纹读取器,如 /etc/pam.d/common-auth
中所示:
#%PAM-1.0
#
# This file is autogenerated by pam-config. All changes
# will be overwritten.
#
# Authentication-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
auth required pam_env.so
auth sufficient pam_fprint.so
auth optional pam_gnome_keyring.so
auth required pam_unix2.so
pam_fprint.so
是指纹读取器插件。当您正常登录时,扫描可能会失败并提示您输入密码。但是,sshd 守护进程根本不启动指纹,我想了解它是如何跳过它的,因为例如 /etc/pam.d/sshd
引用了 common-auth 模块,所以它必须拉它..
#%PAM-1.0
auth requisite pam_nologin.so
auth include common-auth
account requisite pam_nologin.so
account include common-account
password include common-password
session required pam_loginuid.so
session include common-session
session optional pam_lastlog.so silent noupdate showfailed
我已尝试从 C 程序中引用“sshd”方案,但它仍会启动指纹读取器。我想以某种方式在 C 中跳过指纹读取器并保留我的指纹读取器默认配置。
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <security/pam_appl.h>
#include <unistd.h>
// To build this:
// g++ test.cpp -lpam -o test
struct pam_response *reply;
//function used to get user input
int function_conversation(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr)
{
*resp = reply;
return PAM_SUCCESS;
}
int main(int argc, char** argv)
{
if(argc != 2) {
fprintf(stderr, "Usage: check_user <username>\n");
exit(1);
}
const char *username;
username = argv[1];
const struct pam_conv local_conversation = { function_conversation, NULL };
pam_handle_t *local_auth_handle = NULL; // this gets set by pam_start
int retval;
// local_auth_handle gets set based on the service
retval = pam_start("common-auth", username, &local_conversation, &local_auth_handle);
if (retval != PAM_SUCCESS)
{
std::cout << "pam_start returned " << retval << std::endl;
exit(retval);
}
reply = (struct pam_response *)malloc(sizeof(struct pam_response));
// *** Get the password by any method, or maybe it was passed into this function.
reply[0].resp = getpass("Password: ");
reply[0].resp_retcode = 0;
retval = pam_authenticate(local_auth_handle, 0);
if (retval != PAM_SUCCESS)
{
if (retval == PAM_AUTH_ERR)
{
std::cout << "Authentication failure." << std::endl;
}
else
{
std::cout << "pam_authenticate returned " << retval << std::endl;
}
exit(retval);
}
std::cout << "Authenticated." << std::endl;
retval = pam_end(local_auth_handle, retval);
if (retval != PAM_SUCCESS)
{
std::cout << "pam_end returned " << retval << std::endl;
exit(retval);
}
return retval;
}
最佳答案
我怀疑 sshd 是否真的跳过了那个模块。相反,我怀疑指纹识别器身份验证模块(明智地)正在检查身份验证用户是在本地系统上还是通过网络(它可以从 rhost
等 PAM 数据中找出来) ) 如果这是网络身份验证,则只是默默地不执行任何操作。您可以尝试查看源代码,看看它是否有这样的测试,或者尝试通过 pam_set_item
设置 PAM_RHOST
,看看是否会改变行为。
为了回答您的实际问题,我认为除了一个模块之外,没有办法告诉 PAM 运行特定的 PAM 组。做你想做的事情的预期方法是在 /etc/pam.d
中创建一个新的配置文件,该文件与你传递给 pam_start
的应用程序名称匹配em>不包含common-auth
,而是只包含您要运行的模块。
关于c - 跳过指纹读取器 PAM 模块以从 C 应用程序使用 PAM 进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10912459/
BizTalk 将内部 SFTP 测试的指纹视为ssh-rsa 2048 33:88:f0:ff:63:78:a9:2b:3f:09:cb:05:81:db:59:86 WinSCP 显示:ssh-e
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 4年前关闭。 Improve thi
我正在尝试实现 Android-6.0-marshmallow 中引入的指纹,但遇到了一个问题。 问题是当我尝试运行此处提供的示例代码时 android-FingerprintDialog 它不止一次
我正在寻找一种算法来匹配两个整数数组。例如: 引用: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 候选人: FF FF FF 01 02 03 FF
在 musicg 中,我可以通过以下代码比较 Wave 文件的指纹: double score = new FingerprintsSimilarity( new Wave("voice1.w
我的目标是实现第三方网站证书的 SHA1 指纹。我可以使用 openssl 成功获取它但是,当我尝试使用 python 代码实现它时,它并没有变得相同。使用 python 代码获取的 SHA1 指纹与
我正在编写一个脚本来查找大型图像库中的重复项。目前我正在做一个两遍过滤器,首先找到相同大小的文件,然后在 10240 字节的文件上执行 sha256 以获得具有相同大小的文件的指纹(代码 here )
我需要对 GitHub 进行 SSH key 审核,但我不确定如何找到我的 RSA key 指纹。我最初按照指南在 Linux 上生成 SSH key 。 我需要输入什么命令来查找我当前的 RSA k
对于历史,我有一个带有 OS debian 的本地 VM(Virtualbox),在这个 VM 中我开发了一个 Web 应用程序。我使用 ssh 协议(protocol)登录。 今天,我面临一个奇怪的
我正在使用带 sprockets 的中间人将我的 js 和 css 文件打包到一个文件中。这很好用。但是我想知道是否可以在中间人中启用 sprockets 的指纹功能。 例如我的文件 all.js,其
在 MVC 应用程序中,我需要验证客户端证书是否由特定 CA 签名/颁发。 我知道如何获取 Request.ClientCertificate和 X509Certificate2从中,但我无法弄清楚如
我正在开发一个 Android 应用程序,该应用程序将使用手机的指纹传感器作为扫描仪来验证候选人,以与数据库中已存储的指纹进行比较。我该怎么办? 最佳答案 Android 的指纹功能仅用于根据设备对用
我们正在整合 Universal App Links .该设置需要将名为 assetlinks.json 的文件上传到 Web 服务,以便验证关联。 为调试版本生成指纹时,使用默认的 debug.ke
我目前正努力为我正在开发的 Unity3d 应用程序提供一些安全性,我想添加验证 apk 文件未被某些补丁程序篡改。我知道如何从构建的应用程序(如 keytool)获取 keystore 指纹,但我很
我正在尝试将 android Fingerprint 实现到示例应用程序中。使用的密码未被识别为有效 - 但我不知道为什么,因为基于 android 文档,它应该受到支持。 密码建立在: return
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 6 年前。
我正在从 Google 获取 Google Play API key ,它要求输入 SHA1 指纹。我想知道什么是 SHA1 指纹?我还想知道是否可以从另一台计算机使用此 API key ? 最佳答案
我目前在非常轻量级(低处理器/低内存)的 Linux 设备上的 bash 脚本中使用 linux md5sum 命令来返回并记录单个目录中数千个名称相似的 32MB 文件的校验和。 md5sum ./
我正在尝试实现一种与我的后端服务器通信的方法,并确保我的后端仅在调用我的应用程序时才应答。 所以我的想法是,我只是将 SHA1/MD5 指纹与 HTTPS POST 请求一起发送,并在后端服务器上对其
这里有一些主题对如何查找相似图片非常有帮助。 我想做的是获取一张图片的指纹,在数码相机拍摄的不同照片上找出同一张照片。 SURF 算法似乎是独立于缩放、角度和其他失真的最佳方法。 我使用 OpenCV
我是一名优秀的程序员,十分优秀!