Following is our python script
[root@cs-gnb-1-du-1-586d67658b-lc5bb bin]# cat httpsServer.py
import ssl
import socket
import threading
import os
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import ThreadingMixIn
change the current working directory to specified path
os.chdir('/')
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/ip':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write('Your IP address is %s' % self.client_address[0])
return
else:
return SimpleHTTPRequestHandler.do_GET(self)
class HTTPServerV6(HTTPServer):
address_family = socket.AF_INET6
class ThreadedHTTPServer(ThreadingMixIn, HTTPServerV6):
"""Handle requests in a separate thread."""
Seeing following crash
Traceback (most recent call last):
File "httpsServer.py", line 5, in
from BaseHTTPServer import HTTPServer
File "/usr/lib64/python2.7/BaseHTTPServer.py", line 81, in
import mimetools
File "/usr/lib64/python2.7/mimetools.py", line 6, in
import tempfile
2022-06-14:03-13-05:098633649 SelfMonitoring[60972]: Config: MONITORING_REBOOT_IND_LOCAL_FILE = "/tmp/rebootrequired.txt"
File "/usr/lib64/python2.7/tempfile.py", line 35, in
from random import Random as _Random
File "/usr/lib64/python2.7/random.py", line 879, in
_inst = Random()
File "/usr/lib64/python2.7/random.py", line 97, in init
self.seed(x)
File "/usr/lib64/python2.7/random.py", line 111, in seed
a = long(_hexlify(_urandom(16)), 16)
OSError: [Errno 1] Operation not permitted
Hi,
Following is our python script [root@cs-gnb-1-du-1-586d67658b-lc5bb bin]# cat httpsServer.py import ssl import socket import threading import os from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler from SocketServer import ThreadingMixIn
change the current working directory to specified path
os.chdir('/')
class MyHandler(SimpleHTTPRequestHandler): def do_GET(self): if self.path == '/ip': self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write('Your IP address is %s' % self.client_address[0]) return else: return SimpleHTTPRequestHandler.do_GET(self)
class HTTPServerV6(HTTPServer): address_family = socket.AF_INET6
class ThreadedHTTPServer(ThreadingMixIn, HTTPServerV6): """Handle requests in a separate thread."""
def main(): server = ThreadedHTTPServer(('::', 8080), MyHandler) server.socket = ssl.wrap_socket (server.socket, keyfile="/opt/gNB/cfg/client.key", certfile='/opt/gNB/cfg/client.crt', ca_certs='/opt/gNB/cfg/ca.pem', server_side=True, cert_reqs=ssl.CERT_REQUIRED) server.serve_forever()
if name == 'main': main()
Seeing following crash Traceback (most recent call last): File "httpsServer.py", line 5, in
from BaseHTTPServer import HTTPServer
File "/usr/lib64/python2.7/BaseHTTPServer.py", line 81, in
import mimetools
File "/usr/lib64/python2.7/mimetools.py", line 6, in
import tempfile
2022-06-14:03-13-05:098633649 SelfMonitoring[60972]: Config: MONITORING_REBOOT_IND_LOCAL_FILE = "/tmp/rebootrequired.txt"
File "/usr/lib64/python2.7/tempfile.py", line 35, in
from random import Random as _Random
File "/usr/lib64/python2.7/random .py", line 879, in
_inst = Random()
File "/usr/lib64/python2.7/random.py", line 97, in init
self.seed(x)
File "/usr/lib64/python2.7/random.py", line 111, in seed
a = long(_hexlify(_urandom(16)), 16)
OSError: [Errno 1] Operation not permitted
Python version :- Python 2.7.5
Need help why that crash is happening.