...
Expand |
---|
The ProVision WHOIS Server is a thin client for our REST API that listens on port 43 and accepts WHOIS requests that gets forwarded to our API. It is written in Python 3 using the socketserver module, and uses the ProVision endpoint /api/ipam/whois to receive all requests from the WHOIS server. The main business logic is located in services/WhoisService.php Running the Server manuallyThe Python requests library must first be installed: Ubuntu:sudo apt install -y python3-pip CentOS / Alma Linux:sudo yum install python3-pip OR sudo dnf install python3-pip The server is located at whois_server/main.py in the ProVision repository. Open main.py and update these variables: Running the server can be done with: sudo python3 main.py (We need root because we are binding to port 43) Quering the WHOIS server
Installing the WHOIS server as a serviceDifferent Linux distributions might have different ways to setup a service that runs on startup. systemdThere is a Unit file for systemd in the repository: whois_server/provision_whois.service that is used when a service is created in systemd env. 1) Edit the file to setup the proper path to the python server/file ExecStart=/usr/bin/python3 /root/whois_server/main.py WorkingDirectory=/root/whois_server/ 2) Copy the file to /etc/systemd/system (on CentOS this directory should be: /lib/systemd/system/) - sudo cp whois_server/provision_whois.service /etc/systemd/system/provision_whois.service 3) Start the service with service provision_whois start 4) Verify that is working with service provision_whois status and making a test query whois -h 127.0.0.1 ﹤query﹥ The systemd services are run as root, so there shouldn't be issues with binding to port 43. init.dThere is also init.d file located at whois_server/provision_whois 1) Edit the file to setup the proper path to the python server/file DAEMON_OPTS="/var/www/projects/whois/app.py" 2) Copy the file to /etc/init.d/ 3) chmod +x /etc/init.d/provision_whois -v 4) Verify that is working with service provision_whois status and making a test query whois -h 127.0.0.1 ﹤query﹥ |
...