svn post-commit Temporary failure in name resolution - apache

First, I have svn configured to be accessible via apache DAV.
Then I have a post-commit hook that tell jenkins continuous integration server that the repository has changed via a simple wget command (and make it build) :
/opt/local/bin/wget (many-options) https://jenkins.domain.tld/subversion/${UUID}/notifyCommit?rev=$REV >> $LOGFILE
The script checks wget return code, and then echos an error message and exit with 1 (so the svn client knows the commit failed).
The LOGFILE contains after a failure :
--2012-04-04 10:56:54-- https://jenkins.domain.tld/subversion/4d729FFF-FFFF-4fb8-b8b5-be083cf6fe96/notifyCommit?rev=302
Résolution de jenkins.domain.tld (jenkins.domain.tld)... échec: Temporary failure in name resolution.
wget : impossible de résoudre l'adresse de l'hôte «jenkins.domain.tld»
The host jenkins.domain.tld has been added to /etc/hosts to be sure that resolution can't fail, but I'm still having the issue.
Of course, I have checked the post-commit command from CLI, and it works.
I've added this line to the post-commit script :
/usr/bin/host jenkins.domain.tld >> $LOGFILE
And resolution works just fine... maybe a wget issue.
Just replaced wget call with a curl equivalent, same issue :
curl: (6) Couldn't resolve host 'jenkins.domain.tld'

Ok, not found the issue origin, but a solution (pretty ugly) :
Update: I solved it meanwhile by fully stopping apache, waiting for a moment, then starting it again. But that doesn't explain the root cause for this behaviour (and thus there's no satisfying solution). So I leave this open.
From : https://serverfault.com/questions/129772/php-gethostbyname-suddenly-no-longer-resolves-names-to-ips-when-run-in-apache

After upgrading to Ubuntu 14.04 LTS I had the same issue (not sure whether the upgrade was really related). However, I could solve it by adding explicit timeout configuration to wget in my post-commit hook:
wget \
--timeout=10 \
--dns-timeout=10 \
...

Related

PHP 8.1 Redis session handler issue

Warning: ini_set(): Session save handler "redis" cannot be found on my page where I have use the code as shown below
ini_set('session.save_handler', 'redis');
This code works fine if the PHP version is 7.4 but when I upgraded PHP to PHP8 or PHP8.1 it stops working and gives me a warning "Warning: ini_set(): Session save handler "redis" cannot be found"
Also when I run the phpinfo() I do not find any PHP extension for Redis which is visible in case of PHP7.4
It looks like redis extension isn't available at your php modules. Check by using this command:
php -m | grep redis
So if it's empty, you need to install and configure it properly:
Visit this link to check how to install php redis extension.
Open your php.ini file (php --ini to check location)
Check for extension_dir property and make sure it points to correct extensions directory.
Add this code below - extension=redis.so
Restart your PHP-FPM service
Now try it once more:
php -m | grep redis
Should return redis now. Now ini_set command should work!

How to use podman's ssh build flag?

I have been using the docker build --ssh flag to give builds access to my keys from ssh-agent.
When I try the same thing with podman it does not work. I am working on macOS Monterey 12.0.1. Intel chip. I have also reproduced this on Ubuntu and WSL2.
❯ podman --version
podman version 3.4.4
This is an example Dockerfile:
FROM python:3.10
RUN mkdir -p -m 0600 ~/.ssh \
&& ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh git clone git#github.com:ruarfff/a-private-repo-of-mine.git
When I run DOCKER_BUILDKIT=1 docker build --ssh default . it works i.e. the build succeeds, the repo is cloned and the ssh key is not baked into the image.
When I run podman build --ssh default . the build fails with:
git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: error building at STEP "RUN --mount=type=ssh git clone git#github.com:ruarfff/a-private-repo-of-mine.git": error while running runtime: exit status 128
I have just begun playing around with podman. Looking at the docs, that flag does appear to be supported. I have tried playing around with the format a little, specifying the id directly for example but no variation of specifying the flag or the mount has worked so far. Is there something about how podman works that I may be missing that explains this?
Adding this line as suggested in the comments:
RUN --mount=type=ssh ssh-add -l
Results in this error:
STEP 4/5: RUN --mount=type=ssh ssh-add -l
Could not open a connection to your authentication agent.
Error: error building at STEP "RUN --mount=type=ssh ssh-add -l": error while running runtime: exit status 2
Edit:
I belive this may have something to do with this issue in buildah. A fix has been merged but has not been released yet as far as I can see.
The error while running runtime: exit status 2 does not to me appear to be necessarily related to SSH or --ssh for podman build. It's hard to say really, and I've successfully used --ssh like you are trying to do, with some minor differences that I can't relate to the error.
I am also not sure ssh-add being run as part of building the container is what you really meant to do -- if you want it to talk to an agent, you need to have two environment variables being exported from the environment in which you run ssh-add, these define where to find the agent to talk to and are as follows:
SSH_AUTH_SOCK, specifying the path to a socket file that a program uses to communicate with the agent
SSH_AGENT_PID, specifying the PID of the agent
Again, without these two variables present in the set of exported environment variables, the agent is not discoverable and might as well not exist at all so ssh-add will fail.
Since your agent is probably running as part of the set of processes to which your podman build also belongs to, at the minimum the PID denoted by SSH_AGENT_PID should be valid in that namespace (meaning it's normally invalid in the set of processes that container building is isolated to, so defining the variable as part of building the container would be a mistake). Similar story with SSH_AUTH_SOCK -- the path to the socket file dumped by starting the agent program, would not normally refer to a file that exists in the mount namespace of the container being built.
Now, you can run both the agent and ssh-add as part of building a container, but ssh-add reads keys from ~/.ssh and if you had key files there as part of the container image being built you wouldn't need --ssh in the first place, would you?
The value of --ssh lies in allowing you to transfer your authority to talk to remote services defined through your keys on the host, to the otherwise very isolated container building procedure, through use of nothing else but an SSH agent designed for this very purpose. That removes the need to do things like copying key files into the container. They (keys) should also normally not be part of the built container, especially if they were only to be used during building. The agent, on the other hand, runs on the host, securely encapsulates the keys you add to it, and since the host is where you'd have your keys that's where you're supposed to run ssh-add at to add them to the agent.

Apache Airflow command not found with SSHOperator

I am trying to use the SSHOperator to SSH into a remote machine and run an external application through the command line. I have setup the SSH connection via the admin page.
This section of code is used to define the commands and the SSH connection to the external machine.
sshHook = SSHHook(ssh_conn_id='remote_comp')
command_1 ="""
cd /files/232-065/Rans
bash run.sh
"""
Where 'run.sh' runs the shell script:
#!/bin/sh
starccm+ -batch run_export.java Rans_Model.sim
Which simply runs the commercial software starccm+ with some options I have specified.
This section defines the task:
inlet_profile = SSHOperator(
task_id='inlet_profile',
ssh_hook=sshHook,
command=command_1
)
I have confirmed the SSH connection works by giving a simple 'ls' command and checking the output.
The error that I get is:
bash run.sh, error: run.sh: line 2: starccm+: command not found
The command in 'run.sh' works when I am logged into the machine (it does not require a GUI). This makes me think that there is a problem with the SSH session and it is not the same as the one that Apache Airflow logs into, but I am not sure how to solve this problem.
Does anyone have any experience with this?
There is no issue with SSH connection (at least from the error message). However, the issue is with starccm+ installation path.
Please check the installation path of starccm+ .
Check if the installation path is part of $PATH env variable
$ echo $PATH
If not, then install it in the standard locations like /bin or /usr/bin etc (provided they are included in $PATH variable), or export the installed director into PATH variable like this,
$ export PATH=$PATH:/<absolute_path>
It is not ideal but if you struggle with setting the path variable you can run starccm stating the full path like:
/directory/where/star/is/installed/starccm+ -batch run_export.java Rans_Model.sim

why ssh connection timed out in vscode?

I installed git instead of openssl to use Remote-SSH in VSCode.However,after I completed the config document and tried to connect to the remote host.I failed. The error info is showed in the below pic.error info
error info:
[11:27:12.631] remote-ssh#0.48.0
[11:27:12.632] win32 x64
[11:27:12.656] SSH Resolver called for "ssh-remote+23321", attempt 1
[11:27:12.659] SSH Resolver called for host: 23321
[11:27:12.659] Setting up SSH remote "23321"
[11:27:12.790] Using commit id "26076a4de974ead31f97692a0d32f90d735645c0" and quality "stable" for server
[11:27:12.798] Testing ssh with ssh -V
[11:27:13.099] ssh exited with code: 0
[11:27:13.100] Got stderr from ssh: OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
[11:27:13.128] Running script with connection command: ssh -T -D 49485 23321 bash
[11:27:13.132] Install and start server if needed
[11:27:13.151] Terminal shell path: C:\Windows\System32\cmd.exe
[11:27:30.151] Resolver error: Connecting with SSH timed out
[11:27:30.178] ------
I had the same problem but the above solutions didn't work with my setup,
but the following setting did work:
"remote.SSH.useLocalServer": false
I got this solution from github reported issues and fix
In my case, the problem was caused by a too long authentication process on the server-side.
Solved it by extending the Connect Timeout from 15 to 30 seconds.
Instructions:
open your vscode Command Palette (via keyboard shortcut or from the
View menu).
search for the Remote-SSH: Settings.
scroll till you find the Connect Timeout.
change it to a longer duration than 15 secs.
key F1
Remote-SSH: Settings
Connect Timeout: from 15 seconds to 60 seconds solve my connection issue
You can try the following approaches:
ssh to your remote server. Then run the following commands to clean data folder and bin folder under .vscode-server folder on the server:
cd ~/.vscode-server
rm data/* -rf
rm bin/* -rf
If step 1 does not work, ssh to your remote server and delete the entire .vscode-server folder with the following command:
rm -rf ~/.vscode-server
Please note that this will also remove the extensions that you installed on the server.
Downgrade the version of the remote-SSH extension in vscode. Look up the extension in the vscode interface, right click on that, and you will find the option "Install Another Version ...". Install the previous version of the current one. If it does not work keep downgrading the version.
I had the same problem before, I solved this by deleting "terminal.integrated.inheritEnv": false inside ~/.config/Code/User/setting.json
I found the solution here in this thread from user oreilm49:
https://github.com/microsoft/vscode-remote-release/issues/1137
in vscode settings :
search conpty and uncheck it
I had same issue, my problem was solved after changing settings in the json file:
I removed "terminal.integrated.inheritEnv": false inside ~/.config/Code/User/setting.json
I added "remote.SSH.useLocalServer": true inside ~/.config/Code/User/setting.json
It worked for me after so many different trials
This might be a very foolish solution but it actually works for me, so I will write it down in case any other people get into the same problem.
I made modifications to the config file for SSH, then all the trials for connection ran into the error of 'Connecting SSH timed out'. I tried many possible solutions but none of them solved my problem.
Then I just closed the VScode and restarted it. Then everything works.
I had a case of this. I my client (local computer) is a Mac, and I was connecting to Linux host. I just went to the setting "Remote Platform" under Remote.SSH settings, and explicitly told it that I am connecting to a Linux remote. After this, it started to work.
I had this issue because of version missmatch of client and server. After updating both to the same version, it worked for me.
The issue with me was timeout at first. I tried increasing the timeout in settings but then later found the issue was with "tar".
The vscode-server.tar.gz (probably a little change in the file name) was not able to install due to tar not being present in my host.
So I installed tar in the host as "yum install tar"
And then tried reconnecting to the server and it worked

Apache not starting after upgrading to a newer version. No errors anywhere

I had a working configuration of Apache 2.2.23 in an AIX 7 server for around 2 years and I am trying to upgrade it to 2.2.29.
I followed the official documentation to upgrade minor versions by using the ./config.nice file from the old directory and use it to config and install my new apache.
For some unknown reason after it is done when I start apache by ./apachectl -k start it returns nothing (as usual if the config is fine)
However when I do ps -eaf | grep apache nothing is shown, so it didn't run
I then tried ./apachectl -k restart, it says it is not running and the same problem repeats.
Since I backed up the old 2.2.23 folder, if I restore the folder back, it can start immediately.
I then further tested by simply installing 2.2.29 without applying any old configuration to it, so only default configuration is used. Much to my surprise the same problem still persist! Tried rebooting and commenting out LoadModules sentences but nothing works.
No errors on console, just one line of error complaining about SSL cache in error_log (which also happens in the working apache, so I think this error is not related), no errors anywhere...
Grateful if anyone could kindly shed some light on this. Much appreciated, thank you for reading.
Notes:
OS: AIX 7100-02-02
Working Apache: 2-2-23
Tried versions of Apache: 2-2-29 2-2-31
Openssl version: openssl.base 1.0.1.514
EDIT:
Further testing shows that if I configure the apache with nothing... (only ./configure --prefix=/opt/apache2) then at least it can start.
But when I use my config.nice from my old build which has the following:
"./configure" \
"--prefix=/opt/apache2" \
"--enable-rewrite=shared" \
"--enable-speling=shared" \
"--enable-ssl" \
"--enable-proxy" \
"--enable-proxy-ajp" \
"--enable-proxy-connect" \
"--enable-proxy-ftp" \
"--enable-proxy-http" \
"--enable-vhost-alias" \
"--enable-headers" \
"$#"
it cant start again...