Changeset 1726
- Timestamp:
- 10/09/10 15:50:18 (3 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 2 modified
-
dnsseckeeper.cc (modified) (6 diffs)
-
pdnssec.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/dnsseckeeper.cc
r1724 r1726 13 13 #include <boost/algorithm/string.hpp> 14 14 #include <boost/format.hpp> 15 15 #include <boost/assign/std/vector.hpp> // for 'operator+=()' 16 #include <boost/assign/list_inserter.hpp> 17 using namespace boost::assign; 16 18 namespace fs = boost::filesystem; 17 19 … … 35 37 typedef vector<pair<string, mpi*> > outputs_t; 36 38 outputs_t outputs; 37 38 outputs.push_back(make_pair("Modulus", &d_context.N));39 outputs.push_back(make_pair("PublicExponent",&d_context.E));40 outputs.push_back(make_pair("PrivateExponent",&d_context.D));41 outputs.push_back(make_pair("Prime1",&d_context.P));42 outputs.push_back(make_pair("Prime2",&d_context.Q));43 outputs.push_back(make_pair("Exponent1",&d_context.DP));44 outputs.push_back(make_pair("Exponent2",&d_context.DQ));45 outputs.push_back(make_pair("Coefficient",&d_context.QP));39 push_back(outputs)("Modulus", &d_context.N)("PublicExponent",&d_context.E) 40 ("Modulus", &d_context.N) 41 ("PublicExponent",&d_context.E) 42 ("PrivateExponent",&d_context.D) 43 ("Prime1",&d_context.P) 44 ("Prime2",&d_context.Q) 45 ("Exponent1",&d_context.DP) 46 ("Exponent2",&d_context.DQ) 47 ("Coefficient",&d_context.QP); 46 48 47 49 ret = "Private-key-format: v1.2\nAlgorithm: 5 (RSASHA1)\n"; … … 95 97 } 96 98 97 void DNSSECKeeper::addZSKFor(const std::string& name, int algorithm, bool next)99 void DNSSECKeeper::addZSKFor(const std::string& name, int algorithm, bool active) 98 100 { 99 101 DNSSECPrivateKey dpk; … … 105 107 drc.d_algorithm = algorithm; 106 108 string iscName=d_dirname+"/"+name+"/zsks/"; 107 time_t inception=getCurrentInception(); 108 time_t end=inception+14*86400; 109 110 if(next) { 111 inception += 14*86400; 112 end += 14*86400; 113 } 109 time_t inception=time(0); 110 111 114 112 115 113 struct tm ts; … … 120 118 % ts.tm_mday % ts.tm_hour % ts.tm_min).str(); 121 119 122 iscName += "-"; 123 124 gmtime_r(&end, &ts); 125 iscName += (boost::format("%04d%02d%02d%02d%02d.%u") 126 % (1900+ts.tm_year) % (ts.tm_mon + 1) 127 % ts.tm_mday % ts.tm_hour % ts.tm_min % drc.getTag()).str(); 128 120 iscName += active ? ".active" : ".passive"; 121 129 122 { 130 123 ofstream iscFile((iscName+".isc").c_str()); … … 224 217 memset(&ts2, 0, sizeof(ts2)); 225 218 226 sscanf(dir_itr->leaf().c_str(), "%04d%02d%02d%02d%02d -%04d%02d%02d%02d%02d",219 sscanf(dir_itr->leaf().c_str(), "%04d%02d%02d%02d%02d", 227 220 &ts1.tm_year, 228 &ts1.tm_mon, &ts1.tm_mday, &ts1.tm_hour, &ts1.tm_min, 229 &ts2.tm_year, 230 &ts2.tm_mon, &ts2.tm_mday, &ts2.tm_hour, &ts2.tm_min); 221 &ts1.tm_mon, &ts1.tm_mday, &ts1.tm_hour, &ts1.tm_min); 222 231 223 232 224 ts1.tm_year -= 1900; 233 ts2.tm_year -= 1900; 234 225 235 226 ts1.tm_mon--; 236 ts2.tm_mon--; 237 227 238 228 KeyMetaData kmd; 239 /* 240 kmd.beginValidity=timegm(&ts1); 241 kmd.endValidity=timegm(&ts2); 242 time_t now=time(0); 243 */ 244 kmd.active = 1; // XXX FIXME GOOD ONE! // now > kmd.beginValidity && now < kmd.endValidity; 229 230 245 231 kmd.fname = dir_itr->leaf(); 232 kmd.active = kmd.fname.find(".active") != string::npos; 246 233 zskset.push_back(make_pair(dpk, kmd)); 247 234 } -
trunk/pdns/pdns/pdnssec.cc
r1724 r1726 291 291 cout << "ZSKs for zone '"<<zone<<"':"<<endl; 292 292 BOOST_FOREACH(DNSSECKeeper::zskset_t::value_type value, zskset) { 293 cout<<"Tag = "<<value.first.getDNSKEY().getTag()<<"\tActive: "<<value.second.active<< ", "<<endl; // humanTime(value.second.beginValidity)<<" - "<<humanTime(value.second.endValidity)<<endl;293 cout<<"Tag = "<<value.first.getDNSKEY().getTag()<<"\tActive: "<<value.second.active<< endl; // humanTime(value.second.beginValidity)<<" - "<<humanTime(value.second.endValidity)<<endl; 294 294 } 295 295 }