Skip to content

Commit cc7d6c6

Browse files
committed
delete oks ceremony command
We've been developing ceremonies as scripts that execute a series of `oks` commands. The `oks ceremony` command hasn't been updated since the provisioning ceremony and keeping it up to date has exceeded the point of deminishing returns.
1 parent 2c5150b commit cc7d6c6

File tree

1 file changed

+0
-149
lines changed

1 file changed

+0
-149
lines changed

src/main.rs

Lines changed: 0 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -106,32 +106,6 @@ enum Command {
106106
#[command(subcommand)]
107107
command: HsmCommand,
108108
},
109-
/// Execute the OKS provisioning ceremony in a single command. This
110-
/// is equivalent to executing `hsm initialize`, `hsm generate`,
111-
/// `ca initialize`, and `ca sign`.
112-
Ceremony {
113-
#[clap(long, env, default_value = INPUT_PATH)]
114-
spec: PathBuf,
115-
116-
#[clap(long, env, default_value = INPUT_PATH)]
117-
key_spec: PathBuf,
118-
119-
/// Path to the YubiHSM PKCS#11 module
120-
#[clap(
121-
long,
122-
env = "OKS_PKCS11_PATH",
123-
default_value = "/usr/lib/pkcs11/yubihsm_pkcs11.so"
124-
)]
125-
pkcs11_path: PathBuf,
126-
127-
#[clap(flatten)]
128-
secret_method: SecretOutputArg,
129-
130-
#[clap(long, env)]
131-
/// Challenge the caller for a new password, don't generate a
132-
/// random one for them.
133-
passwd_challenge: bool,
134-
},
135109
}
136110

137111
#[derive(Subcommand, Debug, PartialEq)]
@@ -343,115 +317,6 @@ fn get_new_passwd(hsm: Option<&mut Hsm>) -> Result<Zeroizing<String>> {
343317
Ok(passwd)
344318
}
345319

346-
/// Perform all operations that make up the ceremony for provisioning an
347-
/// offline keystore.
348-
fn do_ceremony<P: AsRef<Path>>(
349-
spec: P,
350-
key_spec: P,
351-
pkcs11_path: P,
352-
output: &SecretOutputArg,
353-
challenge: bool,
354-
args: &Args,
355-
) -> Result<()> {
356-
let passwd_new = {
357-
// assume YubiHSM is in default state: use default auth credentials
358-
let passwd = Zeroizing::new("password".to_string());
359-
let mut hsm = Hsm::new(
360-
1,
361-
&passwd,
362-
&args.output,
363-
&args.state,
364-
true,
365-
args.transport,
366-
)?;
367-
368-
let wrap = BackupKey::from_rng(&mut hsm)?;
369-
let (shares, verifier) = wrap.split(&mut hsm)?;
370-
let verifier = serde_json::to_string(&verifier)?;
371-
debug!("JSON: {}", verifier);
372-
let verifier_path = args.output.join(VERIFIER_PATH);
373-
debug!(
374-
"Serializing verifier as json to: {}",
375-
verifier_path.display()
376-
);
377-
378-
fs::write(verifier_path, verifier)?;
379-
380-
println!(
381-
"\nWARNING: The wrap / backup key has been created and stored in the\n\
382-
YubiHSM. It will now be split into {} key shares and each share\n\
383-
will be individually output. Before each keyshare is\n\
384-
printed, the operator will be prompted to ensure the appropriate key\n\
385-
custodian is present in front of the printer.\n\n\
386-
Press enter to begin the key share recording process ...",
387-
LIMIT,
388-
);
389-
390-
let secret_writer = secret_writer::get_writer(output)?;
391-
for (i, share) in shares.as_ref().iter().enumerate() {
392-
let share_num = i + 1;
393-
println!(
394-
"When key custodian {num} is ready, press enter to print share \
395-
{num}",
396-
num = share_num,
397-
);
398-
util::wait_for_line()?;
399-
400-
// we're iterating over &Share so we've gotta clone it to wrap it
401-
// in a `Zeroize` like `share` expects
402-
secret_writer.share(i, LIMIT, &Zeroizing::new(*share))?;
403-
println!(
404-
"When key custodian {} has collected their key share, press enter",
405-
share_num,
406-
);
407-
util::wait_for_line()?;
408-
}
409-
410-
hsm.import_backup_key(wrap)?;
411-
info!("Collecting YubiHSM attestation cert.");
412-
hsm.dump_attest_cert::<String>(None)?;
413-
414-
let passwd = if challenge {
415-
get_new_passwd(None)?
416-
} else {
417-
get_new_passwd(Some(&mut hsm))?
418-
};
419-
420-
secret_writer.password(&passwd)?;
421-
hsm.replace_default_auth(&passwd)?;
422-
passwd
423-
};
424-
{
425-
// use new password to auth
426-
let hsm = Hsm::new(
427-
2,
428-
&passwd_new,
429-
&args.output,
430-
&args.state,
431-
true,
432-
args.transport,
433-
)?;
434-
hsm.generate(key_spec.as_ref())?;
435-
}
436-
437-
// for each key_spec in `key_spec` initialize Ca
438-
let cas = initialize_all_ca(
439-
key_spec.as_ref(),
440-
pkcs11_path.as_ref(),
441-
&args.state,
442-
&args.output,
443-
&passwd_new,
444-
)?;
445-
sign_all(
446-
&cas,
447-
spec.as_ref(),
448-
&args.state,
449-
&args.output,
450-
args.transport,
451-
&passwd_new,
452-
)
453-
}
454-
455320
pub fn initialize_all_ca<P: AsRef<Path>>(
456321
key_spec: P,
457322
pkcs11_path: P,
@@ -975,19 +840,5 @@ fn main() -> Result<()> {
975840
}
976841
}
977842
}
978-
Command::Ceremony {
979-
ref spec,
980-
ref key_spec,
981-
ref pkcs11_path,
982-
ref secret_method,
983-
passwd_challenge,
984-
} => do_ceremony(
985-
spec,
986-
key_spec,
987-
pkcs11_path,
988-
secret_method,
989-
passwd_challenge,
990-
&args,
991-
),
992843
}
993844
}

0 commit comments

Comments
 (0)