Module: Yast::CaManagementCommandlineInclude
- Defined in:
- ../../src/include/ca-management/commandline.rb
Instance Method Summary (collapse)
-
- (Object) cmdCreateCA(options)
Create CA via command line.
-
- (Object) cmdCreateCertificate(options)
Create a certificate via command line.
-
- (Object) cmdCreateCRL(options)
Create a CRL via command line.
-
- (Object) cmdExportCAtoFile(options)
Dialog for exporting CA to file.
-
- (Object) cmdExportCertificateToFile(options)
exporting Certificate to file.
-
- (Object) cmdExportCRLtoFile(options)
exporting CRL to file.
- - (Object) initialize_ca_management_commandline(include_target)
Instance Method Details
- (Object) cmdCreateCA(options)
Create CA via command line
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File '../../src/include/ca-management/commandline.rb', line 48 def cmdCreateCA() = deep_copy() new_cert_init("Root CA") CaMgm.CAName = Ops.get_string(, "caname", "") CaMgm.commonName = Ops.get_string(, "cn", "") CaMgm.emailList = [ { "default" => true, "name" => Ops.get_string(, "email", "") } ] CaMgm.organisationUnit = Ops.get_string(, "ou", "") CaMgm.organisation = Ops.get_string(, "o", "") CaMgm.locality = Ops.get_string(, "l", "") CaMgm.state = Ops.get_string(, "st", "") CaMgm.country = Ops.get_string(, "c", "") CaMgm.validPeriod = Builtins.tointeger( Ops.get_string(, "days", "365") ) CaMgm.keyLength = Builtins.tointeger( Ops.get_string(, "keyLength", "1024") ) if Builtins.haskey(, "keyPasswd") CaMgm.password = Ops.get_string(, "keyPasswd", "") else CaMgm.password = strip(Builtins.getenv("keyPasswd")) end if !cert_write("Root CA") showErrorCaManagement return false end true end |
- (Object) cmdCreateCertificate(options)
Create a certificate via command line
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File '../../src/include/ca-management/commandline.rb', line 82 def cmdCreateCertificate() = deep_copy() CaMgm.CAName = Ops.get_string(, "caname", "") CaMgm.currentCA = Ops.get_string(, "caname", "") if Builtins.haskey(, "capasswd") Ops.set( CaMgm.passwdMap, CaMgm.CAName, Ops.get_string(, "capasswd", "") ) else Ops.set( CaMgm.passwdMap, CaMgm.CAName, strip(Builtins.getenv("capasswd")) ) end if Ops.get_string(, "type", "") == "client" new_cert_init("Client Certificate") elsif Ops.get_string(, "type", "") == "server" new_cert_init("Server Certificate") else CommandLine.Print(_("Wrong kind of certificate.")) return false end CaMgm.CAName = Ops.get_string(, "caname", "") CaMgm.commonName = Ops.get_string(, "cn", "") CaMgm.emailList = [ { "default" => true, "name" => Ops.get_string(, "email", "") } ] CaMgm.organisationUnit = Ops.get_string(, "ou", "") CaMgm.organisation = Ops.get_string(, "o", "") CaMgm.locality = Ops.get_string(, "l", "") CaMgm.state = Ops.get_string(, "st", "") CaMgm.country = Ops.get_string(, "c", "") CaMgm.validPeriod = Builtins.tointeger( Ops.get_string(, "days", "365") ) CaMgm.keyLength = Builtins.tointeger( Ops.get_string(, "keyLength", "1024") ) if Builtins.haskey(, "keyPasswd") CaMgm.password = Ops.get_string(, "keyPasswd", "") else CaMgm.password = strip(Builtins.getenv("keyPasswd")) end ret = true if Ops.get_string(, "kind", "") == "client" if !cert_write("Client Certificate") showErrorCaManagement ret = false end else if !cert_write("Server Certificate") showErrorCaManagement ret = false end end ret end |
- (Object) cmdCreateCRL(options)
Create a CRL via command line
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File '../../src/include/ca-management/commandline.rb', line 150 def cmdCreateCRL() = deep_copy() # generating CRL ret = nil param = {} if Builtins.haskey(, "capasswd") Ops.set(param, "caPasswd", Ops.get_string(, "capasswd", "")) else Ops.set(param, "caPasswd", strip(Builtins.getenv("capasswd"))) end Ops.set(param, "caName", Ops.get_string(, "caname", "")) Ops.set( param, "days", Builtins.tointeger(Ops.get_string(, "days", "365")) ) ret = YaPI::CaManagement.AddCRL(param) if ret == nil || ret == false showErrorCaManagement return false end ret end |
- (Object) cmdExportCAtoFile(options)
Dialog for exporting CA to file
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File '../../src/include/ca-management/commandline.rb', line 179 def cmdExportCAtoFile() = deep_copy() param = {} kind = Ops.get_string(, "certFormat", "") if !Builtins.haskey(, "capasswd") Ops.set(, "capasswd", strip(Builtins.getenv("capasswd"))) end Ops.set(param, "caPasswd", Ops.get_string(, "capasswd", "")) Ops.set(param, "caName", Ops.get_string(, "caname", "")) Ops.set(param, "destinationFile", Ops.get_string(, "file", "")) Ops.set(param, "exportFormat", kind) ret = nil if kind == "PKCS12" || kind == "PKCS12_CHAIN" if !Builtins.haskey(, "p12passwd") Ops.set(, "p12passwd", strip(Builtins.getenv("p12passwd"))) end Ops.set(param, "P12Password", Ops.get_string(, "p12passwd", "")) end ret = Convert.to_string(YaPI::CaManagement.ExportCA(param)) Builtins.y2milestone( "ExportCA(to %1) return %2", Ops.get_string(, "file", ""), ret ) if ret == nil || ret != "1" showErrorCaManagement return false end true end |
- (Object) cmdExportCertificateToFile(options)
exporting Certificate to file
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File '../../src/include/ca-management/commandline.rb', line 243 def cmdExportCertificateToFile() = deep_copy() param = {} kind = Ops.get_string(, "certFormat", "") if !Builtins.haskey(, "keyPasswd") Ops.set(, "keyPasswd", strip(Builtins.getenv("keyPasswd"))) end Ops.set(param, "caName", Ops.get_string(, "caname", "")) Ops.set(param, "caPasswd", Ops.get_string(, "capasswd", "")) Ops.set(param, "certificate", Ops.get_string(, "certname", "")) Ops.set(param, "exportFormat", kind) Ops.set(param, "destinationFile", Ops.get_string(, "file", "")) Ops.set(param, "keyPasswd", Ops.get_string(, "keyPasswd", "")) ret = nil if kind == "PKCS12" || kind == "PKCS12_CHAIN" if !Builtins.haskey(, "p12passwd") Ops.set(, "p12passwd", strip(Builtins.getenv("p12passwd"))) end Ops.set(param, "P12Password", Ops.get_string(, "p12passwd", "")) end ret = Convert.to_string(YaPI::CaManagement.ExportCertificate(param)) Builtins.y2milestone( "ExportCertificate(to %1) return %2", Ops.get_string(, "file", ""), ret ) if ret == nil || ret != "1" showErrorCaManagement return false end true end |
- (Object) cmdExportCRLtoFile(options)
exporting CRL to file
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File '../../src/include/ca-management/commandline.rb', line 217 def cmdExportCRLtoFile() = deep_copy() param = {} Ops.set(param, "destinationFile", Ops.get_string(, "file", "")) Ops.set(param, "exportFormat", Ops.get_string(, "crlFormat", "")) Ops.set(param, "caName", Ops.get_string(, "caname", "")) Ops.set(param, "caPasswd", Ops.get_string(, "capasswd", "")) ret = nil ret = Convert.to_string(YaPI::CaManagement.ExportCRL(param)) # delete parameter for security reason :-) Ops.set(param, "caPasswd", "<was set>") Builtins.y2milestone("ExportCRL(%1) return %2", param, ret) if ret == nil || ret != "1" showErrorCaManagement return false end true end |
- (Object) initialize_ca_management_commandline(include_target)
32 33 34 35 36 37 38 39 40 41 42 43 |
# File '../../src/include/ca-management/commandline.rb', line 32 def initialize_ca_management_commandline(include_target) Yast.import "UI" textdomain "ca-management" Yast.import "CaMgm" Yast.import "YaPI::CaManagement" Yast.include include_target, "ca-management/popup.rb" Yast.include include_target, "ca-management/util.rb" Yast.include include_target, "ca-management/new_cert_read_write.rb" end |