Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for tls-crypt #51

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ jobs:
username: ${{ secrets.OVPN_USERNAME }}
password: ${{ secrets.OVPN_PASSWORD }}
client_key: ${{ secrets.OVPN_CLIENT_KEY }}
tls_auth_key: ${{ secrets.OVPN_TLS_AUTH_KEY }}
tls_crypt_key: ${{ secrets.OVPN_TLS_AUTH_KEY }}
- name: Check if connected
run: curl -v http://172.20.4.173:8080
7 changes: 5 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ inputs:
description: "Password"
required: false
tls_auth_key:
description: "Pre-shared secret for TLS-auth HMAC signature"
description: "Pre-shared group key for TLS Auth"
required: false
tls_crypt_key:
description: "Pre-shared group key for TLS Crypt"
required: false
tls_crypt_v2_key:
description: "Pre-shared secret for tls-crypt-v2"
description: "Per-client key for TLS Crypt V2"
required: false
client_key:
description: "Local peer's private key"
Expand Down
7 changes: 7 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3176,6 +3176,7 @@ const run = (callback) => {
const password = core.getInput("password");
const clientKey = core.getInput("client_key");
const tlsAuthKey = core.getInput("tls_auth_key");
const tlsCryptKey = core.getInput("tls_crypt_key");
const tlsCryptV2Key = core.getInput("tls_crypt_v2_key");

if (!fs.existsSync(configFile)) {
Expand All @@ -3202,6 +3203,12 @@ const run = (callback) => {
fs.appendFileSync(configFile, "tls-auth ta.key 1\n");
fs.writeFileSync("ta.key", tlsAuthKey, { mode: 0o600 });
}

if (tlsCryptKey) {
fs.appendFileSync(configFile, "tls-crypt tc.key 1\n");
fs.writeFileSync("tc.key", tlsCryptKey, { mode: 0o600 });
}

if (tlsCryptV2Key) {
fs.appendFileSync(configFile, "tls-crypt-v2 tcv2.key 1\n");
fs.writeFileSync("tcv2.key", tlsCryptV2Key, { mode: 0o600 });
Expand Down
7 changes: 7 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const run = (callback) => {
const password = core.getInput("password");
const clientKey = core.getInput("client_key");
const tlsAuthKey = core.getInput("tls_auth_key");
const tlsCryptKey = core.getInput("tls_crypt_key");
const tlsCryptV2Key = core.getInput("tls_crypt_v2_key");

if (!fs.existsSync(configFile)) {
Expand All @@ -35,6 +36,12 @@ const run = (callback) => {
fs.appendFileSync(configFile, "tls-auth ta.key 1\n");
fs.writeFileSync("ta.key", tlsAuthKey, { mode: 0o600 });
}

if (tlsCryptKey) {
fs.appendFileSync(configFile, "tls-crypt tc.key 1\n");
fs.writeFileSync("tc.key", tlsCryptKey, { mode: 0o600 });
}

if (tlsCryptV2Key) {
fs.appendFileSync(configFile, "tls-crypt-v2 tcv2.key 1\n");
fs.writeFileSync("tcv2.key", tlsCryptV2Key, { mode: 0o600 });
Expand Down