Merge ~gary-wzl77/snappy-hwe-snaps/+git/easy-openvpn:snap-configuration into ~snappy-hwe-team/snappy-hwe-snaps/+git/easy-openvpn:master

Proposed by Gary.Wang
Status: Merged
Approved by: Simon Fels
Approved revision: edab983b093cebffd1d2e93ddae6c11a20775e90
Merged at revision: 52d16d16aa0347f567ce32ffd8eff6d5c37f5094
Proposed branch: ~gary-wzl77/snappy-hwe-snaps/+git/easy-openvpn:snap-configuration
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/easy-openvpn:master
Diff against target: 238 lines (+40/-32)
12 files modified
README.md (+3/-3)
bin/configure (+10/-3)
bin/help (+6/-6)
spread/main/add_client/task.yaml (+1/-1)
spread/main/change_natdevice/task.yaml (+2/-2)
spread/main/connect_server/task.yaml (+1/-1)
spread/main/hooks/task.yaml (+10/-9)
spread/main/launch_server/task.yaml (+1/-1)
spread/main/monitor_status/task.yaml (+1/-1)
spread/main/revoke_after_connection/task.yaml (+1/-1)
spread/main/revoke_client/task.yaml (+1/-1)
spread/main/setup_server/task.yaml (+3/-3)
Reviewer Review Type Date Requested Status
Simon Fels Approve
System Enablement Bot continuous-integration Approve
Roberto Mier Escandon (community) Approve
Alfonso Sanchez-Beato Approve
Review via email: mp+330724@code.launchpad.net

Commit message

Adjust snap configuration key name to "<category>.<name>".

Description of the change

Adjust snap configuration key name to "<category>.<name>".

To post a comment you must log in.
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

LGTM

review: Approve
Revision history for this message
Roberto Mier Escandon (rmescandon) wrote :

lgtm

review: Approve
Revision history for this message
Simon Fels (morphis) wrote :

A few last comments here.

review: Needs Fixing
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Simon Fels (morphis) wrote :

LGTM

review: Approve
Revision history for this message
Simon Fels (morphis) wrote :

