pysmb not working on linux ubuntu server 22.04 LTS - python-3.x

I have a telegram bot and there I implemented support for receiving files from a file server, in my case smb. The problem is that on the local everything works fine! You also need to keep in mind that I have Ubuntu 20.04 on my local. This is the only thing I haven't been able to check. And I checked the following points.
on the server, the python version was 3.10.4, on the local 3.9. Then i installed the latest version of python and the project works great!
and on the server, when trying to make a connection to SMB, there was an error:
File "bot/venv/lib/python3.10/site-packages/smb/utils/md4.py", line 251, in int_array2str
nstr = nstr + str(chr(i))
TypeError: 'U32' object cannot be interpreted as an integer
Then I found this problem on the Python discuss and tried to do the same. This error disappeared but another, more direct one came up. Now it's just AssertionError and points to the string with the connection attempt.
This is my code with connection:
conn = SMBConnection(
SMB_LOGIN, SMB_PASSWORD,
LOCAL_NAME, SMB_REMOTE_NAME, use_ntlm_v2=True
)
assert conn.connect(SMB_IP_ADDRESS, 139)
There doesn't seem to be anything remarkable here.
I also tried to change ports, put 445/135/137.
445:
ConnectionResetError: [Errno 104] Connection reset by peer
135 and 137:
timeout expired
A simple connection via the smbclient from the terminal also works.
I don't understand what exactly is the problem. The only thing left for me to check is to change the version of Linux. But I also do not believe that after that it will start working

Related

django.db.utils.DatabaseError: Error while trying to retrieve text for error ORA-01804

Q1. What versions are we using?
Ans.
Python 3.6.12
OS : CentOS 7 64-bit
DB : Oracle 18c
Django 2.2
cx_Oracle : 8.1.0
Q2. Describe the problem
Ans. While running server with "python3 manage.py runserver"
application is able to contact Oracle DB and show the Django Administration page and login also works.
But when we access the application using the Apache (HTTPD) based URL over secure SSL port, we do see the Django page and the admin page as well but Login to Admin page with Internal server error.
In the logs, we see
"django.db.utils.DatabaseError: Error while trying to retrieve text for error ORA-01804"
cx_oracle is otherwise able to connect to the database properly, another application is also using the same database behind the same httpd proxy and works fine
Q3. Show the directory listing where your Oracle Client libraries are installed (e.g. the Instant Client directory). Is it 64-bit or 32-bit?
Ans. 64-bit
Q4. Show what the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) is set to?
LD_LIBRARY_PATH=/srv/vol/db/oracle/product/18.0.0/dbhome_1/lib:/lib:/usr/lib
PATH=$ORACLE_HOME/bin:/srv/vol/db/oracle/product/18.0.0/dbhome_1/lib:$PATH
Q5. Show any Oracle environment variables set (e.g. ORACLE_HOME, ORACLE_BASE).
ORACLE_HOME=/srv/vol/db/oracle/product/18.0.0/dbhome_1
TNS_ADMIN=$ORACLE_HOME/network/admin
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
ORACLE_BASE=/srv/vol/db/oracle
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/lib
Any suggestions/help is highly appreciated.
Thank you
I found the problem
So I just removed all the variable declarations from /etc/sysconfig/httpd and checked, the application was still able to access the lib files, so these were now redundant.
Then undid all variable declarations done earlier in .localsh and .localrc files for the os users. To start from scratch, and go step by step to see where it breaks.
So now, cx_Oracle was looking for the lib files in wrong directory
$ORACLE_HOME/client_1/lib
instead of
$ORACLE_HOME/lib
DPI-1047: Cannot locate a 64-bit Oracle Client library: "$ORACLE_HOME/client_1/lib/libclntsh.so: cannot open shared object file: No such file or directory". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
I did not have any subfolder named "client_1" inside dbhome_1
so I just created a symlink client_1 that points to dbhome_1 (still unsure on this, but at least it works :) )
So, now, this error was gone but now again ORA-01804 was coming. 😑
I had read somewhere that this error can be fixed by adding "libociei.so" but I did not have one on my instance, so I generated it using these commands:-
mkdir -p $ORACLE_HOME/rdbms/install/instantclient/light
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk igenliboci
Then I just moved this libociei.so file from
$ORACLE_HOME/instantclient to $ORACLE_HOME/lib
Now there was a new error (so.. progress 😉 ):
ORA-12546 - TNS Permission Denied.
This was easy to solve 😀
I used this command to address this :-
setsebool -P httpd_can_network_connect on
And...... That was all! It worked.

Stumped by a node js ssl server error message "Assertion failed: (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 319"

Anyone have a clue as to what causes node js ssl server error "Assertion failed: (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 319"? This is happening on win 7 and linux ubuntu lts. Node 4.4. Only one google hit which claims the same or a similar error was "fixed" last november, but only for win xp.
I have not found an anwser as to why this happens, but I did find a way around it.
Commenting out "this.socket.end();" makes the error go away. Also, error only shows up with https server, not with http server.

