Önemli: OpenSSL 1.1.X Güncellemesi

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 66

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Selam arkadaşlar,

Çoğu kaynakta openssl 1.0.x sürümlerinde. Openssl resmi sitesinde geçmiş sürümlerin ciddi açıklarının olduğu yasıyor.

Gerçi metin2 kaynak dosyalarında openssl sadece serverkeyde kullanılıyor bildiğim kadarı ile o yüsden pek bi sararı da olmas.

Yinede güncel openssl için yapmanıs gerekenleri şöyle yasayım;

1-) Openssl 1.1.x(o an ki hangisi güncel ise) makinanisa indirip derleyin libleri oluşturun.
2-) Çıkış lib isimleri eski lib isimlerinden farklı olabilir kaynak kodunusda eski isim ile yeni lib isimlerini değiştirmeyi unutmayın.
3-) Openssl güncellemesi ile libserverkey de ki rsacrypto.cpp de uyumsusluklar mevcut aşağıdaki ile değiştirin;

Kod:
#include "RSACrypto.h" #ifdef _WIN32 #include <atlenc.h> #endif #include <assert.h> #include <openssl/aes.h> #include <openssl/rsa.h> #include <openssl/rand.h> #include <openssl/crypto.h> #include <openssl/err.h> #include <openssl/engine.h> #include <openssl/sha.h> #include <openssl/pem.h> namespace Security {     static const char rnd_seed[] = "alsfkdj#$^#Y$JBGVKA()#$J@J#OTJG)(@JG)@GJ)J@$)JG)$JG)GJ#@)G";     class StaticInitializer     {     public:         StaticInitializer()         {         }         ~StaticInitializer()         {             RAND_cleanup();         }         void Init()         {             RAND_seed(rnd_seed, sizeof(rnd_seed));         }     };     void InitRandomSeed()     {         static StaticInitializer s;         s.Init();     }     // RSA cryptography     //RSACrypto::PublicKey::PublicKey(const unsigned char* n, int nsize, const unsigned char* e, int esize)     //{     //    rsa_ = Alloc();     //    BIGNUM* tmp = NULL;     //    tmp = BN_bin2bn( n, nsize, rsa_->n );     //    assert( tmp );     //    tmp = BN_bin2bn( e, esize, rsa_->e );     //    assert( tmp );     //    //#ifdef _DEBUG     //    //            printf("n:");     //    //            BN_print_fp(stdout, rsa_->n);     //    //            printf("");     //    //            printf("e:");     //    //            BN_print_fp(stdout, rsa_->e);     //    //            printf("");     //    //#endif     //}     RSACrypto::PublicKey::PublicKey(const char* n, const char* e)     {         rsa_ = Alloc();         BN_hex2bn((BIGNUM**)RSA_get0_n(rsa_), n);         BN_hex2bn((BIGNUM**)RSA_get0_e(rsa_), e);     }     RSACrypto::PublicKey::PublicKey(RSACrypto::PublicKey& p)     {         rsa_ = RSA_new();         assert(rsa_);         Copy(rsa_, p.rsa_);     }     RSACrypto::PublicKey::~PublicKey()     {         Free(rsa_);         rsa_ = NULL;     }     RSACrypto::PublicKey& RSACrypto::PublicKey::operator =(const RSACrypto::PublicKey& p)     {         if (rsa_)         {             Free(rsa_);             rsa_ = NULL;         }         rsa_ = RSA_new();         assert(rsa_);         Copy(rsa_, p.rsa_);         return *this;     }     //Buffer RSACrypto::PublicKey::GetN()     //{     //    if ( rsa_ )     //    {     //        int len = BN_num_bytes( rsa_->n );     //        Buffer n = Buffer::Alloc( len );     //        if ( NULL == n.buf )     //        {     //            return Buffer();     //        }     //        BN_bn2bin( rsa_->n, (unsigned char *)n.buf );     //        return n;     //    }     //    return Buffer();     //}     //Buffer RSACrypto::PublicKey::GetE()     //{     //    if ( rsa_ )     //    {     //        int len = BN_num_bytes( rsa_->e );     //        Buffer e = Buffer::Alloc( len );     //        if ( NULL == e.buf )     //        {     //            return Buffer();     //        }     //        BN_bn2bin( rsa_->e, (unsigned char *)e.buf );     //        return e;     //    }     //    return Buffer();     //}     RSACrypto::PublicKey::PublicKey() : rsa_(NULL)     {     }     RSA* RSACrypto::PublicKey::Alloc()     {         RSA* rsa = RSA_new();         assert(rsa);         RSA_set0_key(rsa, BN_new(), BN_new(), BN_new());         return rsa;     }     void RSACrypto::PublicKey::Free(rsa_st* p)     {         if (p)         {             RSA_free(p);         }     }     void RSACrypto::PublicKey::Copy(rsa_st* to, const rsa_st* from)     {         BN_copy((BIGNUM*)RSA_get0_n(to), RSA_get0_n(from));         BN_copy((BIGNUM*)RSA_get0_e(to), RSA_get0_e(from));     }     RSACrypto::PrivateKey::PrivateKey() : rsa_(NULL)     {     }     RSACrypto::PrivateKey::PrivateKey(rsa_st* rsa) : rsa_(rsa)     {     }     RSACrypto::PrivateKey::~PrivateKey()     {         if (rsa_)         {             RSA_free(rsa_);             rsa_ = NULL;         }     }     RSA* RSACrypto::PrivateKey::Alloc()     {         RSA* rsa = RSA_new();         assert(rsa);         RSA_set0_key(rsa, BN_new(), BN_new(), BN_new());         RSA_set0_factors(rsa, BN_new(), BN_new());         return rsa;     }     Buffer RSACrypto::EncryptPublic(const RSACrypto::PublicKey* k, const unsigned char* plain, int plainLen)     {         int rsaSize = RSA_size(k->rsa_);         Buffer cipherText = Buffer::Alloc(rsaSize);         if (NULL == cipherText.buf)         {             return Buffer();         }         // must be checked when RSA_PKCS1_OAEP_PADDING mode         if (plainLen >= rsaSize - 41)         {             Buffer::Free(cipherText);             assert(false);             return Buffer();         }         int cipherTextLen = RSA_public_encrypt(             plainLen,             plain,             (unsigned char*)cipherText.buf,             k->rsa_,             RSA_PKCS1_OAEP_PADDING);         if (-1 == cipherTextLen)         {             Buffer::Free(cipherText);             return Buffer();         }         assert(cipherTextLen == rsaSize);         //XSystem::MemoryPool::MemoryPool_Realloc( cipherText, cipherTextLen );         return cipherText;     }     Buffer RSACrypto::DecryptPrivate(const RSACrypto::PrivateKey* k, const unsigned char* cipher, int cipherLen)     {         int rsaSize = RSA_size(k->rsa_);         Buffer plainText = Buffer::Alloc(rsaSize);         if (NULL == plainText.buf)         {             return Buffer();         }         int plainTextLen = RSA_private_decrypt(             cipherLen,             cipher,             (unsigned char*)plainText.buf,             k->rsa_,             RSA_PKCS1_OAEP_PADDING);         if (-1 == plainTextLen)         {             Buffer::Free(plainText);             return Buffer();         }         plainText.len = plainTextLen;         return plainText;     }     Buffer RSACrypto::EncryptPrivate(const RSACrypto::PrivateKey* k, const unsigned char* plain, int plainLen)     {         int rsaSize = RSA_size(k->rsa_);         Buffer cipherText = Buffer::Alloc(rsaSize);         if (NULL == cipherText.buf)         {             return Buffer();         }         // must be checked when RSA_PKCS1_PADDING mode (private encrypt¿¡¼´Â ´Ù¸¥ paddingÀ» Áö¿ø¾ÈÇÑ´Ù.)         if (plainLen >= rsaSize - 11)         {             Buffer::Free(cipherText);             assert(false);             return Buffer();         }         int cipherTextLen = RSA_private_encrypt(             plainLen,             plain,             (unsigned char*)cipherText.buf,             k->rsa_,             RSA_PKCS1_PADDING);         if (-1 == cipherTextLen)         {             Buffer::Free(cipherText);             return Buffer();         }         assert(cipherTextLen == rsaSize);         //XSystem::MemoryPool::MemoryPool_Realloc( cipherText, cipherTextLen );         return cipherText;     }     Buffer RSACrypto::DecryptPublic(const RSACrypto::PublicKey* k, const unsigned char* cipher, int cipherLen)     {         int rsaSize = RSA_size(k->rsa_);         Buffer plainText = Buffer::Alloc(rsaSize);         if (NULL == plainText.buf)         {             return Buffer();         }         int plainTextLen = RSA_public_decrypt(             cipherLen,             cipher,             (unsigned char*)plainText.buf,             k->rsa_,             RSA_PKCS1_PADDING);         if (-1 == plainTextLen)         {             Buffer::Free(plainText);             return Buffer();         }         plainText.len = plainTextLen;         return plainText;     }     bool RSACrypto::GenerateKey(RSACrypto::PublicKey* publicKey, RSACrypto::PrivateKey* privateKey)     {         RSA* rsa = RSA_generate_key(1024, 7, NULL, NULL);         if (NULL == rsa)         {             //ERR_get_error();             return false;         }         if (1 != RSA_check_key(rsa))         {             //ERR_get_error();             return false;         }         publicKey->rsa_ = publicKey->Alloc();         publicKey->Copy(publicKey->rsa_, rsa);         privateKey->rsa_ = rsa; #ifdef _DEBUG         //            printf("n:");         //            BN_print_fp(stdout, publicKey->rsa_->n);         //            printf("");         //            printf("e:");         //            BN_print_fp(stdout, publicKey->rsa_->e);         //            printf("");         //char buf[1024];         //BIO* bp = BIO_new_mem_buf(buf, sizeof(buf));         //PEM_write_bio_RSAPrivateKey(bp, rsa, 0, 0, 0, 0, 0);         //PEM_read_bio_RSAPrivateKey(bp, ) #endif         return true;     }     bool RSACrypto::PrintKey(const PublicKey* k, std::string& e, std::string& n)     {         char* tmp = BN_bn2hex(RSA_get0_e(k->rsa_));         if (!tmp)         {             return false;         }         e = tmp;         tmp = BN_bn2hex(RSA_get0_n(k->rsa_));         if (!tmp)         {             return false;         }         n = tmp;         return true;     }     bool RSACrypto::PrintKey(const PrivateKey* k, std::string& n, std::string& e, std::string& d)     {         char* tmp = BN_bn2hex(RSA_get0_n(k->rsa_));         if (!tmp)         {             return false;         }         n = tmp;         tmp = BN_bn2hex(RSA_get0_e(k->rsa_));         if (!tmp)         {             return false;         }         e = tmp;         tmp = BN_bn2hex(RSA_get0_d(k->rsa_));         if (!tmp)         {             return false;         }         d = tmp;         return true;     }     bool RSACrypto::StorePrivateKey(const PrivateKey* k, char* buf, size_t& buflen)     {         // DER Æ÷¸ËÀ¸·Î º¯È¯         char* tmp = NULL;         int n = i2d_RSAPrivateKey(k->rsa_, (unsigned char**)&tmp);         if (n < 0)         {             return false;         }         if (n > (int)buflen)         {             printf("RSACrypto::StorePrivateKey: buflen is too small\n");             return false;         }         memcpy(buf, tmp, n);         buflen = n;         free(tmp);         return true;     }     bool RSACrypto::RestorePrivateKey(const char* buf, size_t buflen, PrivateKey* k)     {         // DER Æ÷¸Ë¿¡¼ º¯È¯         char* tmp = (char*)malloc(buflen);         if (!tmp)         {             return false;         }         memcpy(tmp, buf, buflen);         if (!d2i_RSAPrivateKey(&k->rsa_, (const unsigned char**)&tmp, buflen))         {             free(tmp);             return false;         }         return true;     }     bool RSACrypto::StorePublicKey(const PublicKey* k, char* buf, size_t& buflen)     {         // DER Æ÷¸ËÀ¸·Î º¯È¯         char* tmp = NULL;         int n = i2d_RSAPublicKey(k->rsa_, (unsigned char**)&tmp);         if (n < 0)         {             return false;         }         if (n > (int)buflen)         {             printf("RSACrypto::StorePublicKey: buflen is too small\n");             return false;         }         memcpy(buf, tmp, n);         buflen = n;         free(tmp);         return true;     }     bool RSACrypto::RestorePublicKey(const char* buf, size_t buflen, PublicKey* k)     {         // DER Æ÷¸Ë¿¡¼ º¯È¯         char* tmp = (char*)malloc(buflen);         if (!tmp)         {             return false;         }         memcpy(tmp, buf, buflen);         if (!d2i_RSAPublicKey(&k->rsa_, (const unsigned char**)&tmp, buflen))         {             free(tmp);             return false;         }         return true;     }     Buffer SHA1::Digest(const Buffer& plain)     {         Buffer result = Buffer::Alloc(20);         ::SHA1((const unsigned char*)plain.buf,             (unsigned long)plain.len,             (unsigned char*)result.buf);         return result;     } }

