Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
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
Nounous
re2o
Commits
e9f47677
Commit
e9f47677
authored
Jun 23, 2018
by
chirac
Committed by
Maël Kervella
Jul 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gestion complete des algo de fingerprintssh
parent
0b4c52a4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
201 additions
and
3 deletions
+201
-3
machines/migrations/0085_auto_20180623_1817.py
machines/migrations/0085_auto_20180623_1817.py
+20
-0
machines/models.py
machines/models.py
+1
-1
machines/templates/machines/aff_sshfpralgo.html
machines/templates/machines/aff_sshfpralgo.html
+47
-0
machines/templates/machines/index_sshfpralgo.html
machines/templates/machines/index_sshfpralgo.html
+39
-0
machines/templates/machines/machine.html
machines/templates/machines/machine.html
+8
-0
machines/templates/machines/sidebar.html
machines/templates/machines/sidebar.html
+6
-0
machines/urls.py
machines/urls.py
+12
-0
machines/views.py
machines/views.py
+68
-2
No files found.
machines/migrations/0085_auto_20180623_1817.py
0 → 100644
View file @
e9f47677
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-06-23 16:17
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'machines'
,
'0084_auto_20180623_1651'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'sshfpralgo'
,
name
=
'name'
,
field
=
models
.
CharField
(
max_length
=
256
),
),
]
machines/models.py
View file @
e9f47677
...
...
@@ -236,7 +236,7 @@ class SshFprAlgo(RevMixin, AclMixin, models.Model):
"""Un aglorithme de création de la fingerprint ssh"""
PRETTY_NAME
=
"Algo de clef ssh"
name
=
models
.
Text
Field
(
max_length
=
256
)
name
=
models
.
Char
Field
(
max_length
=
256
)
class
Meta
:
permissions
=
(
...
...
machines/templates/machines/aff_sshfpralgo.html
0 → 100644
View file @
e9f47677
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2018 Gabriel Détraz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
<table
class=
"table table-striped"
>
<thead>
<tr>
<th>
Nom de l'algo
</th>
<th></th>
</tr>
</thead>
{% for sshfpralgo in sshfpralgo_list %}
<tr>
<td>
{{ sshfpralgo.name }}
</td>
<td
class=
"text-right"
>
{% can_edit sshfpralgo %}
{% include 'buttons/edit.html' with href='machines:edit-sshfpralgo' id=sshfpralgo.id %}
{% acl_end %}
{% can_delete sshfpralgo %}
{% include 'buttons/suppr.html' with href='machines:del-sshfpralgo' id=sshfpralgo.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='sshfpralgo' id=sshfpralgo.id %}
</td>
</tr>
{% endfor %}
</table>
machines/templates/machines/index_sshfpralgo.html
0 → 100644
View file @
e9f47677
{% extends "machines/sidebar.html" %}
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2018 Gabriel Détraz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load bootstrap3 %}
{% load acl %}
{% block title %}Machines{% endblock %}
{% block content %}
<h2>
Liste des algo fingerprint ssh
</h2>
{% can_create SshFprAlgo %}
<a
class=
"btn btn-primary btn-sm"
role=
"button"
href=
"{% url 'machines:new-sshfpralgo' %}"
><i
class=
"fa fa-plus"
></i>
Ajouter un algo ssh
</a>
{% acl_end %}
{% include "machines/aff_sshfpralgo.html" with sshfpralgo_list=sshfpralgo_list %}
<br
/>
<br
/>
<br
/>
{% endblock %}
machines/templates/machines/machine.html
View file @
e9f47677
...
...
@@ -81,6 +81,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if sshfingerprintform %}
{% bootstrap_form_errors sshfingerprintform %}
{% endif %}
{% if sshfpralgoform %}
{% bootstrap_form_errors sshfpralgoform %}
{% endif %}
...
...
@@ -162,6 +166,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h3>
SshFingerprint
</h3>
{% bootstrap_form sshfingerprintform %}
{% endif %}
{% if sshfpralgoform %}
<h3>
Algorithme de fingerprint ssh
</h3>
{% bootstrap_form sshfpralgoform %}
{% endif %}
{% bootstrap_button action_name button_type="submit" icon="star" %}
</form>
<br
/>
...
...
machines/templates/machines/sidebar.html
View file @
e9f47677
...
...
@@ -44,6 +44,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Extensions et zones
</a>
{% acl_end %}
{% can_view_all SshFprAlgo %}
<a
class=
"list-group-item list-group-item-info"
href=
"{% url "
machines:index-sshfpralgo
"
%}"
>
<i
class=
"fa fa-list-ul"
></i>
Algo de fingerprint ssh
</a>
{% acl_end %}
{% can_view_all IpType %}
<a
class=
"list-group-item list-group-item-info"
href=
"{% url "
machines:index-iptype
"
%}"
>
<i
class=
"fa fa-list-ul"
></i>
...
...
machines/urls.py
View file @
e9f47677
...
...
@@ -119,6 +119,18 @@ urlpatterns = [
url
(
r
'^index_sshfingerprint/(?P<machineid>[0-9]+)$'
,
views
.
index_sshfingerprint
,
name
=
'index-sshfingerprint'
),
url
(
r
'^new_sshfpralgo/$'
,
views
.
new_sshfpralgo
,
name
=
'new-sshfpralgo'
),
url
(
r
'^edit_sshfpralgo/(?P<sshfpralgoid>[0-9]+)$'
,
views
.
edit_sshfpralgo
,
name
=
'edit-sshfpralgo'
),
url
(
r
'^del_sshfpralgo/(?P<sshfpralgoid>[0-9]+)$'
,
views
.
del_sshfpralgo
,
name
=
'del-sshfpralgo'
),
url
(
r
'^index_sshfpralgo/$'
,
views
.
index_sshfpralgo
,
name
=
'index-sshfpralgo'
),
url
(
r
'^add_service/$'
,
views
.
add_service
,
name
=
'add-service'
),
url
(
r
'^edit_service/(?P<serviceid>[0-9]+)$'
,
views
.
edit_service
,
...
...
machines/views.py
View file @
e9f47677
...
...
@@ -479,7 +479,7 @@ def new_sshfingerprint(request, machine, **_kwargs):
messages
.
success
(
request
,
"Fingerprint ssh ajoutée"
)
return
redirect
(
reverse
(
'machines:index-sshfingerprint'
,
kwargs
=
{
'machine'
:
str
(
machine
.
id
)}
kwargs
=
{
'machine
id
'
:
str
(
machine
.
id
)}
))
return
form
(
{
'sshfingerprintform'
:
sshfingerprint
,
'action_name'
:
'Créer'
},
...
...
@@ -499,7 +499,7 @@ def edit_sshfingerprint(request, sshfingerprint_instance, **_kwargs):
if
sshfingerprint
.
is_valid
():
if
sshfingerprint
.
changed_data
:
sshfingerprint
.
save
()
messages
.
success
(
request
,
"
Ipv6
modifiée"
)
messages
.
success
(
request
,
"
Ssh fingerprint
modifiée"
)
return
redirect
(
reverse
(
'machines:index-sshfingerprint'
,
kwargs
=
{
'machineid'
:
str
(
sshfingerprint_instance
.
machine
.
id
)}
...
...
@@ -530,6 +530,72 @@ def del_sshfingerprint(request, sshfingerprint, **_kwargs):
)
@
login_required
@
can_create
(
SshFprAlgo
)
def
new_sshfpralgo
(
request
,
**
_kwargs
):
"""Nouvelle sshfpralgo"""
sshfpralgo
=
SshFprAlgoForm
(
request
.
POST
or
None
,
)
if
sshfpralgo
.
is_valid
():
sshfpralgo
.
save
()
messages
.
success
(
request
,
"Algo Fingerprint ssh ajouté"
)
return
redirect
(
reverse
(
'machines:index-sshfpralgo'
))
return
form
(
{
'sshfpralgoform'
:
sshfpralgo
,
'action_name'
:
'Créer'
},
'machines/machine.html'
,
request
)
@
login_required
@
can_edit
(
SshFprAlgo
)
def
edit_sshfpralgo
(
request
,
sshfpralgo_instance
,
**
_kwargs
):
"""Edition d'une sshfpralgo"""
sshfpralgo
=
SshFprAlgoForm
(
request
.
POST
or
None
,
instance
=
sshfpralgo_instance
)
if
sshfpralgo
.
is_valid
():
if
sshfpralgo
.
changed_data
:
sshfpralgo
.
save
()
messages
.
success
(
request
,
"Algo de sshfp modifiée"
)
return
redirect
(
reverse
(
'machines:index-sshfpralgo'
))
return
form
(
{
'sshfpralgoform'
:
sshfpralgo
,
'action_name'
:
'Editer'
},
'machines/machine.html'
,
request
)
@
login_required
@
can_delete
(
SshFprAlgo
)
def
del_sshfpralgo
(
request
,
sshfpralgo
,
**
_kwargs
):
""" Supprime une sshfpralgo"""
if
request
.
method
==
"POST"
:
try
:
sshfpralgo
.
delete
()
messages
.
success
(
request
,
"La sshfpralgo a été détruite"
)
except
ProtectedError
:
messages
.
error
(
request
,
(
"L'algo est affectée à au moins une fingerprint ssh, "
"vous ne pouvez pas le supprimer"
)
)
return
redirect
(
reverse
(
'machines:index-sshfpralgo'
))
return
form
(
{
'objet'
:
sshfpralgo
,
'objet_name'
:
'sshfpralgo'
},
'machines/delete.html'
,
request
)
@
login_required
@
can_create
(
IpType
)
def
add_iptype
(
request
):
...
...
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