linux:networking:auto_openconnect

no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


linux:networking:auto_openconnect [2019/11/20 08:41] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== Always on openconnect ======
 +<WRAP center round alert 60%>
 +Saving passwords in plain text is bad!
 +</WRAP>
  
 +<code bash Cron>
 +* * * * * /root/oc.sh
 +</code>
 +
 +<code bash oc.sh>
 +#!/bin/bash
 +target=$1
 +count=$( ping -c 1 10.1.2.3 | grep icmp* | wc -l )
 +
 +if [ $count -eq 0 ]
 +then
 +    echo "VPN is down."
 +    echo "password" | sudo openconnect vpn.example.com -u username --passwd-on-stdin --no-cert-check
 +else
 +    echo "VPN is UP"
 +fi
 +</code>
 +
 +<code bash html>
 +<!DOCTYPE html>
 +        <head>
 +                <style>
 +.button {
 +    display: inline-block;
 +    text-align: center;
 +    vertical-align: middle;
 +    padding: 12px 24px;
 +    border: 1px solid #a12727;
 +    border-radius: 8px;
 +    background: #ff4a4a;
 +    background: -webkit-gradient(linear, left top, left bottom, from(#ff4a4a), to(#992727));
 +    background: -moz-linear-gradient(top, #ff4a4a, #992727);
 +    background: linear-gradient(to bottom, #ff4a4a, #992727);
 +    -webkit-box-shadow: #ff5959 0px 0px 40px 0px;
 +    -moz-box-shadow: #ff5959 0px 0px 40px 0px;
 +    box-shadow: #ff5959 0px 0px 40px 0px;
 +    text-shadow: #591717 1px 1px 1px;
 +    font: normal normal bold 20px arial;
 +    color: #ffffff;
 +    text-decoration: none;
 +}
 +.button:hover,
 +.button:focus {
 +    background: #ff5959;
 +    background: -webkit-gradient(linear, left top, left bottom, from(#ff5959), to(#b62f2f));
 +    background: -moz-linear-gradient(top, #ff5959, #b62f2f);
 +    background: linear-gradient(to bottom, #ff5959, #b62f2f);
 +    color: #ffffff;
 +    text-decoration: none;
 +}
 +.button:active {
 +    background: #982727;
 +    background: -webkit-gradient(linear, left top, left bottom, from(#982727), to(#982727));
 +    background: -moz-linear-gradient(top, #982727, #982727);
 +    background: linear-gradient(to bottom, #982727, #982727);
 +}
 +
 +
 +.button1 {
 +    display: inline-block;
 +    text-align: center;
 +    vertical-align: middle;
 +    padding: 12px 24px;
 +    border: 1px solid #258f25;
 +    border-radius: 8px;
 +    background: #3ce93c;
 +    background: -webkit-gradient(linear, left top, left bottom, from(#3ce93c), to(#258f25));
 +    background: -moz-linear-gradient(top, #3ce93c, #258f25);
 +    background: linear-gradient(to bottom, #3ce93c, #258f25);
 +    -webkit-box-shadow: #37d737 0px 0px 40px 0px;
 +    -moz-box-shadow: #37d737 0px 0px 40px 0px;
 +    box-shadow: #37d737 0px 0px 40px 0px;
 +    text-shadow: #175a17 1px 1px 1px;
 +    font: normal normal bold 20px arial;
 +    color: #ffffff;
 +    text-decoration: none;
 +}
 +.button1:hover,
 +.button1:focus {
 +    border: 1px solid #2eb32e;
 +    background: #48ff48;
 +    background: -webkit-gradient(linear, left top, left bottom, from(#48ff48), to(#2cac2c));
 +    background: -moz-linear-gradient(top, #48ff48, #2cac2c);
 +    background: linear-gradient(to bottom, #48ff48, #2cac2c);
 +    color: #ffffff;
 +    text-decoration: none;
 +}
 +.button1:active {
 +    background: #258f25;
 +    background: -webkit-gradient(linear, left top, left bottom, from(#258f25), to(#258f25));
 +    background: -moz-linear-gradient(top, #258f25, #258f25);
 +    background: linear-gradient(to bottom, #258f25, #258f25);
 +}
 +
 +                </style>
 +        </head>
 +<body>
 +<?php
 +$a = exec('ping -c 1 10.1.2.3',$a);
 +if (strlen($a)==0) {
 +?>
 +<a class="button" href="#">No connection</a>
 +<?php } else { ?>
 +<a class="button1" href="#">Connected</a>
 +<?php } ?>
 +</body>
 +</html>
 +</code>
  • linux/networking/auto_openconnect.txt
  • Last modified: 2019/11/20 08:41
  • by 127.0.0.1