Not top-approving yet as Gary wanted to merge the documentation MP for easy-openvpn first.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/README.md b/README.md
index e5c7630..6a6bbc1 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ If internet connection is over ethernet, you can skip natdevice setup since defa
34While a wireless connection is established, you need to set it to 'wlan0' accordingly.34While a wireless connection is established, you need to set it to 'wlan0' accordingly.
35Note: This fits the scenario where people usually setup a wireless connection on ubuntu core at the first boot.35Note: This fits the scenario where people usually setup a wireless connection on ubuntu core at the first boot.
3636
37 $ sudo snap set easy-openvpn natdevice=wlan037 $ sudo snap set easy-openvpn server.natdevice=wlan0
3838
39Setup an openvpn server with host machine IP address39Setup an openvpn server with host machine IP address
4040
@@ -52,8 +52,8 @@ and update the mount namespaces of the snap in-place without any processes
52restarting or any other change after connecting interfaces above. But to be safe,52restarting or any other change after connecting interfaces above. But to be safe,
53we could reload the snap manually with the following commands:53we could reload the snap manually with the following commands:
5454
55 $ sudo disable easy-openvpn55 $ sudo snap disable easy-openvpn
56 $ sudo enable easy-openvpn56 $ sudo snap enable easy-openvpn
5757
58## Use58## Use
5959
diff --git a/bin/configure b/bin/configure
index d1b6d0f..8793b5d 100755
--- a/bin/configure
+++ b/bin/configure
@@ -23,16 +23,23 @@ if ! debug=$(snapctl get debug); then
23 exit 123 exit 1
24fi24fi
2525
26if ! nopasswd=$(snapctl get nopasswd); then26if ! nopasswd=$(snapctl get server.no-password); then
27 echo "Failed to get nopasswd option."27 echo "Failed to get nopasswd option."
28 exit 128 exit 1
29fi29fi
3030
31if ! natdevice=$(snapctl get natdevice); then31if ! natdevice=$(snapctl get server.natdevice); then
32 echo "Failed to get natdevice option."32 echo "Failed to get natdevice option."
33 exit 133 exit 1
34fi34fi
3535
36# docker-openvpn is only in favor of '1/0', instead of 'true/false'.
37if [ "$debug" = "true" ]; then
38 debug=1
39elif [ "$debug" = "false" ]; then
40 debug=0
41fi
42
36cat << EOF > $PROFILE43cat << EOF > $PROFILE
37export OPENVPN=$SNAP_DATA/openvpn44export OPENVPN=$SNAP_DATA/openvpn
38export EASYRSA=$SNAP/usr/local/easyrsa45export EASYRSA=$SNAP/usr/local/easyrsa
@@ -46,7 +53,7 @@ EOF
4653
47# Set default domain common name and call easy-rsa explicitly in batch mode.54# Set default domain common name and call easy-rsa explicitly in batch mode.
48# It's helpful to execute spread test in non-interactive mode.55# It's helpful to execute spread test in non-interactive mode.
49if [ "$nopasswd" = "1" ]; then56if [ "$nopasswd" = "true" ]; then
50 # Ugly, set env var and pass it to ovpn.57 # Ugly, set env var and pass it to ovpn.
51 # export nopass=1 makes more sense but this is the least code changes.58 # export nopass=1 makes more sense but this is the least code changes.
52 cat << EOF >> $PROFILE59 cat << EOF >> $PROFILE
diff --git a/bin/help b/bin/help
index c2b7cc1..fae2b9a 100755
--- a/bin/help
+++ b/bin/help
@@ -16,17 +16,17 @@
1616
17source ${SNAP_DATA}/easy-openvpn.profile17source ${SNAP_DATA}/easy-openvpn.profile
1818
19DEFAULT_DEBUG=019DEFAULT_DEBUG=false
20DEFAULT_NOPASSWD=020DEFAULT_NOPASSWD=false
21DEFAULT_OVPN_NATDEVICE=eth021DEFAULT_OVPN_NATDEVICE=eth0
2222
23SNAPPY_DEBUG=debug23SNAPPY_DEBUG=debug
24SNAPPY_NOPASSWD=nopasswd24SNAPPY_NOPASSWD=server.no-password
25SNAPPY_OVPN_NATDEVICE=natdevice25SNAPPY_OVPN_NATDEVICE=server.natdevice
2626
27KEYS=("DEBUG" "NOPASSWD" "OVPN_NATDEVICE")27KEYS=("DEBUG" "NOPASSWD" "OVPN_NATDEVICE")
28DESC_DEBUG="Enable debug mode in OpenVPN server if it's set to 1."28DESC_DEBUG="Enable debug mode in OpenVPN server if it's set to false."
29DESC_NOPASSWD="Enable generating private key without a passphrase during server setup if it's set to 1"29DESC_NOPASSWD="Enable generating private key without a passphrase during server setup if it's set to false"
30DESC_OVPN_NATDEVICE="Support to specify nat device, typically it could be eth0(default) or wlan0 if you30DESC_OVPN_NATDEVICE="Support to specify nat device, typically it could be eth0(default) or wlan0 if you
31 connect to server over wireless connection"31 connect to server over wireless connection"
3232
diff --git a/spread/main/add_client/task.yaml b/spread/main/add_client/task.yaml
index 989ef52..870be31 100644
--- a/spread/main/add_client/task.yaml
+++ b/spread/main/add_client/task.yaml
@@ -4,7 +4,7 @@ execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
55
6 # so enable to setup server in non-interactive mode 6 # so enable to setup server in non-interactive mode
7 sudo snap set easy-openvpn nopasswd=17 sudo snap set easy-openvpn server.no-password='true'
88
9 # setup openvpn server9 # setup openvpn server
10 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"10 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
diff --git a/spread/main/change_natdevice/task.yaml b/spread/main/change_natdevice/task.yaml
index 6bbdf50..edb3797 100644
--- a/spread/main/change_natdevice/task.yaml
+++ b/spread/main/change_natdevice/task.yaml
@@ -3,11 +3,11 @@ summary: Test change natdevice to 'wlan0'.
3execute: |3execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
5 # so enable to setup server in non-interactive mode 5 # so enable to setup server in non-interactive mode
6 sudo snap set easy-openvpn nopasswd=16 sudo snap set easy-openvpn server.no-password='true'
77
8 # change natdevice to 'eth0'.8 # change natdevice to 'eth0'.
9 # It should be set to 'wlan0' while connecting to a wireless network9 # It should be set to 'wlan0' while connecting to a wireless network
10 sudo snap set easy-openvpn natdevice='eth0'10 sudo snap set easy-openvpn server.natdevice='eth0'
1111
12 # setup openvpn server12 # setup openvpn server
13 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"13 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
diff --git a/spread/main/connect_server/task.yaml b/spread/main/connect_server/task.yaml
index d1a34ec..412088f 100644
--- a/spread/main/connect_server/task.yaml
+++ b/spread/main/connect_server/task.yaml
@@ -3,7 +3,7 @@ summary: Test connect openvpn server.
3execute: |3execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
5 # so enable to setup server in non-interactive mode 5 # so enable to setup server in non-interactive mode
6 sudo snap set easy-openvpn nopasswd=16 sudo snap set easy-openvpn server.no-password='true'
77
8 # setup openvpn server8 # setup openvpn server
9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
diff --git a/spread/main/hooks/task.yaml b/spread/main/hooks/task.yaml
index f849977..2b365f7 100644
--- a/spread/main/hooks/task.yaml
+++ b/spread/main/hooks/task.yaml
@@ -1,17 +1,18 @@
1summary: Test configure hooks.1summary: Test configure hooks.
22
3execute: |3execute: |
4 sudo easy-openvpn.help | MATCH ".*'debug', using default value: '0'"4 sudo easy-openvpn.help | MATCH ".*'debug', using default value: 'false'"
5 sudo easy-openvpn.help | MATCH "'nopasswd', using default value: '0'"5 sudo easy-openvpn.help | MATCH "'server.no-password', using default value: 'false'"
6 sudo easy-openvpn.help | MATCH "'server.natdevice', using default value: 'eth0'"
67
7 # set 'debug' to 1 and check the value in help command8 # set 'debug' to 'true' and check the value in help command
8 sudo snap set easy-openvpn debug=19 sudo snap set easy-openvpn debug='true'
9 sudo easy-openvpn.help | MATCH "'debug' current value set to: '1'.*"10 sudo easy-openvpn.help | MATCH "'debug' current value set to: '1'.*"
1011
11 # set 'nopasswd' to 1 and check the value in help command12 # set 'no-password' to 'true' and check the value in help command
12 sudo snap set easy-openvpn nopasswd=113 sudo snap set easy-openvpn server.no-password='true'
13 sudo easy-openvpn.help | MATCH "'nopasswd' current value set to: '1'.*"14 sudo easy-openvpn.help | MATCH "'server.no-password' current value set to: 'true'.*"
1415
15 # set 'natdevice' to 'wlan0' and check the value in help command16 # set 'natdevice' to 'wlan0' and check the value in help command
16 sudo snap set easy-openvpn natdevice=wlan017 sudo snap set easy-openvpn server.natdevice=wlan0
17 sudo easy-openvpn.help | MATCH "'natdevice' current value set to: 'wlan0'.*"18 sudo easy-openvpn.help | MATCH "'server.natdevice' current value set to: 'wlan0'.*"
diff --git a/spread/main/launch_server/task.yaml b/spread/main/launch_server/task.yaml
index 9d04aa5..ad10325 100644
--- a/spread/main/launch_server/task.yaml
+++ b/spread/main/launch_server/task.yaml
@@ -3,7 +3,7 @@ summary: Test launch openvpn server.
3execute: |3execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
5 # so enable to setup server in non-interactive mode 5 # so enable to setup server in non-interactive mode
6 sudo snap set easy-openvpn nopasswd=16 sudo snap set easy-openvpn server.no-password='true'
77
8 # setup openvpn server8 # setup openvpn server
9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
diff --git a/spread/main/monitor_status/task.yaml b/spread/main/monitor_status/task.yaml
index 0574a89..0fff5ad 100644
--- a/spread/main/monitor_status/task.yaml
+++ b/spread/main/monitor_status/task.yaml
@@ -3,7 +3,7 @@ summary: Test monitor check connection status.
3execute: |3execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
5 # so enable to setup server in non-interactive mode 5 # so enable to setup server in non-interactive mode
6 sudo snap set easy-openvpn nopasswd=16 sudo snap set easy-openvpn server.no-password='true'
77
8 # setup openvpn server8 # setup openvpn server
9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
diff --git a/spread/main/revoke_after_connection/task.yaml b/spread/main/revoke_after_connection/task.yaml
index 3272fa9..9299bd4 100644
--- a/spread/main/revoke_after_connection/task.yaml
+++ b/spread/main/revoke_after_connection/task.yaml
@@ -3,7 +3,7 @@ summary: Test revoke a client after connection.
3execute: |3execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
5 # so enable to setup server in non-interactive mode 5 # so enable to setup server in non-interactive mode
6 sudo snap set easy-openvpn nopasswd=16 sudo snap set easy-openvpn server.no-password='true'
77
8 # setup openvpn server8 # setup openvpn server
9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"9 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
diff --git a/spread/main/revoke_client/task.yaml b/spread/main/revoke_client/task.yaml
index 48d97db..9000590 100644
--- a/spread/main/revoke_client/task.yaml
+++ b/spread/main/revoke_client/task.yaml
@@ -4,7 +4,7 @@ execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
55
6 # so enable to setup server in non-interactive mode 6 # so enable to setup server in non-interactive mode
7 sudo snap set easy-openvpn nopasswd=17 sudo snap set easy-openvpn server.no-password='true'
88
9 # setup openvpn server9 # setup openvpn server
10 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"10 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
diff --git a/spread/main/setup_server/task.yaml b/spread/main/setup_server/task.yaml
index 0b1b0c4..7514801 100644
--- a/spread/main/setup_server/task.yaml
+++ b/spread/main/setup_server/task.yaml
@@ -3,11 +3,11 @@ summary: Test setup openvpn server.
3execute: |3execute: |
4 . $TESTSLIB/utilities.sh4 . $TESTSLIB/utilities.sh
55
6 # set 'nopasswd' to 1 and check the value in help command6 # set 'no-password' to 'true' and check the value in help command
7 # so that we can execute spread test in non-interactive mode 7 # so that we can execute spread test in non-interactive mode
8 # without user attention on password input for private key generation.8 # without user attention on password input for private key generation.
9 sudo snap set easy-openvpn nopasswd=19 sudo snap set easy-openvpn server.no-password='true'
10 sudo easy-openvpn.help | MATCH "'nopasswd' current value set to: '1'.*"10 sudo easy-openvpn.help | MATCH "'server.no-password' current value set to: 'true'.*"
1111
12 # setup openvpn server12 # setup openvpn server
13 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"13 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"

Subscribers

People subscribed via source and target branches

to all changes: