Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. pid = /var/run/stunnel.pid
  2. cert = /etc/stunnel/stunnel.pem
  3. client = no
  4. socket = a:SO_REUSEADDR=1
  5. socket = l:TCP_NODELAY=1
  6. socket = r:TCP_NODELAY=1
  7.  
  8. [openvpn]
  9. connect = $server_ip:4433
  10. accept = 443" > /etc/stunnel/stunnel.conf
  11. echo '#!/bin/bash
  12. #
  13. # Init Script to run stunnel in daemon mode at boot time.
  14. #
  15. # Author: Riccardo Riva - RPM S.r.l.
  16. # Revision 1.0 - 2010 November, 11
  17.  
  18. #====================================================================
  19. # Run level information:
  20. #
  21. # chkconfig: 2345 99 99
  22. # description: Secure Tunnel
  23. # processname: stunnel
  24. #
  25. # Run "/sbin/chkconfig --add stunnel" to add the Run levels.
  26. # This will setup the symlinks and set the process to run at boot.
  27. #====================================================================
  28.  
  29. #====================================================================
  30. # Paths and variables and system checks.
  31.  
  32. # Source function library
  33. . /etc/rc.d/init.d/functions
  34.  
  35. # Check that networking is up.
  36. #
  37. [ ${NETWORKING} ="yes" ] || exit 0
  38.  
  39. # Path to the executable.
  40. #
  41. SEXE=/usr/bin/stunnel
  42.  
  43. # Path to the configuration file.
  44. #
  45. CONF=/etc/stunnel/stunnel.conf
  46.  
  47. # Check the configuration file exists.
  48. #
  49. if [ ! -f $CONF ] ; then
  50. echo "The configuration file cannot be found!"
  51. exit 0
  52. fi
  53.  
  54. # Path to the lock file.
  55. #
  56. LOCK_FILE=/var/lock/subsys/stunnel
  57.  
  58. #====================================================================
  59.  
  60. # Run controls:
  61.  
  62. prog=$"stunnel"
  63.  
  64. RETVAL=0
  65.  
  66. # Start stunnel as daemon.
  67. #
  68. start() {
  69. if [ -f $LOCK_FILE ]; then
  70. echo "stunnel is already running!"
  71. exit 0
  72. else
  73. echo -n $"Starting $prog: "
  74. $SEXE $CONF
  75. fi
  76.  
  77. RETVAL=$?
  78. [ $RETVAL -eq 0 ] && success
  79. echo
  80. [ $RETVAL -eq 0 ] && touch $LOCK_FILE
  81. return $RETVAL
  82. }
  83.  
  84. # Stop stunnel.
  85. #
  86. stop() {
  87. if [ ! -f $LOCK_FILE ]; then
  88. echo "stunnel is not running!"
  89. exit 0
  90.  
  91. else
  92.  
  93. echo -n $"Shutting down $prog: "
  94. killproc stunnel
  95. RETVAL=$?
  96. [ $RETVAL -eq 0 ]
  97. rm -f $LOCK_FILE
  98. echo
  99. return $RETVAL
  100.  
  101. fi
  102. }
  103.  
  104. # See how we were called.
  105. case "$1" in
  106. start)
  107. start
  108. ;;
  109. stop)
  110. stop
  111. ;;
  112. restart)
  113. stop
  114. start
  115. ;;
  116. condrestart)
  117. if [ -f $LOCK_FILE ]; then
  118. stop
  119. start
  120. RETVAL=$?
  121. fi
  122. ;;
  123. status)
  124. status stunnel
  125. RETVAL=$?
  126. ;;
  127. *)
  128. echo $"Usage: $0 {start|stop|restart|condrestart|status}"
  129. RETVAL=1
  130. esac
  131.  
  132. exit $RETVAL
  133.  
  134. #--- End of file ---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement