{"action":"created","issue":{"url":"https://api.github.com/repos/andrew-bibb/cmst/issues/194","repository_url":"https://api.github.com/repos/andrew-bibb/cmst","labels_url":"https://api.github.com/repos/andrew-bibb/cmst/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/andrew-bibb/cmst/issues/194/comments","events_url":"https://api.github.com/repos/andrew-bibb/cmst/issues/194/events","html_url":"https://github.com/andrew-bibb/cmst/issues/194","id":358290818,"node_id":"MDU6SXNzdWUzNTgyOTA4MTg=","number":194,"title":"Add option to auto-create OpenConnect-cookie when connecting to VPN","user":{"login":"EarthlingX","id":38689554,"node_id":"MDQ6VXNlcjM4Njg5NTU0","avatar_url":"https://avatars1.githubusercontent.com/u/38689554?v=4","gravatar_id":"","url":"https://api.github.com/users/EarthlingX","html_url":"https://github.com/EarthlingX","followers_url":"https://api.github.com/users/EarthlingX/followers","following_url":"https://api.github.com/users/EarthlingX/following{/other_user}","gists_url":"https://api.github.com/users/EarthlingX/gists{/gist_id}","starred_url":"https://api.github.com/users/EarthlingX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EarthlingX/subscriptions","organizations_url":"https://api.github.com/users/EarthlingX/orgs","repos_url":"https://api.github.com/users/EarthlingX/repos","events_url":"https://api.github.com/users/EarthlingX/events{/privacy}","received_events_url":"https://api.github.com/users/EarthlingX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-08T12:20:37Z","updated_at":"2018-09-17T23:40:18Z","closed_at":null,"author_association":"NONE","body":"When using a OpenConnect VPN-connection, many VPN servers request user authentication via cookie. This cookie has to be generated before connecting to the VPN and should be stored into `/var/lib/connman-vpn/vpnname.config`, otherwise the connection can not be established successfully.\r\n\r\nTo do so, every time you want to connect to the VPN you have to execute a little shell command that will do the job for you. This command is generating the cookie and writes this new cookie into the VPN provisioning file `/var/lib/connman-vpn/vpnname.config`:\r\n\r\n`sed -i \"s/^OpenConnect.Cookie =.*$/$( echo '<YOUR-VPN-PASSWORD>' | openconnect --csd-wrapper=/home/user/.cisco/csd-wrapper.sh --authenticate --user=<USERNAME> --authgroup=\"<YOURGROUP>\" --passwd-on-stdin <VPN-HOST-DOMAIN> | grep 'COOKIE=' | sed \"s/COOKIE='//; s/'//g; s/^/OpenConnect.Cookie = /\")/\" <EXTERNAL-FILENAME>`\r\n\r\nAfterwards, in `CMST` you can click on `Connect` and connect to the VPN successfully. Unfortunately it is a bit annoying to run this command by hand every time you want to connect.\r\n\r\n---------------------------------------------------------------------------------------------------------------------------------\r\n\r\nWould it be possible to add some function into `CMST` that will execute the command first of all when clicking on `Connect`?\r\n\r\n**For example:**\r\n\r\n- One additional input field in `CMST` to insert the desired command that has to be executed first of all when clicking on `Connect`\r\n- Or alternatively, some additional line inside the provisioning file `/var/lib/connman-vpn/vpnname.config` where you can insert the desired custom code as text (e.g. a line called `ExecuteThisCodeWhenConnecting\r\n= <blablabla>`). In this case, when clicking on `Connect` CMST could recall this command and execute it before connecting to the VPN.\r\n\r\nYou can have a look at the more detailed description from a user on StackExchange:\r\n\r\nhttps://unix.stackexchange.com/questions/449174/connman-how-to-set-up-openconnect-vpn-with-csd-wrapper-correctly\r\n\r\nIt seems that `NetworkManager` can handle those recreations of the user cookie by himself. In `CMST` that is not possible yet , but it would be a nice feature.\r\n\r\nI would appreciate such a feature! Thanks a lot for your efforts!"},"comment":{"url":"https://api.github.com/repos/andrew-bibb/cmst/issues/comments/422205984","html_url":"https://github.com/andrew-bibb/cmst/issues/194#issuecomment-422205984","issue_url":"https://api.github.com/repos/andrew-bibb/cmst/issues/194","id":422205984,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjIwNTk4NA==","user":{"login":"andrew-bibb","id":6935544,"node_id":"MDQ6VXNlcjY5MzU1NDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/6935544?v=4","gravatar_id":"","url":"https://api.github.com/users/andrew-bibb","html_url":"https://github.com/andrew-bibb","followers_url":"https://api.github.com/users/andrew-bibb/followers","following_url":"https://api.github.com/users/andrew-bibb/following{/other_user}","gists_url":"https://api.github.com/users/andrew-bibb/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-bibb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-bibb/subscriptions","organizations_url":"https://api.github.com/users/andrew-bibb/orgs","repos_url":"https://api.github.com/users/andrew-bibb/repos","events_url":"https://api.github.com/users/andrew-bibb/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-bibb/received_events","type":"User","site_admin":false},"created_at":"2018-09-17T23:40:18Z","updated_at":"2018-09-17T23:40:18Z","author_association":"OWNER","body":"Running as root is not a problem, the current vpn provisioning editor does that.  Speaking of which, does the current editor do what you want?  I haven't actually looked but when I wrote the editor I thought I put in every command allowed by Connman, and one of them is OpenConnect.cookie.  You need the \"Advanced\" options checked to see this control (in the preferences tab, left side about half way down).  \r\n\r\nThe ConnMan docs do say that since the cookie lifetime is limited it usually does not make sense to store it.  Docs also say that the vpn agent is supposed to prompt for this cookie if it is needed and not present.  I did implement an agent, so if that is not working I will need to research why.  May not be my problem, but likely is.  \r\n\r\n"}}
{"actor":{"display_login":"andrew-bibb"}}