Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fa43cd77
authored
Jan 22, 2014
by
Paul Kilgo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/2.1.0'
parents
ae7e943b
83174171
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
43 additions
and
18 deletions
+43
-18
MANIFEST.in
+1
-0
README.md
+12
-4
README.upgrading.md
+1
-1
django-sshkey-lookup
+0
-0
django_sshkey/__init__.py
+1
-1
django_sshkey/management/commands/sshkey_authorized_keys_command.py
+2
-3
django_sshkey/models.py
+1
-7
django_sshkey/util.py
+11
-0
lookup.py
+4
-2
lookup.sh
+2
-0
setup.py
+8
-0
No files found.
MANIFEST.in
View file @
fa43cd77
...
...
@@ -4,6 +4,7 @@ include COPYING.LESSER
include README.md
include lookup.py
include lookup.sh
include django-sshkey-lookup
include openssh-6.2p2-authorized-keys-command-stdin.diff
recursive-include django_sshkey/management *.py
recursive-include django_sshkey/migrations *.py
...
...
README.md
View file @
fa43cd77
...
...
@@ -51,9 +51,9 @@ In all cases it is recommended and/or required that the command specified with
AuthorizedKeysCommand be a shell script that is owned by and only writable by
root which invokes one of the commands below:
## Using
lookup.sh
## Using
django-sshkey-lookup
*Usage:
lookup.sh
URL [USERNAME]*
*Usage:
django-sshkey-lookup
URL [USERNAME]*
URL should be the full URL to /sshkey/lookup on your Django web server running
the sshkey app.
...
...
@@ -67,15 +67,23 @@ standard input; if the key is found it is printed to standard output.
This command assumes that some fairly standard commands, like ssh-keygen and
curl, are found in $PATH.
This command is equivalent to the old script
`lookup.sh`
but was renamed to
have a less ambiguous name when installed system-wide. A symlink is left in
its place for backwards compatibility.
This is generally the fastest method.
## Using
lookup.py
## Using
django-sshkey-pylookup
*Usage:
lookup.py
URL [USERNAME]*
*Usage:
django-sshkey-pylookup
URL [USERNAME]*
Same as above, but it's all written in Python and doesn't rely on external
commands.
This script is generated by setuptools when this package is installed. The old
equivalent,
`lookup.py`
is available with a deprecation warning for backwards
compatibility.
The parent directory of the django
\_
sshkey app must be in PYTHONPATH.
This is generally the second fastest method.
...
...
README.upgrading.md
View file @
fa43cd77
...
...
@@ -8,7 +8,7 @@ will only be present on minor version changes.
To use South migrations, you must have the south app in your project's
INSTALLED_APPS.
The following table maps django-
anyvcs
version to migration labels:
The following table maps django-
sshkey
version to migration labels:
Version App Name Label Notes
1.0.x sshkey 0001 Migrations were not present in 1.0.x
...
...
lookup.sh
→
django-sshkey-lookup
View file @
fa43cd77
File moved
django_sshkey/__init__.py
View file @
fa43cd77
...
...
@@ -15,4 +15,4 @@
# You should have received a copy of the GNU Lesser General Public License
# along with django-sshkey. If not, see <http://www.gnu.org/licenses/>.
__version__
=
'2.
0.1
'
__version__
=
'2.
1.0
'
django_sshkey/management/commands/sshkey_authorized_keys_command.py
View file @
fa43cd77
...
...
@@ -17,9 +17,8 @@
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.conf
import
settings
from
django_sshkey.models
import
sshkey_fingerprint
,
UserKey
import
base64
import
hashlib
from
django_sshkey.models
import
UserKey
from
django_sshkey.util
import
sshkey_fingerprint
import
sys
class
Command
(
BaseCommand
):
...
...
django_sshkey/models.py
View file @
fa43cd77
...
...
@@ -18,17 +18,11 @@
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
ValidationError
import
base64
import
hashlib
from
django_sshkey.util
import
sshkey_fingerprint
import
re
sshkey_re
=
re
.
compile
(
r'(?P<type>[\w-]+)\s+(?P<b64key>\S+)(?:\s+(?P<comment>\S+))?$'
)
def
sshkey_fingerprint
(
b64key
):
key
=
base64
.
b64decode
(
b64key
)
fp_plain
=
hashlib
.
md5
(
key
)
.
hexdigest
()
return
':'
.
join
(
a
+
b
for
a
,
b
in
zip
(
fp_plain
[::
2
],
fp_plain
[
1
::
2
]))
class
UserKey
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
,
db_index
=
True
)
name
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
)
...
...
django_sshkey/util.py
View file @
fa43cd77
...
...
@@ -15,6 +15,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with django-sshkey. If not, see <http://www.gnu.org/licenses/>.
def
sshkey_fingerprint
(
b64key
):
import
base64
import
hashlib
key
=
base64
.
b64decode
(
b64key
)
fp_plain
=
hashlib
.
md5
(
key
)
.
hexdigest
()
return
':'
.
join
(
a
+
b
for
a
,
b
in
zip
(
fp_plain
[::
2
],
fp_plain
[
1
::
2
]))
def
lookup_command
(
args
):
import
sys
import
urllib
...
...
@@ -38,3 +45,7 @@ def lookup_command(args):
status
=
0
sys
.
stdout
.
write
(
line
)
sys
.
exit
(
status
)
def
lookup_main
():
import
sys
lookup_command
(
sys
.
argv
[
1
:])
lookup.py
View file @
fa43cd77
...
...
@@ -16,7 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with django-sshkey. If not, see <http://www.gnu.org/licenses/>.
import
warnings
import
django_sshkey.util
import
sys
django_sshkey
.
util
.
lookup_command
(
sys
.
argv
[
1
:])
warnings
.
warn
(
"lookup.py is deprecated; use django-sshkey-pylookup"
,
DeprecationWarning
)
django_sshkey
.
util
.
lookup_main
()
lookup.sh
0 → 120000
View file @
fa43cd77
django-sshkey-lookup
\ No newline at end of file
setup.py
View file @
fa43cd77
...
...
@@ -31,4 +31,12 @@ setup(
'Topic :: Internet :: WWW/HTTP'
,
'Topic :: Internet :: WWW/HTTP :: Dynamic Content'
,
],
scripts
=
[
'django-sshkey-lookup'
,
],
entry_points
=
{
'console_scripts'
:
[
'django-sshkey-pylookup = django_sshkey.util:lookup_main'
,
],
},
)
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