Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
eb0a5d44
Unverified
Commit
eb0a5d44
authored
Sep 18, 2025
by
Patrick Devine
Committed by
GitHub
Sep 18, 2025
Browse files
auth: check the permissions on the private key to see if it's readable (#12336)
parent
ceac416e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
auth/auth.go
auth/auth.go
+15
-3
No files found.
auth/auth.go
View file @
eb0a5d44
...
...
@@ -19,16 +19,28 @@ import (
const
defaultPrivateKey
=
"id_ed25519"
func
keyPath
()
(
string
,
error
)
{
file
Exists
:=
func
(
fp
string
)
bool
{
file
IsReadable
:=
func
(
fp
string
)
bool
{
info
,
err
:=
os
.
Stat
(
fp
)
if
err
!=
nil
{
return
false
}
return
!
info
.
IsDir
()
// Check that it's a regular file, not a directory or other file type
if
!
info
.
Mode
()
.
IsRegular
()
{
return
false
}
// Try to open it to check readability
file
,
err
:=
os
.
Open
(
fp
)
if
err
!=
nil
{
return
false
}
file
.
Close
()
return
true
}
systemPath
:=
filepath
.
Join
(
"/usr/share/ollama/.ollama"
,
defaultPrivateKey
)
if
file
Exists
(
systemPath
)
{
if
file
IsReadable
(
systemPath
)
{
return
systemPath
,
nil
}
...
...
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