settings.html.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <!--
  2. VPN Client app for YunoHost
  3. Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
  4. Contribute at https://github.com/jvaubourg/vpnclient_ynh
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU Affero General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Affero General Public License for more details.
  13. You should have received a copy of the GNU Affero General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. -->
  16. <h2><?= T_("VPN Client Configuration") ?></h2>
  17. <?php if($faststatus): ?>
  18. <span class="label label-success" data-toggle="tooltip" data-title="<?= T_('This is a fast status. Click on More details to show the complete status.') ?>"><?= T_('Running') ?></span>
  19. <?php else: ?>
  20. <span class="label label-danger" data-toggle="tooltip" data-title="<?= T_('This is a fast status. Click on More details to show the complete status.') ?>"><?= T_('Not Running') ?></span>
  21. <?php endif; ?>
  22. &nbsp; <img src="public/img/loading.gif" id="status-loading" alt="Loading..." /><a href="#" id="statusbtn" data-toggle="tooltip" data-title="<?= T_('Loading complete status may take a few minutes. Be patient.') ?>"><?= T_('More details') ?></a>
  23. <div id="status" class="alert alert-dismissible alert-info fade in" style="margin-top: 10px" role="alert">
  24. <button type="button" class="close"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  25. <div id="status-text"></div>
  26. </div>
  27. <hr />
  28. <div class="row">
  29. <div class="col-sm-offset-2 col-sm-8">
  30. <form method="post" enctype="multipart/form-data" action="?/settings" class="form-horizontal" role="form" id="form">
  31. <input type="hidden" name="_method" value="put" />
  32. <div class="panel panel-default">
  33. <div class="panel-heading">
  34. <h3 class="panel-title"><?= T_("VPN") ?></h3>
  35. </div>
  36. <div style="padding: 14px 14px 0 10px">
  37. <div class="form-group">
  38. <label for="server_name" class="col-sm-3 control-label"><?= T_('Server Address') ?></label>
  39. <div class="col-sm-9">
  40. <input type="text" class="form-control" name="server_name" id="server_name" placeholder="access.ldn-fai.net" value="<?= $server_name ?>" />
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label for="server_port" class="col-sm-3 control-label"><?= T_('Server Port') ?></label>
  45. <div class="col-sm-9">
  46. <input type="text" data-toggle="tooltip" data-title="<?= T_('With restricted access, you should use 443 (TCP) or 53 (UDP)') ?>" class="form-control" name="server_port" id="server_port" placeholder="1194" value="<?= $server_port ?>" />
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label for="server_proto" class="col-sm-3 control-label"><?= T_('Protocol') ?></label>
  51. <div class="btn-group col-sm-9" data-toggle="buttons">
  52. <label class="btn btn-default <?= $server_proto == 'udp' ? 'active' : '' ?>">
  53. <input type="radio" name="server_proto" value="udp" <?= $server_proto == 'udp' ? 'checked="cheked"' : '' ?> /> <?= T_('UDP') ?>
  54. </label>
  55. <label class="btn btn-default <?= $server_proto == 'tcp' ? 'active' : '' ?>" data-toggle="tooltip" data-title="<?= T_('UDP is more efficient than TCP (but more filtered in case of restrictive access)') ?>">
  56. <input type="radio" name="server_proto" value="tcp" <?= $server_proto == 'tcp' ? 'checked="cheked"' : '' ?> /> <?= T_('TCP') ?>
  57. </label>
  58. </div>
  59. </div>
  60. <div class="form-group" id="raw_openvpn_btnpanel">
  61. <label class="col-sm-3 control-label"></label>
  62. <div class="col-sm-9">
  63. <span class="glyphicon glyphicon-cog"></span> <a href="#" id="raw_openvpn_btn" data-toggle="tooltip" data-title="<?= T_('Edit the raw configuration only if you know what you do!') ?>"><?= T_('Advanced') ?></a>
  64. </div>
  65. </div>
  66. <div class="form-group" id="raw_openvpn_panel">
  67. <label for="raw_openvpn" class="col-sm-3 control-label"><?= T_('Advanced') ?></label>
  68. <div class="col-sm-9">
  69. <pre><textarea class="form-control" name="raw_openvpn" id="raw_openvpn"><?= $raw_openvpn ?></textarea></pre>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="panel panel-default">
  75. <div class="panel-heading">
  76. <h3 class="panel-title"><?= T_("IPv6") ?></h3>
  77. </div>
  78. <div style="padding: 14px 14px 0 10px">
  79. <div class="form-group">
  80. <label for="ip6_net" class="col-sm-3 control-label"><?= T_('Delegated prefix') ?></label>
  81. <div class="col-sm-9">
  82. <input type="text" data-toggle="tooltip" data-title="<?= T_('Leave empty if your Internet Service Provider does not give you a delegated prefix') ?>" class="form-control" name="ip6_net" id="ip6_net" placeholder="2001:db8:42::" value="<?= $ip6_net ?>" />
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <?php if(!$crt_client_key_exists && empty($login_user)): ?>
  88. <div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 0px 17px" role="alert">
  89. <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  90. <strong><?= T_('Notice') ?>:</strong> <?= T_("You need to upload a Client Certificate, or define a Username (or both) for starting your VPN Client.") ?>
  91. </div>
  92. <?php endif; ?>
  93. <div class="panel panel-default">
  94. <div class="panel-heading">
  95. <h3 class="panel-title"><?= T_("Certificates") ?></h3>
  96. </div>
  97. <div style="padding: 14px 14px 0 10px">
  98. <div class="form-group">
  99. <label for="crt_client" class="col-sm-3 control-label"><?= $crt_client_exists ? T_('Update Client Cert.') : T_('Upload Client Cert.') ?></label>
  100. <div class="input-group col-sm-9" style="padding: 0 15px">
  101. <?php if($crt_client_exists): ?>
  102. <a class="btn btn-danger input-group-addon deletefile" id="crt_client_deletebtn" data-toggle="tooltip" data-title="<?= T_('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
  103. <input id="crt_client_delete" name="crt_client_delete" type="checkbox" value="1" style="display: none" />
  104. <?php endif; ?>
  105. <input type="text" class="form-control fileinput" id="crt_client_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
  106. <input id="crt_client" name="crt_client" type="file" style="display: none" />
  107. <a class="btn input-group-addon fileinput" id="crt_client_chooserbtn" data-toggle="tooltip" data-title="<?= T_('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
  108. </div>
  109. </div>
  110. <div class="form-group">
  111. <label for="crt_client_key" class="col-sm-3 control-label"><?= $crt_client_key_exists ? T_('Update Client Key') : T_('Upload Client Key') ?></label>
  112. <div class="input-group col-sm-9" style="padding: 0 15px">
  113. <?php if($crt_client_key_exists): ?>
  114. <a class="btn btn-danger input-group-addon deletefile" id="crt_client_key_deletebtn" data-toggle="tooltip" data-title="<?= T_('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
  115. <input id="crt_client_key_delete" name="crt_client_key_delete" type="checkbox" value="1" style="display: none" />
  116. <?php endif; ?>
  117. <input type="text" class="form-control fileinput" id="crt_client_key_choosertxt" placeholder="-----BEGIN PRIVATE KEY-----" readonly="readonly" />
  118. <input id="crt_client_key" name="crt_client_key" type="file" style="display: none" />
  119. <a class="btn input-group-addon fileinput" id="crt_client_key_chooserbtn" data-toggle="tooltip" data-title="<?= T_('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
  120. </div>
  121. </div>
  122. <div class="form-group">
  123. <?php if(!$crt_server_ca_exists): ?>
  124. <div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 16px 17px" role="alert">
  125. <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  126. <strong><?= T_('Notice') ?>:</strong> <?= T_("You need to upload a Server CA for starting your VPN Client.") ?>
  127. </div>
  128. <?php endif; ?>
  129. <label for="crt_server_ca" class="col-sm-3 control-label"><?= $crt_server_ca_exists ? T_('Update Server CA') : T_('Upload Server CA') ?></label>
  130. <div class="input-group col-sm-9" style="padding: 0 15px">
  131. <?php if($crt_server_ca_exists): ?>
  132. <a class="btn btn-danger not-allowed btn-disabled input-group-addon" id="crt_server_ca_deletebtn" data-toggle="tooltip" data-title="<?= T_('You cannot have no server CA') ?>"><span class="glyphicon glyphicon-remove"></span></a>
  133. <input id="crt_server_ca_delete" name="crt_server_ca_delete" type="checkbox" value="1" style="display: none" />
  134. <?php endif; ?>
  135. <input type="text" class="form-control fileinput" id="crt_server_ca_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
  136. <input id="crt_server_ca" name="crt_server_ca" type="file" style="display: none" />
  137. <a class="btn input-group-addon fileinput" id="crt_server_ca_chooserbtn" data-toggle="tooltip" data-title="<?= T_('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. <div class="panel panel-default">
  143. <div class="panel-heading">
  144. <h3 class="panel-title"><?= T_("Login") ?></h3>
  145. </div>
  146. <div style="padding: 14px 14px 0 10px">
  147. <div class="form-group">
  148. <label for="login_user" class="col-sm-3 control-label"><?= T_('Username') ?></label>
  149. <div class="col-sm-9">
  150. <input type="text" data-toggle="tooltip" data-title="<?= T_('Leave empty if not necessary') ?>" class="form-control" name="login_user" id="login_user" placeholder="michu" value="<?= $login_user ?>" />
  151. </div>
  152. </div>
  153. <div class="form-group">
  154. <label for="login_passphrase" class="col-sm-3 control-label"><?= T_('Password') ?></label>
  155. <div class="col-sm-9">
  156. <input type="text" data-toggle="tooltip" data-title="<?= T_('Leave empty if not necessary') ?>" class="form-control" name="login_passphrase" id="login_passphrase" placeholder="XVCwSbDkxnqQ" value="<?= $login_passphrase ?>" />
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <div class="form-group">
  162. <div style="text-align: center">
  163. <button type="submit" class="btn btn-default" data-toggle="tooltip" id="save" data-title="<?= T_('Reloading may take a few minutes. Be patient.') ?>"><?= T_('Save and reload') ?></button> <img src="public/img/loading.gif" id="save-loading" alt="Loading..." />
  164. </div>
  165. </div>
  166. </form>
  167. </div>
  168. </div>