Skip to content

Commit

Permalink
Merge pull request #32 from derekhiggins/devel
Browse files Browse the repository at this point in the history
Changes to services/config for Fedora 16 vpn setup
  • Loading branch information
Dan Prince committed Jan 30, 2012
2 parents cf694a2 + 18601c1 commit 32474f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/openvpn_config/linux_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def create_client_credentials(client_hostname, internal_vpn_ip, pptp_vpn_ip, cli

def start_openvpn

script = "/sbin/chkconfig openvpn on\n/etc/init.d/openvpn start\n"
script = "/sbin/chkconfig openvpn on\n/etc/init.d/openvpn start || systemctl start openvpn@#{@hostname}.service\n"
if Util::Ssh.run_cmd(@external_ip_addr, script, @ssh_as_user, @ssh_identity_file, @logger) then
if_down_count=0
1.upto(5) do
Expand Down
4 changes: 2 additions & 2 deletions lib/openvpn_config/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ def configure_vpn_server(hostname)
#{IO.read(@ssh_identity_file)}
EOF_CAT
chmod 600 /root/.ssh/id_rsa
/etc/init.d/openvpn stop
/etc/init.d/openvpn stop || systemctl stop [email protected]
clean
create_ca '#{hostname}'
create_server_key '#{hostname}'
create_server_config '#{hostname}' '#{@vpn_network}' '#{@vpn_subnet}'
init_server_etc_hosts '#{hostname}' '#{@domain_name}' '#{self.vpn_ipaddr}'
configure_iptables
start_dns_server
/etc/init.d/openvpn start
/etc/init.d/openvpn start || systemctl restart [email protected]
/sbin/chkconfig openvpn on
if [ -f /etc/redhat-release ]; then
Expand Down
6 changes: 4 additions & 2 deletions lib/openvpn_config/server_functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ function create_client_key {
cd $OPENVPN_CONFIG_DIR/easy-rsa
bash <<-EOF_BASH
. ./vars
export KEY_NAME=$CLIENT_NAME
export KEY_CN=$CLIENT_NAME
./pkitool $CLIENT_NAME &> /dev/null
EOF_BASH
[[ $? == 0 ]] || fail "Failed to create client key: $CLIENT_NAME."
Expand Down Expand Up @@ -156,7 +158,7 @@ function create_client_key {
echo "$CLIENT_INTERNAL_IP $CLIENT_NAME.$CLIENT_DOMAIN $CLIENT_NAME" >> /etc/hosts
fi

/etc/init.d/dnsmasq reload &> /dev/null || /etc/init.d/dnsmasq restart &> /dev/null || { echo "Failed to restart DnsMasq on $HOSTNAME."; return 1; }
/etc/init.d/dnsmasq reload &> /dev/null || /etc/init.d/dnsmasq restart &> /dev/null || systemctl restart dnsmasq.service &> /dev/null || { echo "Failed to restart DnsMasq on $HOSTNAME."; return 1; }

}

Expand All @@ -176,7 +178,7 @@ function start_dns_server {
fi

/sbin/chkconfig dnsmasq on
/etc/init.d/dnsmasq start
/etc/init.d/dnsmasq start || systemctl restart dnsmasq.service
#/sbin/service dnsmasq start

}
Expand Down

0 comments on commit 32474f5

Please sign in to comment.