gsettings proxy configuration out of sync with Network Manager GUI on RHEL/CentOS 8 - centos

I'm setting auto pac proxy settings (autoconfig-url) within a C++ program using gsettings and see that the Network Manager GUI Proxy Settings are out of sync with gsettings. In addition, after closing the Network Manager GUI it overrides the proxy settings in gsettings.
Steps to Reproduce
1a. Programmatically set gsettings (System call)
std::string cmd = "gsettings set org.gnome.system.proxy mode auto";
system(cmd.c_str());
cmd = "gsettings set org.gnome.system.proxy autoconfig-url http://1.2.3.4/proxy.pac";
system(cmd.c_str());
OR
1b. Programmatically set gsettings (GTK lib)
GSettings *settings;
settings = g_settings_new ("org.gnome.system.proxy");
g_settings_set_string(settings, "mode", "auto");
g_settings_set_string(settings, "autoconfig-url", "http://1.2.3.4/proxy.pac");
g_settings_sync();
Opened terminal and read back gsettings to verify
$ gsettings get org.gnome.system.proxy mode
'auto'
$ gsettings get org.gnome.system.proxy autoconfig-url
'http://1.2.3.4/proxy.pac'
Opened Network Manager GUI in Settings and saw not in sync with gsettings.
Close Network Manager GUI.
Read back gsettings to find that the gsettings proxy settings have been overwritten by closing Network Manager GUI. Even if no updates were made.
$ gsettings get org.gnome.system.proxy mode
'none'
$ gsettings get org.gnome.system.proxy autoconfig-url
''
I tested on Ubuntu 18.04 and 20.04 and I see the Network Manager GUI in sync with gsettings. I see this issue mainly on RHEL/CentOS 8.

Related

How to run vs code interactive window on a specified node

I use vscode on a remote server using the Remote Explorer tool. I am able to use the interactive window but the kernel runs by default on the login node that I connect to. In a terminal I can connect to an interactive compute node using qlogin -q short.qc. How can I make the interactive kernel use a compute node as opposed to the login node?

KeePassXC won't add keys the running SSH agent when started from the gnome shell

I am running on Pop!_OS so for most things this is likely an aquivalent of Ubuntu.
KeepassXC is installed and the SSH-Agent is enabled.
There is a keyphrase configured with a key and it works just like a charm when I start keepassxc from the terminal keepassxc log in and then I can see that ssh-add -l lists an additional key. It also vanishes once I close KeePassXC. Perfect!
Now I start keypassXC from the gnome shell, hit the super key, search for keepassXC and log into its vault. Looking at ssh-add -l in the terminal: Nothing. No keys added. 😔
Now I took a look at /usr/share/applications/org.keepassxc.KeePassXC.desktop and changed Terminal=false to true. No, sadly not that easy.
My guess that it has something to do how the gnome shell starts KeePassXC, but can't say for sure what the problem is. Anyone got a clue what that could be or how to take a shot at the problem?
I got the KeepassXC ssh agent working on Ubuntu 16.04.6 with Unity as the window manager.
The issue is that if the SSH_AUTH_SOCK environmental variable is not set before the window manager starts it is not available for programs started in the window manager.
Some distributions have a system for starting programs such as the ssh-agent before the window manager. On my distro I found that /etc/X11/Xsession.d/90x11-common_ssh-agent was starting ssh-agent. See this comment on a user help issue for KeepassXC for more information.
However I also found that GNOME Keyring was starting an ssh agent of its own. I had to disable this in the startup applications. I also checked that no shells startup scripts (ie. .bashrc .bash_profile .profile .config/fish/config.fish were trying to start the ssh-agent, as doing so would replace the one started before the window manager.
An interesting side note, the ttys, that you get to with Ctrl+Alt+F1, Ctrl+AltF2, etc., also do not have the SSH_AUTH_SOCK environmental variable set as they start up before the window manager. If you need it here you can add code to find and set the SSH_AUTH_SOCK. For the fish shell I added the following to ~/.config/fish/config.fish:
# Set SSH_AUTH_SOCK if not set.
if test -z "$SSH_AUTH_SOCK";
set -gx SSH_AUTH_SOCK (find /tmp/ -path "/tmp/ssh-*/agent.*" 2>/dev/null)
end
I also found that in the upcoming 2.6.0 release of KeepassXC (targeted for 3. April 2020), there will be an added settings to allow overriding, or settings the value to use for SSH_AUTH_SOCK. However as this changes each time ssh-agent starts you will either need to keep changing it or set-up a link that would point to the current sock.

Mobaxterm: how to prevent ssh session from exiting?

How do i stop this?
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
Network error: Software caused connection abort
It looks SSH keepalive setting has no effect there
If you are still looking for the answer like me, here you go!
Settings -> Configuration -> SSH -> SSH keepalive
Restart MobaXTerm after changing the setting for it to take effect.
https://superuser.com/a/1298536
In my case I have SSH keepalive option checked but this happens every now and then.
So what I do is.
Disable (uncheck) SSH keeaplive close MobaXterm
Open MobaXterm and check SSH keeaplive close MobaXterm (again)
Open MobaXterm enjoy the stability for a couple of weeks...
I am using a licensed version on a computer running Windows 10 Professinal version 20H2.
Both solutions posted above (by #helloworld & #jepachecoh) actually work but there may be need for extra work, so here are a few additions.
The two options above work if:
1. You're connecting to a host (destination server) that is running SSH (daemon) but doesn't have any session timeout configurations set for connecting SSH clients.
2. You're connecting to a host that already has SSH client timeout configuration set but the set value (on the remote host) is either higher than, or equal to the "keepalive" value you have set on your SSH client (like MobaXterm, Putty etc).
If the destination server's "SSH keepalive configurations for the clients" are set, they override your remote client SSH keepalive configurations, hence controlling the session timeouts.
To find out if there are any configs set on the destination server's SSH configurations, use the command below (as root, or a user with sudo privileges):
$ cat /etc/ssh/sshd_config | grep "ClientAlive"
The command above works on multiple Linux and Solaris flavours.
If you don't have admin access to the destination server, your Systems administrator may be managing your session timeouts irrespective of the "keepalive" parameters you set on your SSH client before connecting.
Lastly, if you are using VPN software, or connecting to a demilitarized zone (DMZ), sometimes the session timeouts are controlled at that level (firewall level), so involve your Network administrator.
Bottom line, love your administrators. :-)

How to set a remote connection to a Vagrant container using "Visual Studio Code Remote - SSH"?

I'm exploring the new set extensions called VSCode Remote Pack and I want to connect to a Vagrant container using the Remote Container extension. Using a Windows 10 OS, how could I do that?
I tried the extension but it requests me to have Docker installed, what I suppose from that is that it only works for Docker containers. But I wonder if somebody have already managed to connect to a Vagrant box.
This are the docs from the extension: https://code.visualstudio.com/docs/remote/containers
VS Code Remote containers currently only support Docker (its implementation executes docker commands). Please open a feature request if you would like to see other tools supported.
As an alternative, you could try using Remote SSH to connect to vagrant containers. That should work but will require some extra container setup
Sorry for updating this so late.
The solution was pretty simple, as #MnZrk commented, what it needs to be done for setting up the connection is the following:
Run vagrant ssh-config > some-file.txt. This will generate a file with the configuration to run using SSH. Here an example of that file:
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile C:/Users/User/project/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
ForwardX11 yes
Notice that the host name is default, you could rename it to whatever you want so you could identify it more easily.
Copy the content of some-file.txt inside your SSH configuration file. This file could be edit directly from vscode by pressing F1 and writing Remote-SSH: Open Configuration File..., then you select the file you use for ssh configuration. After that file opens, just copy the content of some-file.txt there.
Finally, just press again F1 and type Remote-SSH: Connect to Host..., choose the connection with the host name default or the want you wrote in the first step, and that's all.

Script for automatic turn ON/OFF git proxy (ECLIPSE)

I am quite beaten of turning ON/OFF the proxies every time I get home from University.
Moreover, I use Ubuntu, so the number of proxies I have to change are more. But I would specifically like to get an automatic way to turn ON/OFF the Egit proxy settings.
So, is there an automatic way to get executed bash commands, just clicking on a file?
Install this tool: gsettings and set a script with those entries
gsettings set org.gnome.system.proxy.socks host <host url>
gsettings set org.gnome.system.proxy.socks port <port>
gsettings set org.gnome.system.proxy mode 'manual'
# to disable proxy:
# gsettings set org.gnome.system.proxy mode 'none'
For a complete list of options to set checkout this link:
https://developer.gnome.org/ProxyConfiguration/