Bukadar.

müsait samanında konuyu yeşillendirebilir misin?
Önemli: OpenSSL 1.1.X Güncellemesi

Metin2 özel sunucuları geliştirme sürecinde karşılaşılan en kritik konulardan birisi, güvenlik protokollerinin güncel tutulmasıdır. Özellikle sunucu tarafında kullanılan kütüphanelerin sürüm kontrolü, hem oyun sunucularının güvenliğini hem de oyuncuların veri bütünlüğünü doğrudan etkiler. Bu bağlamda, OpenSSL 1.1.X güncellemesi, Metin2 özel sunucularında çalışan geliştiriciler için oldukça önemli bir adımdır.

OpenSSL, internet üzerinde şifreli bağlantılar kurmamızı sağlayan açık kaynaklı bir kriptografi kütüphanesidir. Sunucu-client arasındaki tüm veri alışverişlerinde kilit rol oynar. Eski sürümlerdeki güvenlik açıkları, saldırganların sunucuya erişim sağlamasına veya veri sızıntısına neden olabilir. Bu nedenle, OpenSSL 1.1.X gibi güncel ve desteklenen bir sürüme geçiş yapmak, Metin2 özel sunucuları için kritik bir güvenlik adımıdır.

Güncellemeye Neden İhtiyaç Var?
OpenSSL'in eski sürümlerinde zamanla birçok güvenlik açığı tespit edilmiştir. Örneğin, bazı versiyonlarda SSL/TLS bağlantısı sırasında veri sızıntısı yapan CVE açıkları bulunmuştur. Bu açıklar, kötü niyetli kişiler tarafından istismar edilebilir. Özellikle Metin2 PvP sistemleri gibi gerçek zamanlı oyun yapılarında, herhangi bir güvenlik açığı ciddi maliyetler doğurabilir. Oyuncu verileri, hesap bilgileri ve sunucu yapılandırmaları tehdit altında kalabilir.

Ayrıca, bazı hosting firmaları ya da CDN sağlayıcıları artık eski OpenSSL sürümlerini desteklememektedir. Bu durumda, sunucunuzun dış dünyayla olan iletişiminde sorunlar yaşanabilir. Örneğin, HTTPS üzerinden çalışan bazı API entegrasyonları başarısız olabilir. Bu da oyun içi ödeme sistemleri, kullanıcı kimlik doğrulama süreçleri gibi kritik fonksiyonlarda aksaklıklara yol açabilir.

OpenSSL 1.1.X ile Gelen Yeni Özellikler
OpenSSL 1.1.X serisi, önceki sürümlere göre daha stabil ve gelişmiş güvenlik protokolleri sunar. TLS 1.3 desteği, daha hızlı ve güvenli bağlantı kurulmasını sağlar. Ayrıca, API değişiklikleri sayesinde mevcut sistemlerde daha kolay entegrasyon imkanı sunar. Metin2 server src dosyalarında yapılan düzenlemelerle, bu yeni versiyonla uyumlu hale getirilmiş projeler, daha güçlü bir güvenlik altyapısına sahip olur.

Ayrıca, bu sürümde performans iyileştirmeleri de yer almaktadır. Bağlantı süresi kısalır, CPU yükü azalır. Özellikle çok kanallı Metin2 PvP sistemleri için bu, daha sorunsuz ve hızlı bir oyun deneyimi anlamına gelir.

