|
1 | 1 | barracuda_file = barracudavpn_5.1.4_amd64.deb |
2 | | -key_directory = ~/.keys |
3 | | -key_path = $(key_directory)/barracuda-vpn-key_rsa |
4 | | -user_file_encrypted = vpn.user |
5 | | -pwd_file_encrypted = vpn.pwd |
| 2 | +key_directory = ~/.barracuda-vpn |
| 3 | +key_path = $(key_directory)/key_rsa |
| 4 | +credentials_path = $(key_directory)/credentials |
6 | 5 | zhell_path = ~/.zshrc |
7 | 6 |
|
8 | 7 | .PHONY: install # = Install the barracuda-vpn |
9 | 8 | install: |
10 | 9 | sudo dpkg -i $(barracuda_file) |
| 10 | + ./vpn-configure |
11 | 11 |
|
12 | | -.PHONY: credentials # = Create key and encrypted files for credentials using the key |
| 12 | +.PHONY: credentials # = Create the credentials file using a new key |
13 | 13 | credentials: |
14 | 14 | @ if [ "$(user)" = "" ] || [ "$(pwd)" = "" ]; then \ |
15 | 15 | echo "Missing parameters! Use 'make test user=value pwd=value'"; \ |
16 | 16 | exit 1; \ |
17 | 17 | fi |
18 | 18 | mkdir -p $(key_directory) |
19 | 19 | openssl genrsa -out $(key_path) 2048 |
20 | | - echo "$(user)" | openssl rsautl -inkey $(key_path) -encrypt > $(user_file_encrypted) |
21 | | - echo "$(pwd)" | openssl rsautl -inkey $(key_path) -encrypt > $(pwd_file_encrypted) |
| 20 | + echo "$(user)::$(pwd)" | openssl rsautl -inkey $(key_path) -encrypt > $(credentials_path) |
22 | 21 | sudo chown root:root $(key_path) |
23 | | - sudo chmod 600 $(key_path) |
| 22 | + sudo chmod 400 $(key_path) |
| 23 | + sudo chmod 400 $(credentials_path) |
| 24 | + |
| 25 | +.PHONY: show-credentials # = Decrypt and show the content of the credentials file |
| 26 | +show-credentials: |
| 27 | + sudo openssl rsautl -inkey $(key_path) -decrypt < $(credentials_path) |
24 | 28 |
|
25 | 29 | .PHONY: test # = Connect to the vpn and close the connection |
26 | 30 | test: |
27 | | - ./vpn-open $(key_path) |
| 31 | + ./vpn-open $(key_path) $(credentials_path) |
28 | 32 | ./vpn-close |
29 | 33 |
|
30 | 34 | .PHONY: clean # = Remove the encrypted files for credentials and the key |
31 | 35 | clean: |
32 | | - sudo rm $(user_file_encrypted) || true |
33 | | - sudo rm $(pwd_file_encrypted) || true |
| 36 | + sudo rm $(credentials_path) || true |
34 | 37 | sudo rm $(key_path) || true |
35 | 38 | rmdir --ignore-fail-on-non-empty $(key_directory) |
36 | 39 |
|
|
0 commit comments