Open cnobile2012 opened 2 years ago
I found a fix for the second issue above.
This should be put at the start of the script right after the #!/usr/bin/python3
.
#!/usr/bin/python3
### BEGIN INIT INFO
# Provides: denyhosts
# Required-Start: $local_fs $remote_fs $syslog $named $network $time
# Required-Stop: $local_fs $remote_fs $syslog $named $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Activates/Deactivates the DenyHosts daemon
# Description: Activates/Deactivates the DenyHosts daemon to block ssh attempts
### END INIT INFO
# denyhosts Bring up/down the DenyHosts daemon
#
# chkconfig: 2345 98 02
# description: Activates/Deactivates the
# DenyHosts daemon to block ssh attempts
#
###############################################
You'll notice I moved the python imports below the comments for both REL and Ubuntu systems.
So instead of using # chkconfig --add denyhosts
which doesn't work on Ubuntu, use sudo update-rc.d denyhosts defaults
from within the /etc.init.d/
directory.
See https://help.ubuntu.com/community/UbuntuBootupHowto The docs are a bit old, but still seems to work even for Ubuntu 20.04
The package shared here in assets seems hard coded for python 2. I also seems very outdated. You may be interested in my comment for issue https://github.com/denyhosts/denyhosts/issues/213
Yup, the title says it all, however even after I physically moved it to the correct place (
/usr/local/lib/python3.8/dist-packages/
) it still gets this error when starting the daemon.$ sudo service denyhosts start Failed to start denyhosts.service: Unit denyhosts.service not found.
It does work if run manually:
sudo /usr/local/bin/daemon-control start
. See my comment below for a fix to this 2nd issue.I had to manually create the symlinks for
/etc/init.d/denyhosts
.Also, the daemon-control tries to use Python2.7, it should be using Python 3.x. I have installed Python 3.8.10
So sum up: