Merge ~teknoraver/snappy-hwe-snaps/+git/engineering-tests:redirect into ~snappy-hwe-team/snappy-hwe-snaps/+git/engineering-tests:master

Proposed by Matteo Croce
Status: Merged
Approved by: Simon Fels
Approved revision: d12b394335369217e77145e4de3abc38d212210e
Merged at revision: 204e3130262b9d8c0edfb07dbbd91e60c25a0740
Proposed branch: ~teknoraver/snappy-hwe-snaps/+git/engineering-tests:redirect
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/engineering-tests:master
Diff against target: 124 lines (+112/-0)
2 files modified
captive-redirect/manage.py (+10/-0)
captive-redirect/units/captive-redirect.pxu (+102/-0)
Reviewer Review Type Date Requested Status
Simon Fels Approve
Jim Hodapp (community) Approve
System Enablement Bot continuous-integration Approve
Review via email: mp+319218@code.launchpad.net
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
Jim Hodapp (jhodapp) wrote :

Some changes needed, but otherwise looks very good.

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
Jim Hodapp (jhodapp) wrote :

LGTM

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/captive-redirect/manage.py b/captive-redirect/manage.py
2new file mode 100755
3index 0000000..56ea1c8
4--- /dev/null
5+++ b/captive-redirect/manage.py
6@@ -0,0 +1,10 @@
7+#!/usr/bin/env python3
8+from plainbox.provider_manager import setup, N_
9+
10+setup(
11+ name='plainbox-provider-captive-redirect',
12+ namespace='2017.com.canonical.captive-redirect',
13+ version="1.0",
14+ description=N_("Plainbox provider for the Captive Redirect snap"),
15+ gettext_domain="2017_com_canonical_captive_redirect",
16+)
17diff --git a/captive-redirect/units/captive-redirect.pxu b/captive-redirect/units/captive-redirect.pxu
18new file mode 100644
19index 0000000..3f0ee75
20--- /dev/null
21+++ b/captive-redirect/units/captive-redirect.pxu
22@@ -0,0 +1,102 @@
23+# Copyright (C) 2017 Canonical Ltd.
24+# All rights reserved.
25+#
26+# Written by:
27+# Matteo Croce <matteo.croce@canonical.com>
28+
29+unit: category
30+id: captive_redirect
31+_name: Captive portal redirect
32+
33+id: captive_redirect/setup/ensure_interface_connection_setup
34+category_id: captive_redirect
35+_description: Ensure that the captive-redirect interfaces are connected
36+plugin: manual
37+_steps:
38+ 1. Install the captive-redirect snap via
39+ .
40+ $ snap install captive-redirect
41+ .
42+_verification:
43+ Verify that you see the following when running snap interfaces:
44+ :firewall-control captive-redirect
45+
46+id: captive_redirect/setup/default_disabled
47+category_id: captive_redirect
48+_description: Ensure that captive-redirect is disabled by default
49+plugin: manual
50+_steps:
51+ 1. Get the configuration with:
52+ .
53+ $ captive-redirect.config status
54+ .
55+ 2. Ensure that there isn't any REDIRECT iptables chain:
56+ .
57+ $ sudo iptables-save |grep captive
58+ .
59+_verification:
60+ 1. Check that the redirect is disabled:
61+ .
62+ active: false
63+ .
64+ 2. You shouldn't see any iptables rule
65+
66+id: captive_redirect/setup/iptables_rules_all_interfaces
67+category_id: captive_redirect
68+_description: Ensure that enabling captive-redirect sets up the correct iptables rules
69+plugin: manual
70+_steps:
71+ 1. Enable captive-redirect with:
72+ .
73+ $ sudo snap set captive-redirect active=true port=9876
74+ .
75+ 2. Get the iptables rules with:
76+ .
77+ $ sudo iptables-save |grep captive
78+ .
79+_verification:
80+ 1. You should see iptables rules like:
81+ .
82+ :captive - [0:0]
83+ -A PREROUTING -j captive
84+ -A captive -p tcp -m multiport --dports 80,443 -j REDIRECT --to-ports 9876
85+ .
86+
87+id: captive_redirect/setup/iptables_rules_all_interfaces
88+category_id: captive_redirect
89+_description: Ensure that enabling captive-redirect sets up iptables rules for a single interface
90+plugin: manual
91+_steps:
92+ 1. Enable captive-redirect with:
93+ .
94+ $ sudo snap set captive-redirect active=true port=9999 interfaces=tun4
95+ .
96+ 2. Get the iptables rules with:
97+ .
98+ $ sudo iptables-save |grep captive
99+ .
100+_verification:
101+ 1. You should see iptables rules like:
102+ .
103+ :captive - [0:0]
104+ -A PREROUTING -j captive
105+ -A captive -i tun4 -p tcp -m multiport --dports 80,443 -j REDIRECT --to-ports 9999
106+ .
107+
108+id: captive_redirect/functionality/redirect_works
109+category_id: captive_redirect
110+_description: Ensure that enabling captive-redirect really redirects the traffic
111+plugin: manual
112+_steps:
113+ 1. Install a sample web server with:
114+ .
115+ $ sudo snap install xkcd-webserver
116+ .
117+ 2. Connect another device to the DUT (Device Under Test) and setup the DUT as default gateway
118+ 3. Enable the redirect with:
119+ .
120+ $ sudo snap set captive-redirect active=true port=80 interfaces=
121+ .
122+ 4. Try to access an HTTP (avoid HTTPS, it will give a certificate error) web page from the device
123+_verification:
124+ 1. You should see a blank page pointing to XKCD instead of the typed address

Subscribers

People subscribed via source and target branches

to all changes: