LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Encription of a shell (https://www.linuxquestions.org/questions/red-hat-31/encription-of-a-shell-4175446699/)

h.dilshad 01-22-2013 02:27 AM

Encription of a shell
 
Hi,
I am using RHEL 6.1 serverand I just make a shell to start my jboss 5.1 application server. I have to add this shell in chkconfig also to autometically start/stop. when i run it "./jboss", it is working well but when I encrypt this file with SHC program, this is giving error. here is the code of my shell:


#!/bin/bash
# chkconfig: 345 20 80
# description: jbossAS daemon
# processname: jbossAS

# /etc/init.d/jbossAS

case "$1" in
start)
echo -e "Starting Jboss Application Server\n"
#To run it as root:
/opt/jboss-eap-5.1/jboss-as/bin/run.sh -b 0.0.0.0 > /dev/null 2>&1 &

;;
stop)
echo -e "Stopping Java Application Server\n"
#To run it as root:
kill -9 `pidof java`
;;

restart|force-reload)
java_pid=`pidof java`
if [ "$java_pid" != "" ]; then
$0 stop
sleep 1
fi
$0 start
;;

status)
java_pid=`pidof java`
if [ "$java_pid" != "" ]; then
echo "Jboss Application Server is Running with PID $java_pid"
else
echo "Jboss Application Server is Not Running"
fi
;;
*)
echo "Usage: /etc/init.d/jboss {start|stop|restart|status}"
exit 1
esac

exit 0
==========================================================================
after encryption with "shc -f <filename>", after this shc give me 2 files named jboss.x and jboss.x.c when i m trying "./jboss.x status". it returns,
./jboss.x status

[1]+ Stopped ./jboss.x status
and when check process. it shows:
# ps -ef |grep jboss
root 26186 25811 0 03:24 pts/1 00:00:00 ./jboss.x status
root 26187 26186 0 03:24 pts/1 00:00:00 [jboss.x] <defunct>
root 26191 25811 0 03:25 pts/1 00:00:00 grep jboss
=======================================================================
Please guide me where i done mistake........

unSpawn 01-22-2013 06:47 AM

Quote:

Originally Posted by h.dilshad (Post 4875229)
Please guide me where i done mistake........

IMHO right from the start by ignoring the provided bin/jboss_init_redhat.sh (or wheel re-invention-wise other solutions provided) and using SHC without any particular reason.


Quote:

Originally Posted by h.dilshad (Post 4875229)
I am using RHEL 6.1 server

...which is two updates behind. RHEL 6 has been at U3 for some time now.

h.dilshad 01-22-2013 06:55 AM

Quote:

Originally Posted by unSpawn (Post 4875364)
IMHO right from the start by ignoring the provided bin/jboss_init_redhat.sh (or wheel re-invention-wise other solutions provided) and using SHC without any particular reason.



...which is two updates behind. RHEL 6 has been at U3 for some time now.

Thanks unSpawn, Actually I want to hide my codes from my customers, that why I use SHC. thanks for ur support. But solved my problem with this command.
shc -r -T -f <file name>. Now it working.

unSpawn 01-22-2013 07:37 AM

Quote:

Originally Posted by h.dilshad (Post 4875369)
I want to hide my codes from my customers

It's not like you're "protecting" a password (see limitations) or whatever else super secret. That makes it unnecessary obfuscation (you're not thinking you can somehow bind your customers to you with such practices, right?) and that's IMHO against what Open Source Software stands for.
I don't see any valid and compelling reason to be doing this.

chrism01 01-22-2013 08:37 PM

This is a good HOWTO http://www.thegeekstuff.com/2012/05/...-shell-script/, but as it says twice(!)
Quote:

, please remember that a smart person can still generate the original shell script from the encrypted binary that was created by shc.
The 2nd comment remarks
Quote:

This tool encodes, it does not encrypt. It converts to binary and provides some nice features that make it
more secure.
I agree with unSpawn, this doesn't do what you think and is not secure. I wouldn't bother.


All times are GMT -5. The time now is 11:19 PM.