Güncelleme Nasıl Yapılır?[/BR]
OpenSSL 1.1.X güncellemesi, C++ source edit süreçlerinde dikkatli bir şekilde yapılmalıdır. İlk olarak, mevcut OpenSSL sürümünüzü kontrol edin. Eğer 1.0.x ya da altı bir sürüm kullanıyorsanız, mutlaka güncelleme yapmalısınız. Güncellemeden önce, game server programming dosyalarınızın yedeklerini alın. Herhangi bir hata durumunda geri dönüş yapabilmeniz için bu adımı atlamayın.

Sunucu derleme aşamasında, yeni OpenSSL kütüphaneleriyle uyumlu derleme ayarlarını yapmanız gerekir. Metin2 compile işlemleri sırasında, doğru header ve library dosyalarının kullanılması önemlidir. Derleme sırasında hata alırsanız, link edilen kütüphane dosyalarını kontrol edin.

Python tabanlı sistemlerde, özellikle Py GUI veya py root dosyalarında da aynı şekilde OpenSSL ile ilgili bağlantılar varsa, bu modüllerin de uyumlu sürümlerini kullanmanız gerekir. Martysama gibi bilinen bazı Metin2 geliştirici ortamlarında, bu tür entegrasyonlar için önceden hazırlanmış yapılar mevcuttur.

