Score:0

forwarding agent via Apache http

tg flag

In my web application (Apache httpd) at Centos 7, I'm making an SSH connection with forward agent

example:

ssh -A $user@$proxyIP $user@DestinationIP ls -l

if I want it to run in the terminal of Apache user, i got pass that commands:

ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-zDrTcmfTt6W6/agent.5034; export SSH_AUTH_SOCK;
SSH_AGENT_PID=5035; export SSH_AGENT_PID;
ssh-add /usr/share/httpd/.ssh/id_rsa

and after this action, using the private key, I can connect to the destination host through terminal. Problem starts, when i try to make connection using website. Bash script(triggered by website code) do not set environment variables SSH_AUTH and SSH_AGENT_PID declared in it, so i get announcment:

Permission denied, please try again. Received disconnect from $DestinationIP port 22:2: Too many authentication

i tried to add envs permanently by pasting it to

/usr/share/httpd/.profile

but such action works for normal user (/home/$user/.profile), but not for apache user.

the second attempt was to add this code to

/etc/sysconfig/httpd

but after restart apache, it doesnt work too.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.