Skip to content

Add ktool - #55

Merged
Firstyear merged 17 commits into
kanidm:mainfrom
scabrero:wt-ktool
May 13, 2026
Merged

Firstyear merged 17 commits into
kanidm:mainfrom
scabrero:wt-ktool

Conversation

@scabrero

Copy link
Copy Markdown
Collaborator

Only 'ccahe dump' subcommand for now.

Comment thread ktool/src/main.rs Outdated
Comment thread libkrimes/Cargo.toml Outdated
Comment thread libkrimes/src/asn1/ticket_flags.rs
Comment thread libkrimes/src/ccache/cc_dir.rs Outdated
Comment thread libkrimes/src/ccache/cc_dir.rs Outdated
Comment thread libkrimes/src/ccache/cc_dir.rs Outdated
Comment thread libkrimes/src/ccache/cc_dir.rs Outdated
Comment thread libkrimes/src/ccache/cc_dir.rs Outdated
{
if let Some(path) = entry.0.path().to_str() {
println!("{path}:");
if let Err(e) = super::cc_file::dump(path) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we wanted to make this a bit more generic, it should be that given a ccache spec, we return an iterator over cc items, and then the caller is responsible to call .dump(), or any other things they may want to do.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


impl fmt::Display for KeyBlockV4 {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[{}] {}", self.enc_type, self.data)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall, is KeyBlock a private key?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the session key

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be hiding this then?

Comment thread libkrimes/src/ccache/mod.rs Outdated
let ccache_name = parse_ccache_name(ccache_name);

if ccache_name.starts_with("FILE:") {
return cc_file::dump(ccache_name.as_str());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment, we already know the type here when we call dump, so why not split here?

scabrero added 6 commits May 11, 2026 10:33
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
@scabrero

Copy link
Copy Markdown
Collaborator Author

Pushed an update, dump() is a trait fn now and I added collection iterators.

@Firstyear Firstyear left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment but otherwise looks good :)


impl fmt::Display for KeyBlockV4 {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[{}] {}", self.enc_type, self.data)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be hiding this then?

scabrero and others added 11 commits May 12, 2026 12:58
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
Signed-off-by: Samuel Cabrero <scabrero@suse.com>
…ction

Signed-off-by: Samuel Cabrero <scabrero@suse.com>
@scabrero

Copy link
Copy Markdown
Collaborator Author

KeyBlock only printed if developer feature enabled.

@Firstyear
Firstyear merged commit 05a7442 into kanidm:main May 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants