postgresql ssh keyboard-interactive authentification - remote-access

I installed postgresql on a Windows Server 2007 and created a database in there.
As long as I work on local (localhost) there is no problem.
Now i want to remote access the created databases on my Mac using Postico.
I input the credentials and get the following error:
Can anyone tell me where I can solve this problem ?
Here is some follow-up info:
my pg_hba.conf already has the following line:
host all all 0.0.0.0/0 md5
my postgresql.conf has:
listen_addresses = "*" and #ssl = off (not sure if I have to turn it on).
finally, here is a screenshot of the credentials:

I figured it out:
The options of the pg_hba.conf & postgresql.conf were OK.
However newbies like me might not know the following:
Windows servers don't allow SSH natively - freeSSH helps with this
The SSH host is the machine you are trying to connect to, and thus, the SSH user is the user of the SSH connection, not the database user.
Last little comment :
While this seems natural to most users of this platform, I found this information to be quite hard to find on google for pgsql, especially since it is so basic (try to find the difference between Host and SSH host assuming you know nothing about it).
There are hardly any tutorials as to how to connect to a distant server using non-proprietary software without any codelines (as I don't understand DOS and terminal commands, i prefer not to use them).
It might be a good idea for someone with better understanding of the process to create a beginner tutorial on how to set up a connection to a database within a small company.
In case someone feels generous ... ;-)

Related

