Am configuring SNMPD to acts as proxy agent between SNMP manager(snmpb browser) and Network devices in centOS by referring https://net-snmp.sourceforge.io/wiki/index.php/Snmpd_proxy. After adding the <proxy -Cn testname -v 3 -u testUser -a MD5 -A "PasswordA" -x DES -X "PasswordX" -l authPriv ipaddress .1.3> in snmpd.config file, getting the below mentioned error on that line.
Error: failed to parse proxy args.
Kindly help me to resolve this.
Related
I connect to my work server (workserver1.com) from my local PC (localhost) using SSH and execute a bunch of commands on workserver1.
Below are the commands I execute using SSH
1) run script on server collect production data and put it in a txt
ssh -A workserver1.com 'python3 /usr/local/collect_data_online.py 2>&1 | tee /home/myname/out.txt'
$ please input your dynamic token: <manually input credential token generated every 15s>
2) filter lines I need and put in a dat file
ssh -A workserver1.com "grep 'my-keyword-cron' out.txt | grep -oP '({.*})' | tee workserver2.dat"
$ please input your dynamic token: <manually input credential token again>
3) send data collected in 2) and send to workserver2 which could only access through workserver1**
ssh -A workserver1.com 'curl workserver2.com --data-binary "#workserver2.dat" --compressed' "
$ please input your dynamic token: <manually input credential token 3rd time>
In each steps above , I actually created 3 completed different socket with workserver1.com. I got this info from running command below on remote server
$ ssh -A workserver1.com 'printenv | grep SSH'
SSH_CLIENT=10.126.192.xxx 58276 22
SSH_SESSION_ID=787878787878787878
SSH_TTY=/dev/pts/0
SSH_AUTH_SOCK=/tmp/ssh-XXXXKuJLEX/agent.29291
SSH_AUTH_CERT_SERIAL=666666666
SSH_AUTH_CERT_KEY=myname
# SSH_CONNECTION changes each time I make a SSH request to workserver1.com. so I need repeatedly input dynamic token manually
SSH_CONNECTION=10.126.192.xxx 58276 10.218.35.yyy 22
On my localhost I can also see SSH sock which used for the SSH connection
$ SSH_AUTH_SOCK=/tmp/ssh-localhost/agent.12345
My question is , is there a way to using single existing socket to avoid making multiple SSH connections and just input the dynamic token once. I hope I could use existing sock to interactively type commands to this SSH server and collect outpu/data as I want , just like on my localhost
What's in my mind is
1) socat can I run some command on localhost like
socat UNIX-CONNECT:$SSH_AUTH_SOCK,exec:'commands I want to execute' - ==> possible to get an interactive client&server shell?
2) is there any ssh option I could use ?
I am new to socat and not familiar with ssh except some commonly used commands
Thank you for your help in advance
The solution is open the first connection with '-M'
First use ControlMaster and ControlPath in ~/.ssh/config as below:
host *
ControlMaster auto
ControlPath ~/.ssh/ssh_mux_%h_%p_%r
And when connect toremote host the very first time, add '-M'
ssh -M $remotehost
Then in follow ssh connection with the same host you could just use
ssh $remotehost
I recently setup a new Windows 10 computer. On it I transfered scripts I am using elseware. The script involves sendemail.exe sending out an email using stunnel to gmail.
The script is as follows:
c:\Program Files (x86)\sendEmail>sendEmail.exe -l c:\temp\sendemail.log -t email#gmail.com -u "Email Subject" -m "Email Message" -s 127.0.0.1:6259 -f senderemail#gmail.com -xu senderemail -xp 123456789012345 -o tls=auto
The above commands fails with the following error: '''Aug 07 15:45:15 dell-pms sendEmail.exe[5196]: ERROR => Connection attempt to 127.0.0.1:6259 failed: IO::Socket::INET: connect: Unknown error'''
Replacing 127.0.0.1 with localhost fails.
Repeating the command but replacing the IP address (127.0.0.1) with the computer's IP address 192.168.16.76 works.
The hosts file is the default (everything remarked).
Any suggestion how to diagnose.
I am writing a function to take a port as input for tunneling as below.
function tunnel($x){
ssh -N -L localhost:$x:localhost:$x user#server.com
}
However I am getting an error as
(base) PS C:\Users\abc> tunnel(8888)
Bad local forwarding specification 'localhost:8888'
I want to run some commands on the remote machine. I am using psexec.exe in my application, when I try to run some command using -h and -s arguments as mentioned in the below command.
C:\psexec.exe -accepteula \\IPAddress -h -u "Username" -p pwd -s netstat -bno
When we provide a valid username and password it works with provided credentials, but when we provide username and password which is not valid it picks up -s and works I have done some research on -s it says -s = Run the remote process in the System account.
What exactly -s command do, when running above mentioned command on a particular remote machine with the arguments like -h and -s together is user passed Username and Password will be preferred over -s?
With -s your command is executed with the System account. The System account is a special Windows account used to run core Windows services (more info here and here); this account also has special privileges, for example access to registry keys that is denied to all other accounts.
As you can read in the linked docs:
This account does not have a password
so you don't have to specify a password when using the System account.
This is how PsExec works:
When you add the -s parameter the command is executed with the System account, so -u and -p parameters are ignored.
If you specify -h (but not -s), then account and password (-u and -p) are used to connect and execute the process with the account's elevated token (if available), so they must be correct.
If you specify -h together with -s then account and password (-u and -p) will NOT be used to connect, since the command will be executed with the System account anyway.
You can double check this behavior launching a program on a remote server and looking at the task manager of the remote machine: you will see that, using -s, the program will run under the System account, otherwise it will run under the user specified with -u.
For example if you run notepad with this command:
psexec \\remote_server -u domain\user -p correct_password -d -i -s cmd /c notepad.exe
or with this command:
psexec \\remote_server -u domain\user -p correct_password -d -i -s -h cmd /c notepad.exe
or with this command:
psexec \\remote_server -u domain\user -p wrong_password -d -i -s -h cmd /c notepad.exe
in all these three cases notepad is executed under the System account:
After apache rebuilt my cron jobs stopped working.
I used the following command:
wget -O - -q -t 1 http://example.com/cgi-bin/loki/autobonus.pl
Now my DC support suggests me to change the wget method to curl. What would be the correct value in this case?
-O - is equivalent to curl's default behavior, so that's easy.
-q is curl's -s (or --silent)
--retry N will substitute for wget's -t N
All in all:
curl -s --retry 1 http://example.com/cgi-bin/loki/autobonus.pl
try run change with the full path of wget
/usr/bin/wget -O - -q -t 1 http://example.com/cgi-bin/loki/autobonus.pl
you can find the full path with:
which wget
and more, check if you can reach the destination domain with ping or other methods:
ping example.com
Update:
based on the comments, seems to be caused by the line in /etc/hosts:
127.0.0.1 example.com #change example.com to the real domain
It seems that you have restricted options in terms that on the server where the cron should run you have the domain pinned to 127.0.0.1 but the virtual host configuration does not work with that.
What you can do is to let wget connect by IP but send the Host header so that the virtual host matching would work:
wget -O - -q -t 1 --header 'Host: example.com' http://xx.xx.35.162/cgi-bin/loki/autobonus.pl
Update
Also probably you don't need to run this over the web server, so why not just run:
perl /path/to/your/script/autobonus.pl