OpenSSL 1.1.X ve Metin2 Core Uyumluğu[/BR]
Metin2 özel sunucularında kullanılan core sistemlerin çoğu, eski OpenSSL sürümlerine göre yazılmıştır. Bu nedenle, yeni sürüme geçerken, game core ve db core yapılarında gerekli düzenlemelerin yapılması şarttır. Özellikle veritabanı bağlantılarında kullanılan SSL şifreleme prosedürleri gözden geçirilmelidir.

Ayrıca, auth sunucusu ile game server arasında kurulan güvenli bağlantılar da yeni OpenSSL sürümüne göre yeniden test edilmelidir. Bağlantı kopmaları, handshake hataları gibi durumlarla karşılaşabilirsiniz. Bu yüzden, güncelleme sonrası kapsamlı testler yapmanız önerilir.

Sonuç
OpenSSL 1.1.X güncellemesi, Metin2 özel sunucu geliştiricileri için yalnızca bir güvenlik zorunluluğu değil, aynı zamanda performans ve stabilite açısından da hayati bir adımdır. Güvenlik açıklarından korunmak, oyuncuların verilerini güvende tutmak ve sunucu performansını artırmak için bu güncellemeyi zaman geçirmeden yapmanız şiddetle tavsiye edilir.


Important: OpenSSL 1.1.X Update

In the process of developing Metin2 private servers, one of the most critical issues encountered is keeping security protocols up-to-date. In particular, version control of libraries used on the server side directly affects both the security of game servers and the data integrity of players. In this context, the OpenSSL 1.1.X update is a very important step for developers working with Metin2 private servers.

OpenSSL is an open-source cryptography library that allows us to establish encrypted connections over the internet. It plays a key role in all data exchanges between server and client. Security vulnerabilities in older versions can allow attackers to gain access to the server or cause data leaks. Therefore, upgrading to a current and supported version like OpenSSL 1.1.X is a critical security step for Metin2 private servers.

Why Do We Need This Update?
Many security vulnerabilities have been discovered over time in older versions of OpenSSL. For example, some versions contained CVE vulnerabilities that could cause data leaks during SSL/TLS connections. These vulnerabilities can be exploited by malicious actors. Especially in real-time gaming environments such as Metin2 PvP systems, any security flaw can result in significant costs. Player data, account information, and server configurations may be compromised.

Additionally, some hosting providers or CDN services no longer support older OpenSSL versions. This can cause communication problems with the outside world. For instance, some API integrations operating via HTTPS may fail. This can lead to issues in critical functions such as in-game payment systems and user authentication processes.

New Features in OpenSSL 1.1.X
The OpenSSL 1.1.X series offers more stable and advanced security protocols compared to previous versions. TLS 1.3 support enables faster and more secure connections. Moreover, API changes allow easier integration within existing systems. Projects updated to be compatible with this new version through modifications in Metin2 server src files will have a stronger security infrastructure.

Furthermore, performance improvements are included in this version. Connection times decrease, and CPU load reduces. For multi-channel Metin2 PvP systems, this means a smoother and faster gaming experience.

How to Perform the Update?[/BR]
The OpenSSL 1.1.X update must be performed carefully during C++ source edit processes. First, check your current OpenSSL version. If you are using version 1.0.x or below, you must upgrade immediately. Before updating, take backups of your game server programming files. Do not skip this step as it ensures you can revert in case of errors.

During the server compilation phase, ensure that compilation settings are compatible with the new OpenSSL libraries. During Metin2 compile operations, it's important to use the correct header and library files. If you encounter errors during compilation, check the linked library files.

In Python-based systems, especially if there are connections related to OpenSSL in Py GUI or py root files, you need to use compatible versions of these modules as well. Some known Metin2 development environments like Martysama offer pre-configured structures for such integrations.

OpenSSL 1.1.X and Metin2 Core Compatibility[/BR]
Most core systems used in Metin2 private servers were written according to older OpenSSL versions. Therefore, when upgrading to the new version, necessary adjustments must be made in game core and db core structures. Particularly, SSL encryption procedures used in database connections should be reviewed.

Additionally, secure connections established between the auth server and the game server must be re-tested according to the new OpenSSL version. You might encounter connection drops or handshake errors. Therefore, comprehensive testing after the update is recommended.

Conclusion
The OpenSSL 1.1.X update is not only a security necessity but also a vital step for performance and stability for Metin2 private server developers. It is strongly recommended to apply this update without delay to protect against security vulnerabilities, keep player data safe, and improve server performance.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Geri
Üst Alt