function getApache(Request $request) { if ($request->get('key') != env('WEBDB_BACKEND_KEY')) { return; } header("Content-Type: text/plain"); foreach (ServerDomain::get() as $domain) { echo '<VirtualHost *:' . ($domain->ssl ? "443" : "80") . ">\n"; echo " ServerName " . $domain->domain . "\n"; echo " ProxyPass / " . ($domain->ssl ? "https" : "http") . "://" . $domain->server->ip_address . "/\n"; echo " ProxyPassReverse / " . ($domain->ssl ? "https" : "http") . "://" . $domain->server->ip_address . "/\n"; if ($domain->ssl) { echo " SSLEngine on\n"; echo " SSLCertificateFile " . $domain->ssl_certificate . "\n"; echo " SSLCertificateKeyFile " . $domain->ssl_private_key . "\n"; if ($domain->ssl_ca_bundle) { echo " SSLCACertificateFile " . $domain->ssl_ca_bundle . "\n"; } echo " SSLProxyEngine on\n"; echo " SSLProxyVerify none\n"; echo " SSLProxyCheckPeerCN off\n"; echo " SSLProxyCheckPeerName off\n"; echo " SSLProxyCheckPeerExpire off\n"; } echo "</VirtualHost>\n\n"; } }
function postDomainDeleteModal(ServerDomain $domain) { /* Check that the domain belongs to the groups server */ if (Auth::user()->student->group->id != $domain->server->group->id) { return; } /* Students cannot change when the domain is locked */ if ($domain->locked) { return; } $domain->delete(); }