Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stephane VAROQUI
slapos
Commits
ca925f86
Commit
ca925f86
authored
Jul 28, 2014
by
Cédric Le Ninivin
Committed by
Nicolas Wavrant
Jul 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: Configurable and protected rewrite rule for local service
parent
d2b123c4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
5 deletions
+32
-5
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+4
-4
stack/monitor/cgi-httpd.conf.in
stack/monitor/cgi-httpd.conf.in
+16
-0
stack/monitor/monitor.cfg.in
stack/monitor/monitor.cfg.in
+4
-0
stack/monitor/webfile-directory/index.cgi.in
stack/monitor/webfile-directory/index.cgi.in
+3
-1
stack/monitor/webfile-directory/index.html.jinja2
stack/monitor/webfile-directory/index.html.jinja2
+5
-0
No files found.
stack/monitor/buildout.cfg
View file @
ca925f86
...
...
@@ -41,7 +41,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/monitor.cfg.in
output = ${buildout:directory}/monitor.cfg
filename = monitor.cfg
md5sum =
852a0e205e005969547cce8192e531cd
md5sum =
20dc52c906e03a7c0b1234db7f999853
mode = 0644
[monitor-bin]
...
...
@@ -57,7 +57,7 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
md5sum =
335e618be6bbe02328cd3aaa30e29d9c
md5sum =
2d48f8b8e01fa0fdde964ed1c1547f05
filename = cgi-httpd.conf.in
mode = 0644
...
...
@@ -65,7 +65,7 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum =
af1adc107b73290afb98d011f7307de1
md5sum =
e759977b21c70213daa4c2701f2c2078
destination = ${buildout:directory}/parts/monitor-index
filename = index.cgi.in
mode = 0644
...
...
@@ -75,7 +75,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
destination = ${buildout:directory}/parts/monitor-template-index
md5sum =
05051a2ff81ce7dc2eef3106d75b33f9
md5sum =
7400c8cfa16a15a0d41f512b8bbb1581
filename = index.html.jinja2
mode = 0644
...
...
stack/monitor/cgi-httpd.conf.in
View file @
ca925f86
...
...
@@ -21,6 +21,9 @@ LoadModule autoindex_module modules/mod_autoindex.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
# SSL Configuration
<IfDefine !SSLConfigured>
...
...
@@ -61,3 +64,16 @@ Require valid-user
Options Indexes FollowSymLinks
Satisfy all
</Directory>
<Location /rewrite>
AuthType Basic
AuthName "Private access"
AuthUserFile "{{ monitor_parameters.get('htaccess-file') }}"
Require valid-user
</Location>
ProxyVia On
RewriteEngine On
{% for key, value in monitor_rewrite_rule.iteritems() %}
RewriteRule ^/rewrite/{{ key }}($|/.*) {{ value }}/$1 [P,L]
{% endfor %}
stack/monitor/monitor.cfg.in
View file @
ca925f86
...
...
@@ -105,6 +105,7 @@ context =
key apache_update_command :update-apache-access
raw extra_eggs_interpreter ${buildout:directory}/bin/${extra-eggs:interpreter}
raw default_page /static/welcome.html
section rewrite_element monitor-rewrite-rule
[deploy-index-template]
recipe = hexagonit.recipe.download
...
...
@@ -234,6 +235,8 @@ status-history-length = 5
recipe = slapos.cookbook:zero-knowledge.read
filename = $${public:filename}
[monitor-rewrite-rule]
# XXX could it be something lighter?
[monitor-httpd-configuration]
pid-file = $${monitor-directory:run}/cgi-httpd.pid
...
...
@@ -252,6 +255,7 @@ context =
section directory monitor-directory
section monitor_parameters monitor-parameters
section httpd_configuration monitor-httpd-configuration
section monitor_rewrite_rule monitor-rewrite-rule
[cgi-httpd-wrapper]
recipe = slapos.cookbook:wrapper
...
...
stack/monitor/webfile-directory/index.cgi.in
View file @
ca925f86
...
...
@@ -23,6 +23,8 @@ monitor_password_script_path = "{{ monitor_password_script_path }}"
monitor_apache_password_command = "{{ apache_update_command }}"
monitor_rewrite = "{{ ' '.join(rewrite_element.keys()) }}"
########
# Password functions
#######
...
...
@@ -185,4 +187,4 @@ else:
else:
html_base = jinja2.Template(open('{{ index_template }}').read())
print
print html_base.render(tree=make_menu(), default_page="{{ default_page }}")
print html_base.render(tree=make_menu(), default_page="{{ default_page }}"
, monitor_rewrite=monitor_rewrite
)
stack/monitor/webfile-directory/index.html.jinja2
View file @
ca925f86
...
...
@@ -19,6 +19,11 @@
{% endfor %}
<li
class=
"pure-menu-heading category"
>
Files
</li>
<li><a
href=
"./private/"
class=
"link"
>
User: admin
</br>
Password is yours
</a></li>
<li
class=
"pure-menu-heading category"
>
Local Service
</li>
{% set rewrite_list = monitor_rewrite.split() %}
{% for path in rewrite_list %}
<li><a
href=
"./rewrite/{{path}}/"
class=
"link"
>
{{path}}
</a></li>
{% endfor %}
</ul>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment