Skip to content

Instantly share code, notes, and snippets.

@giig982
Forked from laurenorsini/MakeOpenVPN.sh
Created November 18, 2016 15:23
Show Gist options
  • Select an option

  • Save giig982/01360a465802b7256e7ae245bdd89996 to your computer and use it in GitHub Desktop.

Select an option

Save giig982/01360a465802b7256e7ae245bdd89996 to your computer and use it in GitHub Desktop.

Revisions

  1. @laurenorsini laurenorsini revised this gist Apr 23, 2014. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -15,8 +15,7 @@ read NAME

    #1st Verify that client’s Public Key Exists
    if [ ! -f $NAME$CRT ]; then
    echo "[ERROR]: Client Public Key Certificate not found:
    $NAME$CRT"
    echo "[ERROR]: Client Public Key Certificate not found: $NAME$CRT"
    exit
    fi
    echo "Client’s cert found: $NAME$CR"
  2. @laurenorsini laurenorsini revised this gist Apr 23, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ echo "<tls-auth>" >> $NAME$FILEEXT
    cat $TA >> $NAME$FILEEXT
    echo "</tls-auth>" >> $NAME$FILEEXT

    echo "Done! $NAME$FILEEXT Successfully Created.
    echo "Done! $NAME$FILEEXT Successfully Created."

    #Script written by Eric Jodoin
    \ No newline at end of file
  3. @laurenorsini laurenorsini revised this gist Apr 23, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    @@ -0,0 +1,73 @@
    #!/bin/bash

    # Default Variable Declarations
  4. @laurenorsini laurenorsini revised this gist Apr 23, 2014. No changes.
  5. @laurenorsini laurenorsini revised this gist Apr 23, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ CA="ca.crt"
    TA="ta.key"

    #Ask for a Client name
    echo "Please enter an existing Client Name:"
    echo "Please enter an existing Client Name:"
    read NAME


  6. @laurenorsini laurenorsini revised this gist Apr 23, 2014. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -55,8 +55,7 @@ echo "</ca>" >> $NAME$FILEEXT

    #Next append the client Public Cert
    echo "<cert>" >> $NAME$FILEEXT
    cat $NAME$CRT | sed -ne '/-BEGIN CERTIFICATE-/,/-END
    CERTIFICATE-/p' >> $NAME$FILEEXT
    cat $NAME$CRT | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >> $NAME$FILEEXT
    echo "</cert>" >> $NAME$FILEEXT

    #Then, append the client Private Key
  7. @laurenorsini laurenorsini revised this gist Apr 23, 2014. 1 changed file with 73 additions and 73 deletions.
    146 changes: 73 additions & 73 deletions MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -1,75 +1,75 @@
    @@ -0,0 +1,73 @@
    +#!/bin/bash
    +
    +# Default Variable Declarations
    +DEFAULT="Default.txt"
    +FILEEXT=".ovpn"
    +CRT=".crt"
    +KEY=".3des.key"
    +CA="ca.crt"
    +TA="ta.key"
    +
    +#Ask for a Client name
    +echo "Please enter an existing Client Name:"
    +read NAME
    +
    +
    +#1st Verify that client’s Public Key Exists
    +if [ ! -f $NAME$CRT ]; then
    + echo "[ERROR]: Client Public Key Certificate not found:
    +$NAME$CRT"
    + exit
    +fi
    +echo "Client’s cert found: $NAME$CR"
    +
    +
    +#Then, verify that there is a private key for that client
    +if [ ! -f $NAME$KEY ]; then
    + echo "[ERROR]: Client 3des Private Key not found: $NAME$KEY"
    + exit
    +fi
    +echo "Client’s Private Key found: $NAME$KEY"
    +
    +#Confirm the CA public key exists
    +if [ ! -f $CA ]; then
    + echo "[ERROR]: CA Public Key not found: $CA"
    + exit
    +fi
    +echo "CA public Key found: $CA"
    +
    +#Confirm the tls-auth ta key file exists
    +if [ ! -f $TA ]; then
    + echo "[ERROR]: tls-auth Key not found: $TA"
    + exit
    +fi
    +echo "tls-auth Private Key found: $TA"
    +
    +#Ready to make a new .opvn file - Start by populating with the
    +default file
    +cat $DEFAULT > $NAME$FILEEXT
    +
    +#Now, append the CA Public Cert
    +echo "<ca>" >> $NAME$FILEEXT
    +cat $CA >> $NAME$FILEEXT
    +echo "</ca>" >> $NAME$FILEEXT
    +
    +#Next append the client Public Cert
    +echo "<cert>" >> $NAME$FILEEXT
    +cat $NAME$CRT | sed -ne '/-BEGIN CERTIFICATE-/,/-END
    +CERTIFICATE-/p' >> $NAME$FILEEXT
    +echo "</cert>" >> $NAME$FILEEXT
    +
    +#Then, append the client Private Key
    +echo "<key>" >> $NAME$FILEEXT
    +cat $NAME$KEY >> $NAME$FILEEXT
    +echo "</key>" >> $NAME$FILEEXT
    +
    +#Finally, append the TA Private Key
    +echo "<tls-auth>" >> $NAME$FILEEXT
    +cat $TA >> $NAME$FILEEXT
    +echo "</tls-auth>" >> $NAME$FILEEXT
    +
    +echo "Done! $NAME$FILEEXT Successfully Created.”
    +
    +#Script written by Eric Jodoin
    #!/bin/bash

    # Default Variable Declarations
    DEFAULT="Default.txt"
    FILEEXT=".ovpn"
    CRT=".crt"
    KEY=".3des.key"
    CA="ca.crt"
    TA="ta.key"

    #Ask for a Client name
    echo "Please enter an existing Client Name:"
    read NAME


    #1st Verify that client’s Public Key Exists
    if [ ! -f $NAME$CRT ]; then
    echo "[ERROR]: Client Public Key Certificate not found:
    $NAME$CRT"
    exit
    fi
    echo "Client’s cert found: $NAME$CR"


    #Then, verify that there is a private key for that client
    if [ ! -f $NAME$KEY ]; then
    echo "[ERROR]: Client 3des Private Key not found: $NAME$KEY"
    exit
    fi
    echo "Client’s Private Key found: $NAME$KEY"

    #Confirm the CA public key exists
    if [ ! -f $CA ]; then
    echo "[ERROR]: CA Public Key not found: $CA"
    exit
    fi
    echo "CA public Key found: $CA"

    #Confirm the tls-auth ta key file exists
    if [ ! -f $TA ]; then
    echo "[ERROR]: tls-auth Key not found: $TA"
    exit
    fi
    echo "tls-auth Private Key found: $TA"

    #Ready to make a new .opvn file - Start by populating with the
    default file
    cat $DEFAULT > $NAME$FILEEXT

    #Now, append the CA Public Cert
    echo "<ca>" >> $NAME$FILEEXT
    cat $CA >> $NAME$FILEEXT
    echo "</ca>" >> $NAME$FILEEXT

    #Next append the client Public Cert
    echo "<cert>" >> $NAME$FILEEXT
    cat $NAME$CRT | sed -ne '/-BEGIN CERTIFICATE-/,/-END
    CERTIFICATE-/p' >> $NAME$FILEEXT
    echo "</cert>" >> $NAME$FILEEXT

    #Then, append the client Private Key
    echo "<key>" >> $NAME$FILEEXT
    cat $NAME$KEY >> $NAME$FILEEXT
    echo "</key>" >> $NAME$FILEEXT

    #Finally, append the TA Private Key
    echo "<tls-auth>" >> $NAME$FILEEXT
    cat $TA >> $NAME$FILEEXT
    echo "</tls-auth>" >> $NAME$FILEEXT

    echo "Done! $NAME$FILEEXT Successfully Created.”
    #Script written by Eric Jodoin
    \ No newline at end of file
  8. @laurenorsini laurenorsini revised this gist Apr 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    +#!/bin/bash
    +
    +# Default Variable Declarations
    +DEFAULT="Defaults.txt"
    +DEFAULT="Default.txt"
    +FILEEXT=".ovpn"
    +CRT=".crt"
    +KEY=".3des.key"
  9. @laurenorsini laurenorsini revised this gist Apr 15, 2014. 1 changed file with 75 additions and 73 deletions.
    148 changes: 75 additions & 73 deletions MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -1,73 +1,75 @@
    #!/bin/bash

    # Default Variable Declarations
    DEFAULT="Defaults.txt"
    FILEEXT=".ovpn"
    CRT=".crt"
    KEY=".3des.key"
    CA="ca.crt"
    TA="ta.key"

    #Ask for a Client name
    echo "Please enter an existing Client Name:"
    read NAME


    #1st Verify that client’s Public Key Exists
    if [ ! -f $NAME$CRT ]; then
    echo "[ERROR]: Client Public Key Certificate not found:
    $NAME$CRT"
    exit
    fi
    echo "Client’s cert found: $NAME$CR"


    #Then, verify that there is a private key for that client
    if [ ! -f $NAME$KEY ]; then
    echo "[ERROR]: Client 3des Private Key not found: $NAME$KEY"
    exit
    fi
    echo "Client’s Private Key found: $NAME$KEY"

    #Confirm the CA public key exists
    if [ ! -f $CA ]; then
    echo "[ERROR]: CA Public Key not found: $CA"
    exit
    fi
    echo "CA public Key found: $CA"

    #Confirm the tls-auth ta key file exists
    if [ ! -f $TA ]; then
    echo "[ERROR]: tls-auth Key not found: $TA"
    exit
    fi
    echo "tls-auth Private Key found: $TA"

    #Ready to make a new .opvn file - Start by populating with the
    default file
    cat $DEFAULT > $NAME$FILEEXT

    #Now, append the CA Public Cert
    echo "<ca>" >> $NAME$FILEEXT
    cat $CA >> $NAME$FILEEXT
    echo "</ca>" >> $NAME$FILEEXT

    #Next append the client Public Cert
    echo "<cert>" >> $NAME$FILEEXT
    cat $NAME$CRT | sed -ne '/-BEGIN CERTIFICATE-/,/-END
    CERTIFICATE-/p' >> $NAME$FILEEXT
    echo "</cert>" >> $NAME$FILEEXT

    #Then, append the client Private Key
    echo "<key>" >> $NAME$FILEEXT
    cat $NAME$KEY >> $NAME$FILEEXT
    echo "</key>" >> $NAME$FILEEXT

    #Finally, append the TA Private Key
    echo "<tls-auth>" >> $NAME$FILEEXT
    cat $TA >> $NAME$FILEEXT
    echo "</tls-auth>" >> $NAME$FILEEXT

    echo "Done! $NAME$FILEEXT Successfully Created.”
    #Script written by Eric Jodoin
    @@ -0,0 +1,73 @@
    +#!/bin/bash
    +
    +# Default Variable Declarations
    +DEFAULT="Defaults.txt"
    +FILEEXT=".ovpn"
    +CRT=".crt"
    +KEY=".3des.key"
    +CA="ca.crt"
    +TA="ta.key"
    +
    +#Ask for a Client name
    +echo "Please enter an existing Client Name:"
    +read NAME
    +
    +
    +#1st Verify that client’s Public Key Exists
    +if [ ! -f $NAME$CRT ]; then
    + echo "[ERROR]: Client Public Key Certificate not found:
    +$NAME$CRT"
    + exit
    +fi
    +echo "Client’s cert found: $NAME$CR"
    +
    +
    +#Then, verify that there is a private key for that client
    +if [ ! -f $NAME$KEY ]; then
    + echo "[ERROR]: Client 3des Private Key not found: $NAME$KEY"
    + exit
    +fi
    +echo "Client’s Private Key found: $NAME$KEY"
    +
    +#Confirm the CA public key exists
    +if [ ! -f $CA ]; then
    + echo "[ERROR]: CA Public Key not found: $CA"
    + exit
    +fi
    +echo "CA public Key found: $CA"
    +
    +#Confirm the tls-auth ta key file exists
    +if [ ! -f $TA ]; then
    + echo "[ERROR]: tls-auth Key not found: $TA"
    + exit
    +fi
    +echo "tls-auth Private Key found: $TA"
    +
    +#Ready to make a new .opvn file - Start by populating with the
    +default file
    +cat $DEFAULT > $NAME$FILEEXT
    +
    +#Now, append the CA Public Cert
    +echo "<ca>" >> $NAME$FILEEXT
    +cat $CA >> $NAME$FILEEXT
    +echo "</ca>" >> $NAME$FILEEXT
    +
    +#Next append the client Public Cert
    +echo "<cert>" >> $NAME$FILEEXT
    +cat $NAME$CRT | sed -ne '/-BEGIN CERTIFICATE-/,/-END
    +CERTIFICATE-/p' >> $NAME$FILEEXT
    +echo "</cert>" >> $NAME$FILEEXT
    +
    +#Then, append the client Private Key
    +echo "<key>" >> $NAME$FILEEXT
    +cat $NAME$KEY >> $NAME$FILEEXT
    +echo "</key>" >> $NAME$FILEEXT
    +
    +#Finally, append the TA Private Key
    +echo "<tls-auth>" >> $NAME$FILEEXT
    +cat $TA >> $NAME$FILEEXT
    +echo "</tls-auth>" >> $NAME$FILEEXT
    +
    +echo "Done! $NAME$FILEEXT Successfully Created.”
    +
    +#Script written by Eric Jodoin
    \ No newline at end of file
  10. @laurenorsini laurenorsini created this gist Apr 7, 2014.
    73 changes: 73 additions & 0 deletions MakeOpenVPN.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,73 @@
    #!/bin/bash

    # Default Variable Declarations
    DEFAULT="Defaults.txt"
    FILEEXT=".ovpn"
    CRT=".crt"
    KEY=".3des.key"
    CA="ca.crt"
    TA="ta.key"

    #Ask for a Client name
    echo "Please enter an existing Client Name:"
    read NAME


    #1st Verify that client’s Public Key Exists
    if [ ! -f $NAME$CRT ]; then
    echo "[ERROR]: Client Public Key Certificate not found:
    $NAME$CRT"
    exit
    fi
    echo "Client’s cert found: $NAME$CR"


    #Then, verify that there is a private key for that client
    if [ ! -f $NAME$KEY ]; then
    echo "[ERROR]: Client 3des Private Key not found: $NAME$KEY"
    exit
    fi
    echo "Client’s Private Key found: $NAME$KEY"

    #Confirm the CA public key exists
    if [ ! -f $CA ]; then
    echo "[ERROR]: CA Public Key not found: $CA"
    exit
    fi
    echo "CA public Key found: $CA"

    #Confirm the tls-auth ta key file exists
    if [ ! -f $TA ]; then
    echo "[ERROR]: tls-auth Key not found: $TA"
    exit
    fi
    echo "tls-auth Private Key found: $TA"

    #Ready to make a new .opvn file - Start by populating with the
    default file
    cat $DEFAULT > $NAME$FILEEXT

    #Now, append the CA Public Cert
    echo "<ca>" >> $NAME$FILEEXT
    cat $CA >> $NAME$FILEEXT
    echo "</ca>" >> $NAME$FILEEXT

    #Next append the client Public Cert
    echo "<cert>" >> $NAME$FILEEXT
    cat $NAME$CRT | sed -ne '/-BEGIN CERTIFICATE-/,/-END
    CERTIFICATE-/p' >> $NAME$FILEEXT
    echo "</cert>" >> $NAME$FILEEXT

    #Then, append the client Private Key
    echo "<key>" >> $NAME$FILEEXT
    cat $NAME$KEY >> $NAME$FILEEXT
    echo "</key>" >> $NAME$FILEEXT

    #Finally, append the TA Private Key
    echo "<tls-auth>" >> $NAME$FILEEXT
    cat $TA >> $NAME$FILEEXT
    echo "</tls-auth>" >> $NAME$FILEEXT

    echo "Done! $NAME$FILEEXT Successfully Created.”
    #Script written by Eric Jodoin