Bad SSL Key When Trying to Use spark-ec2 script to launch cluster on EC2?

Version of Apache Spark: spark-1.2.1-bin-hadoop2.4
Platform: Ubuntu
I have been using the spark-1.2.1-bin-hadoop2.4/ec2/spark-ec2 script to create temporary clusters on ec2 for testing. All was working well.
Then I started to get the following error when trying to launch the cluster:
[Errno 185090050] _ssl.c:344: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
I have traced this back to the following line in the spark_ec2.py script:
conn = ec2.connect_to_region(opts.region)
Thus, the first time the script interacts with ec2, it is throwing this error. Spark is using the Python boto library (included with the Spark download) to make this call.
I assume the error I am getting is because of a bad cacert.pem file somewhere.
My question: which cacert.pem file gets used when I try to invoke the spark-ec2 script, and why is it not working?
I also had this error with spark-1.2.0-bin-hadoop2.4
SOLVED: the embedded boto library that comes with Spark found a ~/.boto config file I had for another non-Spark project (actually it was for the Google Cloud Services...GCS installed it, I had forgotten about it). That was screwing everything up.
As soon as I deleted the ~/.boto config file GCS installed, everything started working again for Spark!

Flyway connecting to a Database Cluster on Linux

I'm trying to connect to an Oracle Cluster using Flyway-Commandline. It works fine from DOS using:
# Ommitting the other params for brevity: jarDir, locations, user, password, driver etc
flyway clean -url="jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST = my_host_1)(PORT=8020))(ADDRESS=(PROTOCOL=TCP)(HOST = my_host_2)(PORT=8020))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MY_SERVICE_NAME)))"
But when I do the same on linux I get an error:
ERROR: FlywayException: Unable to obtain Jdbc connection from DataSource
ERROR: Occured in com.googlecode.flyway.core.util.jdbc.JdbcUtils.openConnection() at line 56
ERROR: Caused by oracle.net.ns.NetException: NL Exception was generated
ERROR: Occured in oracle.net.resolver.AddrResolution.resolveAddrTree() at line 626
It works fine on both platforms if I connect directly to one of the hosts directly using:
flyway clean -url=jdbc:oracle:thin:#my_host_1:8020/MY_SERVICE_NAME
The problem is that when one host in the cluster goes down, which happens regularly, this stops working.
This sounds like a problem with your Linux environment and not with Flyway itself.

Problem with node.js and Redis-server?

I intended to implement a chat feature in my rails application. After a brief backup work I found JUGGERNAUT is the best option. By going to through http://juggernaut.rubyforge.org/
I have successfully implemented the juggernaut in my application.
Presently I'm all set to implement chat feature and after a vigorous surfing over web I couldn't get good tutorial to implement it but I found the some part of implementation at http://www.golygon.com/2010/12/private-chat-room-in-ruby-on-rails-3-0/. I decided to follow it but initially to implement the tutorial we need to have redis server and node.js in our system. I installed both in my environment.
But I'm facing the following problem as follows:
If I try
redis-server, I'm getting the following error
[11440] 08 Aug 10:08:16 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[11440] 08 Aug 10:08:16 # Opening port: bind: Address already in use
and as per the tutorial
if I try
sudo node server.js, I'm getting the following error
[sudo] password for re5:
node.js:63
throw e;
^
Error: ENOENT, No such file or directory '/home/re5/Documents/task17/server.js'
at Object.openSync (fs:153:18)
at Object.readFileSync (fs:94:15)
at Module._loadScriptSync (node.js:468:39)
at Module.loadSync (node.js:338:12)
at Object.runMain (node.js:522:24)
at Array.<anonymous> (node.js:756:12)
at EventEmitter._tickCallback (node.js:55:22)
at node.js:773:9
As I don't know much about the redis and node I'm unable to figure out what was the problem regarding to this errors.
I'm stuck and couldn't go further as I'm not sure whether this two are configured perfectly or not.
currently I'm using rails 3.0.7 and ruby 1.8.7
Can any one help me out.
Well your first error is quite simple to understand.
[11440] 08 Aug 10:08:16 # Opening port: bind: Address already in use
This means that there is aready a server bound to that port and using it as a server, this can happen if you have other applications/servers running or if you try to have mutiple instances of the server run at one time. To fix this you need to stop the process and then start it back up again. You can usually do this by closing all of your terminal windows or using your operating systems process manager to terminate the process, if those methods dont work for you try shutting your computer down and starting it back up. If you are still unable to start the Redis server after this then there are some more steps we can take.
The next error is due to node.js not being able to find a file that it needs. Reinstalling node.js should fix this problem for you.
Let me know if this fixes your problem or if you need more help.

Resources