-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux Daemon #586
Comments
Excellent, thanks @doktor1360! I've gone ahead and added this to the User Guide. Thanks again for sending this over! |
This is really handy, thank you for posting it. I do have one nitpick however. line 1
really needs to be
Otherwise the interpreter isn't invoked properly and the system returns a Exec format error. |
Updated the comment - must have been a copy/paste error, wasn't actually in the script - however, agreed... it won't work - bash won't like it all like that... Thx @KhasMek for spotting it! |
Can someone plz post equivalent commands for Ubuntu? |
This is a bash script, should be fine in Ubuntu |
Thank you for posting this! I've used your script as a starting point to set up a systemd .service unit and I thought I could pay back by posting it here. file: /lib/systemd/system/gophish.service
file: /root/gophish.sh
After everything is in place # chmod +x /root/gophish.sh, then # systemctl daemon-reload. After this use # systemctl normally to start/status/stop/etc. gophish. This will create/stamp separate logs each time the service (re)starts and continuously check for exits on failure in order to restart it. |
@doktor1360 Hi, for some reason when i try to use your code it returns an error with syntax for a (, Im using a TurnKey Linux distro based on debian, not sure if that makes a difference or not? |
@dudsan Your instructions worked for me on Ubuntu 16.04.05. Thank you. |
@dudsan Thank you for the systemd version. Most critically for any of this to work for me I needed to enable this to run on reboot (which is the entire point for me). Also for me (running the AWS Ubuntu 18.04 AMI the default install was NOT /opt/gophish - so it was important to change the path to the gophish binary to in the file /lib/systemd/system/gophish.service to: Thank you @doktor1360 for getting this party started. Sorry for posting to closed topic but the "enable" command is just too important to not say something |
Thanks to @dudsan for the unit script and the bash script. For those who want to run gophish with an unpriviliged user (not root) here is the unit script modified :
I have just added the User and Group directive plus the AmbientCapabilities to allow the user to bind to a privileged ports (below 1024). |
REF:gophish/gophish#586 Change directory to '/etc/init.d/' and make the file executable - 'chmod +x gophish'. Use 'chkconfig --add gophish' and 'chkconfig --levels [0123456] gophish on' to set and configure the init.d process - set the runlevels according to your system. I used 2345 for startup and shutdown scripts. You'll also need to create the '/var/log/gophish' directory accordingly for the log & error files, they'll be created auto-magically for ya when gophish is started.
In most distribution, pidof tool is in the PATH. I think it is better to simply use "pidof" command in the script instead of specify full path. |
I'm running into "service gophish does not support chkconfig" and wondering if someone can point me in the right direction. Fairly new to Linux so this is hurting my brain. I'm following the guide I found here. When I get to the steps that call for "sudo chkconfig gophish on" the not supported chkconfig pops up. I copied and pasted the script from the guide, which was copied and edited based on install location from here. Hoping someone can shed light on what I'm doing wrong. |
@longshanks24 - that guide appears to skip over and omit a coupa important commands. The 'chkconfig' command needs to 'add' the service and then set the run 'levels' before turning it 'on' if I'm reading all this correctly. Have a quick look at what I did - it's in the notes in the script at the top of this post... However, as always: |
Try copying the script from this page instead of the linked article. |
You just need to change the comments in the /etc/init.d to this #!/bin/bash
### BEGIN INIT INFO
# Provides: gophish
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Starts GoPhish
### END INIT INFO |
Is that possible to run gophish without command? like another web application |
update, works even on new version of linux 24.04. |
Knowing this issue (#337) is closed, however I thought I'd add this; not perfect by any means but works like a champ...
file : /etc/init.d/gophish
Change directory to '/etc/init.d/' and make the file executable - 'chmod +x gophish'. Use 'chkconfig --add gophish' and 'chkconfig --levels [0123456] gophish on' to set and configure the init.d process - set the runlevels according to your system. I used 2345 for startup and shutdown scripts. You'll also need to create the '/var/log/gophish' directory accordingly for the log & error files, they'll be created auto-magically for ya when gophish is started.
Hopefully this helps someone out...
The text was updated successfully, but these errors were encountered: