Repository navigation
Publish a revocation list the login nodes read #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a6d61d3
Record each revocation's expiry on the revocation record
lahirujayathilake 99d0881
Generate and publish a revocation list
lahirujayathilake a7d1b67
Share the revocation list with the compose login node
lahirujayathilake ba55059
Restore the revocation list when its file goes missing
lahirujayathilake 45a6f17
Revocation tests
lahirujayathilake 8711648
Updated the doc with the revoked key storage path
lahirujayathilake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| TrustedUserCAKeys /etc/ssh/trusted-user-ca-keys.pub | ||
| AuthorizedPrincipalsFile /etc/ssh/auth_principals/%u | ||
| RevokedKeys /etc/ssh/revoked_keys.krl | ||
| RevokedKeys /etc/ssh/krl/revoked_keys | ||
| PasswordAuthentication no |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package handler | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "net/http" | ||
|
|
||
| "github.com/apache/airavata-custos/signer/internal/krl" | ||
| ) | ||
|
|
||
| type KRLSource interface { | ||
| Snapshot() krl.Snapshot | ||
| } | ||
|
|
||
| type KRLHandler struct { | ||
| source KRLSource | ||
| } | ||
|
|
||
| func NewKRLHandler(source KRLSource) *KRLHandler { | ||
| return &KRLHandler{source: source} | ||
| } | ||
|
|
||
| func (h *KRLHandler) Handle(w http.ResponseWriter, r *http.Request) { | ||
| s := h.source.Snapshot() | ||
| etag := fmt.Sprintf(`"%d"`, s.Version) | ||
| w.Header().Set("ETag", etag) | ||
| w.Header().Set("Cache-Control", "no-cache") | ||
| if r.Header.Get("If-None-Match") == etag { | ||
| w.WriteHeader(http.StatusNotModified) | ||
| return | ||
| } | ||
| w.Header().Set("Content-Type", "application/octet-stream") | ||
| w.Write(s.Bytes) | ||
| } |
49 changes: 49 additions & 0 deletions
49
extensions/SSH-Certificate-Signer/internal/handler/krl_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package handler | ||
|
|
||
| import ( | ||
| "net/http" | ||
| "net/http/httptest" | ||
| "testing" | ||
|
|
||
| "github.com/apache/airavata-custos/signer/internal/krl" | ||
| ) | ||
|
|
||
| type fixedKRL krl.Snapshot | ||
|
|
||
| func (f fixedKRL) Snapshot() krl.Snapshot { return krl.Snapshot(f) } | ||
|
|
||
| // Make sure a node gets the list with its version, and a 304 with no body once it has that version. | ||
| func TestKRL_ServesTheListOnceUntilTheVersionChanges(t *testing.T) { | ||
| h := NewKRLHandler(fixedKRL{Bytes: []byte("list"), Version: 7}) | ||
|
|
||
| first := httptest.NewRecorder() | ||
| h.Handle(first, httptest.NewRequest(http.MethodGet, "/api/v1/krl", nil)) | ||
| if first.Code != http.StatusOK || first.Body.String() != "list" || first.Header().Get("ETag") != `"7"` { | ||
| t.Fatalf("got %d %q etag %s", first.Code, first.Body, first.Header().Get("ETag")) | ||
| } | ||
|
|
||
| req := httptest.NewRequest(http.MethodGet, "/api/v1/krl", nil) | ||
| req.Header.Set("If-None-Match", `"7"`) | ||
| again := httptest.NewRecorder() | ||
| h.Handle(again, req) | ||
| if again.Code != http.StatusNotModified || again.Body.Len() != 0 { | ||
| t.Fatalf("got %d with %d bytes, want 304 and no body", again.Code, again.Body.Len()) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.