Oracle Cloud says it rotates SSH keys, but now locked out of my server. (Permission denied (publickey)

Sorry if this isn't clear I'm not really experienced with this, I had someone help me with the initial setup but they are stumped on this as well.
In November of last year I ran a modded Minecraft server using linux on oracle cloud. When I try to ssh to the server like I used to (ssh -i "C:\Users\jlfre\Documents\ssh-key-2021-11-05.key.txt" opc#...*) it said REMOTE HOST IDENTIFICAITON HAS CHANGED.
I took a screenshot of this and it also gave me "The fingerprint for the ECDSA key sent by the remote host is SHA256:+I1kII1Qv1o40PHHpA0dYhsgxlWnbyHsUSPCQiDhzDE"
I'm not sure exactly what I did after this but I messed with something and now it no longer shows that error message and instead responds with "Permission denied (publickey)" when I try to do the ssh -i command that I shared above.
Through a lot of searching I found an oracle page where it said that oracle rotated SSH keys for security, but from there I'm lost as to how to get back into my server.
They key I am trying to use to get in is the one I used when I first created the server, that I downloaded from oracle.
Thanks for any help.

PostgreSQL via pgAdmin III - Server Doesn't Listen

Our company has an old linux server that runs a few tomcat web applications. One of those applications is connecting to PostgreSQL. While I'm a C#.Net/Windows coder, I need to connect to this database from my computer using pGAdmin III (or any suggested equivalent). When attempting the connection, pgAdmin says Server Not Listening.
Without knowing much about linux I'm using WinSCP to connect to the file structure. I have ZERO documentation on the old apps, any data sources, or their data connections. I've been able to determine the following, assuming the location of the web app is actuallly legit and not some non-running copy.
PostgreSQL
In one app's connection information:
jdbc:postgresql://localhost:5432/somename
After some digging, I found the following possible instances of postgresql on the server file structure.
\etc\postgresql\8.3\main
\etc\postgresql\8.4\main
There's also \etc\postgresql-common with very different types of files in there.
If there are other instances or related folder, I am unaware and wouldn't know where to look. It's a labyrinthine beast.
I ensured in the config file for both that listening="*", which was supposed to be one of two fixes. It was already set to *, so assuming one of these is the right one, I should be good there.
I know that at least some instance of postgresql is turned on because the old app is running and fetching data, so that's the other of the two fixes.
pgAdmin
I heard in a separate thread here that reinstalling pgAdmin might solve the problem, but it did not. I tried with and without ssl.
Here is how I'm trying to set up the connection in pgAdmin III:
Name: SomeName
Host: I've tried a few combinations here. //servername/somename, or just //servername
Port: 5432 (matches what was expected, also the port from the connection)
Service: Blank
MaintenanceDB: I tried the default in pgadmin, postgres and the actual db I'm trying to connect to.
username & Password: the credentials from the connection info in the old app.
I'm getting the Server Doesn't Listen, suggesting that either it's not on (Well...some data source is on and working and the data in WEB-INF suggests it's postgresql), or it's not accepting TCP/IP connections, which it is according to the instances of postgresql I was able to find.
Long Story Short
At this point I'm assuming that one of the following is the problem...
The connection information I'm entering into postgreSQL is not being entered correctly, but I don't know what I'm doing wrong.
The source of the connection information (the web application) is bad/old/not from a running instance (and in this case I don't know how to tell, not in linux).
The instances of postgresql I found are not the instances it's using, and I have no idea how to find it.
Something's fishy network-wise, but since both my computer and the linux server are on the same network, it doesn't seem too likely.
Also, everyone, please document your stuff for the poor souls of the future. I greatly appreciate any assistance you are able to offer me.
You may want to use a tunnel:
ssh -L 5432:localhost:5432 user#server
After you log into the remote server, you'll have mapped port 5432 on your computer to the remote one. Then you can use pgAdmin to connect to your localhost on port 5432. Make sure you don't have anything running on this port on your computer.
Edit: Look at these examples on how to setup tunnels using putty

WinSCP: The requested name is valid, but no data of the requested type was found. Connection failed

I'm supposed to access a server, but when I use WinSCP with FTP protocol to log in, I just get a warning that
The requested name is valid, but no data of the requested type was found.
Connection failed.
I really have very little experience with working remotely on servers, or even logging into them. What are my alternatives?
This is the WSANO_DATA. error Quoting Microsoft documentation:
The usual example for this is a host name-to-address translation attempt ... which uses the DNS (Domain Name Server). An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable.
(This can possibly happen for newly registered domain names that are no fully setup yet.)
See:
https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA or
https://winscp.net/eng/docs/message_name_no_data
It could have been a temporary issue. Also make sure you specify your hostname without the leading ftp:// (though the latest version of WinSCP will strip it automatically).
You can find a very nice discussion on the same issue with WinSCP here
You can also try FileZilla or Putty
If you are typing your address like ftp://ftp.domain.com or things like that, remove the first part and just keep ftp.domain.com in your host address box.
You might want to consider PuTTY, which comes with a number of tools including a ssh client and a secure copy tool like WinSCP called pscp. Possibly even more valuable is the psftp client, which allows secure ftp to remote servers. PuTTY can be run from a usb drive, making it easy to carry with you to any computer, allowing you to remote into your server from all over the world.
You're probably using WinSCP to send or get files from/to the server, right? You might want to state that in your question. For that, you're probably better off with FileZilla. (You need the FileZilla client, not the Server)

FTP configuration for WordPress

I've installed a WordPress instance on a Linux server, and I need to give it FTP access in order to install plugins and execute automatic backup/restores. I've just installed vsftpd, and started the service, but now what?
How do I figure out/set what the username/pass is?
Should I allow anonymous access?
Is the hostname just 'localhost'?
Any advice would be appreciated. I've never messed with FTP on linux before. Thanks-
Your question is a little unclear because you don't specify what aspect of wordpress "wants" FTP access. If you got WP installed, you clearly have at least some access to the machine already. That said, I'll try to answer around that inclarity.
Your questions in order, then some general thoughts:
How do I figure out/set what the username/pass is?
Remember that the man page for a program is a good first stop. A good man page will also contain a FILES or "SEE ALSO" section near the bottom that will point you to relevant config files.
In this case, "man vsftpd" mentions /etc/vsftpd.conf, so you can then do "man vsftpd.conf" to get info on how to configure it.
VSFTPD is configurable, and can allow users to log in in several ways. In the man page, check out "guest_enable" and "guest_username", "local_enable" and "user_sub_token".
*The easiest route for your single user usage is probably configuring local_enable, then your username and password would be whatever it is in /etc/password.*
Should I allow anonymous access?
No. Since you're using this to admin your Wordpress, there's no reason anyone else should be using this FTP. VSFTPD has this off by default.
Is the hostname just 'localhost'?
Depends where you're coming from. 'localhost' maps back to the loopback, or the same physical machine you're on. So if you need to put ftp configuration information for Server A into a wordpress configuration file on Server A, then 'localhost' is perfectly acceptable. If you're trying to configure the pasv_addr_resolve/pasv_addr flag of VSFTPD, then no, you'll want to either pass in the fully qualified name of Server A (serverA.mydomain.com), or leave it off an rely on the IP address.
EDIT: I actually forgot the critical disclaimer to never send credentials over plain FTP. Plain old FTP (meaning not SFTP) sends your username and password in cleartext. I didn't install VSFTP and play with it, but you'll want to make sure that there is some form of encryption happening when you connect. Try hitting it with WinSCP (from windows) or sftp (from linux) to make sure you're getting an ecrypted SFTP, rather than plaintext FTP.
Apologies if you already knew that ;)
You would probably get better answers on server fault.
That said:
vsftp should use your local users by default, and drop you in that user's home directory on login.
disable anonymous access if you don't need it, I don't think wordpress will care but your server will be safer.
yes, or 127.0.0.1, or your public IP if you think you might split the front and back end some day.
WordPress does not natively support SFTP. You can get around this two ways:
chmod permissions in the appropriate directories to allow the normal, automatic update to work correctly. This is the approach most certain to work, as long as it doesn't trip over any local security policies.
Try hacking it in yourself. There have been any number of threads on this at the WordPress.org forums. Here is a recent one which is also talking about non-standard ports. Here is an article about how to try to get it working on Debian Lenny (which also addresses the non-standard port issue).

How do I secure a production server after inheriting it from the previous development vendor?

We received access to the environment, but I now need to go through the process of securing it so that the previous vendor can no longer access it, or the Web applications running on it. This is a Linux box running Ubuntu. I know I need to change the following passwords:
SSH
FTP
MySQL
Control Panel Admin
Primary Application Admin
However, how do I really know I've completely secured the system using best practices, and am I missing anything else that I need to do other than just changing passwords?
3 simple steps
Backup configurations / source files from HTTP / SQL tables
Reinstall operating system
Follow standard hardening steps on fresh OS
Regardless of who it was, they could have installed any old crap on there (rootkits) that you can't configure away.
You will probably get more responses at serverfault.com on these kinds of questions.
There are several things you can do to secure SSH by editing your sshd_config file which is usually in /etc/ssh/:
Disable Root Logins
PermitRootLogin no
Change the ssh port from Port 22
Port 9222
Manually specifying which accounts can login
AllowUsers Andrew,Jane,Doe
SecurityFocus has a good article about securing MySQL, although it's a bit dated.
The best thing you could do would be reinstall and make sure when you bring over files from the old system to the new that it is just data, and not executables that could be nasty. If this is to much, changing all the passwords, and watching the logs for a few weeks, as well as playing with iptables to block former vendor. Also given that it could have a rootkit at the kernel level its probably good idea to change that out, and also watch traffic coming out of the box fro something that might be going to the vendor. It really is a hassle to take someone else's machine and say that is safe now, I would go as far to say it is nearly impossible.
side note. This isn't really programming related so probably shouldn't be on this site.

Resources