ruby sftp error password reset - ruby

I am troubleshooting a ruby script that queries a database, creates a csv, and sftps it to another server. The server the script is on is a rhel box, running ruby 1.87 I believe.
Here's the code that does the sftping:
Net::SFTP.start(sftp_site, sftp_user, :password => sftp_pswd) do |sftp|
sftp.upload!(local_filepath,sftp_dir+filename)
end
When executing the script, there is a curious message before it bombs out:
Password Reset
Your password has expired. You are required to change your password to proceed.
This script works on another server, but not this one. A user can sftp from the prompt on this machine. SELinux has been turned off, as it may have had some interference.
Anyway, point being, does anyone have any ideas?

It appeared to be a gem issue (though someone in networking may have worked some magic I am unaware of). The production server had older versions of the net/ssh and net/sftp gems. It had version 1.1.1 and version 1.1.2, respectively, and upgrading those gems to a later version fixed the issue.
Thanks for everyone who offered suggestions!

I would compare the sshd daemon settings (sshd_config), as there's likely an issue in the server that's not working. Perhaps interactive-keyboard authentication is turned on or something like that?

Related

odoo.sh ver. 14 WKHTMLTOPDF 0.12.25: Unable to call host printing service (HTTPError). How to circumvent this?

We're using odoo.sh platform with odoo14. The installed wkhtmltopdf is wkhtmltopdf_paas_wrapper 0.12.5, we can't upgrade to 0.12.6 because the access is very limited we cant use 'sudo' to apt-install. To temporarily solve this, we decided to use the 0.12.5 version. But it returns "Unable to call host printing service (HTTPError)" even with the right arguments. I've already tried it with the staging and production server, but still the same result. The ticket I've sent hasn't been replied to yet. This is so frustrating, I'm going bonkers...please help.
here's a screenshot:
ps: unrecognized argument error was intentional so I can display the available args. I've also crossed out the project domain. Thank you
Apparently, to properly execute the package, it should not have been "wkhtmltopdf" but instead "wkhtmltopdf.bin". I've overridden the ir_actions_report.py to change the package name. Here's the snippet of the original source code:
They shouldve known better, its a paid platform.

Start mySQL Server out of a Ruby program

I have a Linux server where I start a few Ruby programs during the day. The server is directly connected to the internet (no firewall) at a hoster and I wonder, if there is a way to start and close the mySQL server just before I update the db and close it afterwards. The target is, to have the mySQL server only open when it is needed. So I thought it might be a way to activate the port or the service directly out of Ruby.
thank you for answering,
Werner
You'd probably have to change the permissions to the database through ruby, then, doing whatever you want to do, and change the permissions back.
You could do that usig the mysql gem, connecting to the database and running the commands.
Then restart the process, and do the same thing but backwards
Honestly, I don't know why you would do that, and I wouldn't recommend someone to do that. But that would be my approach

psql password authentication failed for user on mac with no "pg_hba.conf"

i am really super frustrated/lost so I would appreciate any help I can get here. I have searched all over Google and SO and it seems nobody has had my problem yet.
Symptom: when i try to run psql in command line, or connect to any GUI postgresql client like Postgres or Postico, I get errors like FATAL: password authentication failed for user <myusername>. It asks me for my username where it shouldn't ask for one.
All the advice online goes along the lines of "find your pg_hba.conf file and add these magic lines to it", but here's the thing: I don't have a pg_hba.conf file! The normal location (on a Mac) seems to be in /etc/postgresql (like this) and this folder just plain doesnt exist on my mac even though I have installed all the other postgresql paraphernalia.
There's a remote possibility that my pg_hba.conf is in some other location but guess what! i need a running psql instance to find it! whoop-dee-heckin-do chicken and egg!
I notice these instructions are also like 3+ years out of date so there could be a change in the location or the filename and I have no idea what to find. Please help! I just want to connect to my sql database in localhost to learn web development.
thanks very much.

firebird, Bad File Descriptor/Your user name and password are not defined

I am trying to set up a test environment on my mac (os 10.12) and it requires Fishbowl/Firebird DB. No matter what I do i bounce back and forth between these two errors:
isql localhost:/Users/me/Fishbowl/database/data/EXAMPLE.FDB
which gives me:
Your user name and password are not defined. Ask your database
administrator to set up a Firebird login.
And anything to do using gsec to create user or change password:
And:
Statement failed, SQLSTATE = HY000 operating system directive stat
failed
-Bad file descriptor
This is supremely frustrating. Fishbowl Client itself seems to hit this DB just fine. I have chmod 770 the /tmp/firebird directory and even tried to chown the example.fdb file itself.
Can anyone tell me how I might hit this DB from my java app or commandline? Both ways produce these errors.
1) Your connection line starts with "localhost:". That means you user TCP/IP connection to reach the database server. And the database server is running in a separate process. That means chmod and chown should not matter as long as there is firebird daemon server running and listening at TCP port ( default is 3050 AFAIR, you can read the value of your installation in the text file firebird.conf ).
Indeed, there is so-called "embedded server" or "embedded mode" where the server is loaded as DLL/SO library into the application. But then the connection string can not have network protocol prefix, so that should NOT be your case.
2) You can check documentation at http://firebirdsql.org/manual/isql-switches.html to specify your user and password in the isql command line. The Firebird has one built-in superuser, namely "SYSDBA". Regarding the password it might be a bit complicated.... It differs by Firebird version and platform
2.0) whatever SYSDBA password might be set by the server installation, if server comes in a bundle with some application the said application can override it later. Then you would either have to contact application developers or try to remove the bundled FB and install your own vanilla one, risking rendering the application no more functioning.
2.1) Windows installation of FB 2.x sets the "default" SYSDBA password as "masterkey" (only 8 first symbols actually matter)
2.2) Linux installation of FB 2.x generates a random SYSDBA password and saves it into a text file in Firebird folder.
2.3) MacOS ? Don't know. Perhaps it is closer to Linux than to Windows. So try to find such a text file and try "masterkey"
2.4) With FB 3 the authentication methods and configuration was greatly overhauled, so... So it is quite hard to tell something specific. At least for me.
3) I don't know what Fishbowl ever is, but Google suggests this: https://www.fishbowlinventory.com/wiki/Fishbowl_for_Mac
If that is so, then check the bottomline examples at that page. They stress that you should sudo all those commands. That also makes sense because
3.1) Firebird daemon might have "trusted authentication" enabled, mapping FB users to Operating System users. On UNIX that would at least map SYSDBA to root. On Windows - to Administrator (however it is localized). This does not have to be enabled, but if it is then sudo UNIX command is exactly what makes applications run with OS superuser grants and might explain lack of user and password in the command line examples.
3.2) Firebird embedded server/mode work as part of an application process, and especially with CS (Classic Server) package on UNIX the command line utilities tend to fall into this mode. Then again it needs to be run as root to read highly sensitive data from Firebird Security Database, thus the need to sudo the command. Granted, I do not think your isql command might ever run in embedded mode - because you do specify "localhost:' prefix. But the example at the wiki link above - backup and restore - they use local connection strings, so they probably do run as embedded. So that might give you yet another hint - to try remove "localhost:" prefix from the connection string and to sudo isql rather than running it from regular user. It would hardly be a normal mode, but for test purposes why not.
Hope this helps.
PS. you might also try this Firebird IDE - it is simplistic, but again, for testing purposes... http://www.flamerobin.org/dokuwiki/wiki/manual

Twilio script runs locally but not on server?

I've been using twilio's library just fine locally (mac os x with XAMPP), but when I upload it to an amazon ec2 instance, the ability to send sms messages breaks.
$sms = $client->account->sms_messages->create(
"xxx-xxx-xxxx", $users[pnumber], "Testing!");
(the x's are numbers)
The above code seems to be what breaks it. I have uploaded the twilio library to the correct directory. I have also tried enabling all permissions to see if it was a permission issue.
I'm rather inexperienced to running things on my own server. Any guidance, guesses, and tips would be appreciated!
edit: Clarification - by "breaks", I mean the rest of the page does not load. If I add "echo "Hi";", it will not be printed. However, echo-ing before the code above works.
The problem was that I had not installed cURL onto my server yet. It was not included in my php installation. Thanks to Kevin Burke's advice, I ran it in command line and realized that it was calling a non-existant function. Some googling led to me installing curl, which fixed the problem. Thanks Kevin!

Resources