{"action":"created","issue":{"url":"https://api.github.com/repos/rachelproject/rachelplus/issues/7","labels_url":"https://api.github.com/repos/rachelproject/rachelplus/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/rachelproject/rachelplus/issues/7/comments","events_url":"https://api.github.com/repos/rachelproject/rachelplus/issues/7/events","html_url":"https://github.com/rachelproject/rachelplus/issues/7","id":93704675,"number":7,"title":"CAP Captive Portal","user":{"login":"bnordha","id":13216500,"avatar_url":"https://avatars.githubusercontent.com/u/13216500?v=3","gravatar_id":"","url":"https://api.github.com/users/bnordha","html_url":"https://github.com/bnordha","followers_url":"https://api.github.com/users/bnordha/followers","following_url":"https://api.github.com/users/bnordha/following{/other_user}","gists_url":"https://api.github.com/users/bnordha/gists{/gist_id}","starred_url":"https://api.github.com/users/bnordha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnordha/subscriptions","organizations_url":"https://api.github.com/users/bnordha/orgs","repos_url":"https://api.github.com/users/bnordha/repos","events_url":"https://api.github.com/users/bnordha/events{/privacy}","received_events_url":"https://api.github.com/users/bnordha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-08T06:00:25Z","updated_at":"2015-07-10T22:45:41Z","closed_at":null,"body":"I generally turn the captive portal on the CAP. I had issues particular with phones being able to connect  via Wi-FI with captive portal on."},"comment":{"url":"https://api.github.com/repos/rachelproject/rachelplus/issues/comments/120545200","html_url":"https://github.com/rachelproject/rachelplus/issues/7#issuecomment-120545200","issue_url":"https://api.github.com/repos/rachelproject/rachelplus/issues/7","id":120545200,"user":{"login":"spatiald","id":5751915,"avatar_url":"https://avatars.githubusercontent.com/u/5751915?v=3","gravatar_id":"","url":"https://api.github.com/users/spatiald","html_url":"https://github.com/spatiald","followers_url":"https://api.github.com/users/spatiald/followers","following_url":"https://api.github.com/users/spatiald/following{/other_user}","gists_url":"https://api.github.com/users/spatiald/gists{/gist_id}","starred_url":"https://api.github.com/users/spatiald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spatiald/subscriptions","organizations_url":"https://api.github.com/users/spatiald/orgs","repos_url":"https://api.github.com/users/spatiald/repos","events_url":"https://api.github.com/users/spatiald/events{/privacy}","received_events_url":"https://api.github.com/users/spatiald/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T22:45:41Z","updated_at":"2015-07-10T22:45:41Z","body":"## What to configure\r\nWorking solution follows - only one issue I am working at the moment is that the \"button\" or link in the captive portal doesn't open a new, full-size browser.\r\n\r\n* Copied pass_ticket.shtml and redirect.shtml to /media/RACHEL/rachel (required to maintain user \"state\" - i.e. know who has already been to the site)\r\n\r\n* Modified /usr/local/etc/lighttpd.conf\r\n```\r\n$SERVER[\"socket\"] == \":82\" {\r\n\tserver.document-root = \"/media/RACHEL/rachel\"\r\n\turl.rewrite-once = ( \"^(?!/pass_ticket.shtml)\" => \"/redirect.shtml\" )\r\n}\r\n```\r\n\r\n* Add this to end of /usr/local/etc/lighttpd.conf\r\n```\r\n# RACHEL\r\n$HTTP[\"host\"] =~ \"(^|\\.)my\\.content$\" {\r\n\tserver.document-root = \"/media/RACHEL/rachel\"\r\n        url.rewrite-once = ( \"^/(.*)\" => \"/captiveportal-redirect.html\" )\r\n}\r\n\r\n$SERVER[\"socket\"] == \":80\" {\r\n\tserver.document-root = \"/media/RACHEL/rachel\"\r\n\tindex-file.names =(\"index.php\", \"index.html\", \"/_h5ai/server/php/index.php\")\r\n  \t\tfastcgi.server = ( \".php\" => ((\r\n  \t\t\t\"bin-path\" => \"/usr/bin/php5-cgi\",\r\n  \t\t\t\"socket\" => \"/tmp/php.socket\"\r\n  \t\t\t)))\r\n}\r\n```\r\n\r\n* Added a new file -> /media/RACHEL/rachel/captiveportal-redirect.html\r\n```html\r\n<html>\r\n<head>\r\n</head>\r\n<body link=\"#000000\" vlink=\"#000000\" alink=\"#377211\">\r\n<div style='text-align:center'>\r\n<a href=\"http://192.168.88.1/index.php\" target=\"_top\">\r\n\t<img src=\"http://192.168.88.1/art/rachel_banner.png\" />\r\n</a>\r\n<form action=\"dummyvalue\">\r\n<input type=\"button\" value=\"Click here to enter RACHEL\" name=\"button\" onclick=\"location.href='http://192.168.88.1'\" />\r\n</form>\r\n</div>\r\n</body>\r\n```\r\n\r\n- - - - -\r\n\r\n## HOW IT WORKS:\r\n\r\nIPTables takes port 80 and redirects traffic to port 82 (the Captive Portal):\r\n```\r\n*nat\r\n:PREROUTING ACCEPT [0:0]\r\n:POSTROUTING ACCEPT [0:0]\r\n:OUTPUT ACCEPT [0:0]\r\n:CAPTIVE - [0:0]\r\n:CAPTIVE_WHITELIST - [0:0]\r\n:CAPTIVE_PASSLIST - [0:0]\r\n-I PREROUTING -i wlan0 -p tcp --dport 80 -j CAPTIVE\r\n-A POSTROUTING -o eth0 -j MASQUERADE\r\n-I CAPTIVE -p tcp -j CAPTIVE_WHITELIST\r\n-I CAPTIVE -p tcp -j CAPTIVE_PASSLIST\r\n-A CAPTIVE -p tcp --dport 80 -j DNAT --to-destination 192.168.88.1:82\r\n-I CAPTIVE_WHITELIST -p tcp -d 192.168.88.1 -j ACCEPT\r\nCOMMIT\r\n```\r\n\r\nIt uses the html files pass_ticket.shtml and redirect.shtml to identify traffic and keep track of previous users so it doesn't keep popping up the box (this is setup in lighttpd.conf).\r\n```html\r\n$SERVER[\"socket\"] == \":82\" {\r\n        server.document-root = \"/media/RACHEL/rachel\"\r\n        url.rewrite-once = ( \"^(?!/pass_ticket.shtml)\" => \"/redirect.shtml\" )\r\n}\r\n```\r\n\r\nThe following code redirects the Captive Portal page to our file captiveportal-redirect.html here:\r\n```html\r\n$HTTP[\"host\"] =~ \"(^|\\.)my\\.content$\" {\r\n\tserver.document-root = \"/media/RACHEL/rachel\"\r\n        url.rewrite-once = ( \"^/(.*)\" => \"/captiveportal-redirect.html\" )\r\n}\r\n```\r\n\r\n"}}