Referrer-Policy, Content-Security-Policy

pull/12/head
Szekeres Bálint 7 years ago
parent abae124a93
commit e088698bec

@ -27,6 +27,11 @@ Online nginx configuration generator.
* … * …
* unified (`nginx.conf`) / modularized file structure (ideal for multi-domain environment) * unified (`nginx.conf`) / modularized file structure (ideal for multi-domain environment)
* security headers * security headers
* `X-Frame-Options`
* `X-XSS-Protection`
* `X-Content-Type-Options`
* `Referrer-Policy`
* `Content-Security-Policy`
* `worker_processes` * `worker_processes`
* `user` * `user`
* `pid` * `pid`

@ -58,6 +58,9 @@
file_structure: 'unified', file_structure: 'unified',
referrer_policy: 'no-referrer-when-downgrade',
content_security_policy: 'default-src * \'unsafe-eval\' \'unsafe-inline\'',
worker_processes: 'auto', worker_processes: 'auto',
user: 'www-data', user: 'www-data',
pid: '/run/nginx.pid', pid: '/run/nginx.pid',
@ -270,8 +273,12 @@
return $scope.isPHP() && $scope.data.wordpress; return $scope.isPHP() && $scope.data.wordpress;
}; };
$scope.isCSP = function() {
return !!$scope.data.content_security_policy;
};
$scope.isAccessLog = function() { $scope.isAccessLog = function() {
return $scope.data.access_log; return !!$scope.data.access_log;
}; };
$scope.isGzip = function() { $scope.isGzip = function() {

@ -125,58 +125,89 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-check"> </div>
</div>
<div class="card">
<div class="card-body">
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="index_html" ng-model="data.index_html"> <input class="form-check-input" type="checkbox" id="index_html" ng-model="data.index_html">
<label class="form-check-label" for="index_html"> <label class="form-check-label" for="index_html">
<span tooltips tooltip-template="Pass unhandled requests to index.html.<br><br><i>Angular, React, Vue.js, Ember.js</i>...">index.html <small>handler</small></span> <span tooltips tooltip-template="Pass unhandled requests to index.html.<br><br><i>Angular, React, Vue.js, Ember.js</i>...">index.html <small>handler</small></span>
</label> </label>
</div> </div>
<div class="form-group">
<div class="input-group" tooltips tooltip-template="PHP-FPM via TCP or unix socket.">
<div class="input-group-prepend">
<div class="input-group-text">PHP</div>
</div>
<select class="form-control" ng-model="data.php">
<option value="off">disabled</option>
<option value="tcp">TCP</option>
<option value="5.x">5.x socket</option>
<option value="7.0">7.0 socket</option>
<option value="7.1">7.1 socket</option>
<option value="7.2">7.2 socket</option>
<option value="7.3">7.3 socket</option>
</select>
</div>
</div>
<div class="form-subgroup" ng-if="isPHP()">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="index_php" ng-model="data.index_php">
<label class="form-check-label" for="index_php">
<span tooltips tooltip-template="Pass unhandled requests to index.php.<br><br><i>Laravel, Lumen, Symfony, Zend, CodeIgniter, Yii, CakePHP, Slim...</i>">index.php <small>handler</small></span>
</label>
</div>
</div>
<div class="form-subgroup" ng-if="isPHP()">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="wordpress" ng-model="data.wordpress">
<label class="form-check-label" for="wordpress">
<span tooltips tooltip-template="WordPress security rules and login limiting <i>(if enabled)</i>.">WordPress</span>
</label>
</div>
</div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="form-group"> <label class="form-label">File structure</label>
<label class="form-label"> <div class="form-subgroup">
<span tooltips tooltip-template="PHP-FPM via TCP or unix socket.">PHP</span> <div class="form-check">
</label> <input class="form-check-input" type="radio" id="unified" ng-model="data.file_structure" value="unified">
<select class="form-control" ng-model="data.php"> <label class="form-check-label" for="unified">
<option value="off">disabled</option> <span tooltips tooltip-template="Combine configuration to a single file.<br><br><i>(if possible)</i>">unified</span>
<option value="tcp">TCP</option> </label>
<option value="5.x">5.x socket</option> </div>
<option value="7.0">7.0 socket</option>
<option value="7.1">7.1 socket</option>
<option value="7.2">7.2 socket</option>
<option value="7.3">7.3 socket</option>
</select>
</div>
<div class="form-check" ng-if="isPHP()">
<input class="form-check-input" type="checkbox" id="index_php" ng-model="data.index_php">
<label class="form-check-label" for="index_php">
<span tooltips tooltip-template="Pass unhandled requests to index.php.<br><br><i>Laravel, Lumen, Symfony, Zend, CodeIgniter, Yii, CakePHP, Slim...</i>">index.php <small>handler</small></span>
</label>
</div> </div>
<div class="form-check" ng-if="isPHP()"> <div class="form-subgroup">
<input class="form-check-input" type="checkbox" id="wordpress" ng-model="data.wordpress"> <div class="form-check">
<label class="form-check-label" for="wordpress"> <input class="form-check-input" type="radio" id="modularized" ng-model="data.file_structure" value="modularized">
<span tooltips tooltip-template="WordPress security rules and login limiting <i>(if enabled)</i>.">WordPress</span> <label class="form-check-label" for="modularized">
</label> <span tooltips tooltip-template="Multiple configuration files<br><br><i>(ideal for multi-domain environment)</i>">modularized</span>
</label>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<label class="form-label">File structure</label> <div class="form-group">
<div class="form-check"> <label class="form-label"><code tooltips tooltip-template="Referrer Policy is a new header that allows a site to control how much information the browser includes with navigations away from a document and should be set by all sites.">Referrer-Policy</code></label>
<input class="form-check-input" type="radio" id="unified" ng-model="data.file_structure" value="unified"> <select class="form-control form-control-sm" ng-model="data.referrer_policy">
<label class="form-check-label" for="unified"> <option value="no-referrer">no-referrer</option>
<span tooltips tooltip-template="Combine configuration to a single file.<br><br><i>(if possible)</i>">unified</span> <option value="no-referrer-when-downgrade">no-referrer-when-downgrade</option>
</label> <option value="origin">origin</option>
<option value="origin-when-cross-origin">origin-when-cross-origin</option>
<option value="same-origin">same-origin</option>
<option value="strict-origin">strict-origin</option>
<option value="strict-origin-when-cross-origin">strict-origin-when-cross-origin</option>
<option value="unsafe-url">unsafe-url</option>
</select>
</div> </div>
<div class="form-check"> <div class="form-group">
<input class="form-check-input" type="radio" id="modularized" ng-model="data.file_structure" value="modularized"> <label class="form-label"><code tooltips tooltip-template="Content Security Policy is an effective measure to protect your site from XSS attacks. By whitelisting sources of approved content, you can prevent the browser from loading malicious assets.">Content-Security-Policy</code></label>
<label class="form-check-label" for="modularized"> <input type="text" class="form-control form-control-sm" ng-model="data.content_security_policy">
<span tooltips tooltip-template="Multiple configuration files<br><br><i>(ideal for multi-domain environment)</i>">modularized</span>
</label>
</div> </div>
</div> </div>
</div> </div>
@ -184,7 +215,7 @@
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<label class="form-label"><code tooltips tooltip-template="Sets the maximum number of simultaneous connections that can be opened by a worker process.">worker_processes</code></label> <label class="form-label"><code tooltips tooltip-template="Sets the maximum number of simultaneous connections that can be opened by a worker process.">worker_processes</code></label>
<select class="form-control" ng-model="data.worker_processes"> <select class="form-control form-control-sm" ng-model="data.worker_processes">
<option value="auto">auto</option> <option value="auto">auto</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>

@ -3,6 +3,10 @@ add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always; add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always; add_header X-Content-Type-Options "nosniff" always;
add_header X-UA-Compatible "IE=Edge" always; add_header X-UA-Compatible "IE=Edge" always;
add_header Referrer-Policy "{{ data.referrer_policy }}" always;<!--
✔ CSP--><span ng-if="isCSP()">
add_header Content-Security-Policy "{{ data.content_security_policy }}" always;</span>
# . files # . files
location ~ /\. { location ~ /\. {

Loading…
Cancel
Save