If not given it is read from the SSH_AUTH_SOCK environment variable.
+ * Copyright (C) 2013 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
*
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
*
+ * Copyright (C) 2013 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
*
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
*
- * Provide keys via ssh-agent
+ * Path to ssh-agent socket
public_key_t *pubkey;
identification_t *id;
certificate_t *cert;
public_key_t *pubkey;
identification_t *id;
certificate_t *cert;
- char *agent;
-
- agent = getenv("SSH_AUTH_SOCK");
- if (!agent)
- {
- DBG1(DBG_CFG, "ssh-agent socket not found");
- exit(1);
- }
- privkey = lib->creds->create(lib->creds, CRED_PRIVATE_KEY,
- KEY_ANY, BUILD_AGENT_SOCKET, agent, BUILD_END);
+ privkey = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_ANY,
+ BUILD_AGENT_SOCKET, this->agent, BUILD_END);
if (!privkey)
{
DBG1(DBG_CFG, "failed to load private key from ssh-agent");
if (!privkey)
{
DBG1(DBG_CFG, "failed to load private key from ssh-agent");
this->identity = arg;
break;
case CMD_OPT_AGENT:
this->identity = arg;
break;
case CMD_OPT_AGENT:
+ this->agent = arg ?: getenv("SSH_AUTH_SOCK");
+ if (!this->agent)
+ {
+ DBG1(DBG_CFG, "no ssh-agent socket defined");
+ exit(1);
+ }
break;
default:
return FALSE;
break;
default:
return FALSE;
{
load_agent(this);
/* only do this once */
{
load_agent(this);
/* only do this once */
+ * Copyright (C) 2013 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
*
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
*
"trusted certificate, for authentication or trust chain validation", {}},
{ CMD_OPT_RSA, "rsa", required_argument, "path",
"RSA private key to use for authentication", {}},
"trusted certificate, for authentication or trust chain validation", {}},
{ CMD_OPT_RSA, "rsa", required_argument, "path",
"RSA private key to use for authentication", {}},
- { CMD_OPT_AGENT, "agent", no_argument, "",
- "use SSH agent for authentication", {}},
+ { CMD_OPT_AGENT, "agent", optional_argument, "socket",
+ "use SSH agent for authentication. If socket is not specified", {
+ "it is read from the SSH_AUTH_SOCK environment variable",
+ }},
{ CMD_OPT_LOCAL_TS, "local-ts", required_argument, "subnet",
"additional traffic selector to propose for our side", {}},
{ CMD_OPT_REMOTE_TS, "remote-ts", required_argument, "subnet",
{ CMD_OPT_LOCAL_TS, "local-ts", required_argument, "subnet",
"additional traffic selector to propose for our side", {}},
{ CMD_OPT_REMOTE_TS, "remote-ts", required_argument, "subnet",