コード例 #1
0
        void AutoDeny(bool success, Ip remoteIp)
        {
            if (_attackDb == null)
            {
                return;
            }
            //�f�[�^�x�[�X�ւ̓o�^
            if (!_attackDb.IsInjustice(success, remoteIp))
            {
                return;
            }
            //�u���[�g�t�H�[�X�A�^�b�N
            if (!AclList.Append(remoteIp))
            {
                return; //ACL�������ېݒ�(�u���‚���v�ɐݒ肳��Ă���ꍇ�A�@�\���Ȃ�)
            }
            //�lj��ɐ��������ꍇ�A�I�v�V���������������
            var d     = (Dat)Conf.Get("acl");
            var name  = string.Format("AutoDeny-{0}", DateTime.Now);
            var ipStr = remoteIp.ToString();

            d.Add(true, string.Format("{0}\t{1}", name, ipStr));
            Conf.Set("acl", d);
            Conf.Save(Kernel.IniDb);
            //OneOption.SetVal("acl", d);
            //OneOption.Save(OptionIni.GetInstance());
            Logger.Set(LogKind.Secure, null, 9000055, string.Format("{0},{1}", name, ipStr));
        }
コード例 #2
0
        //bool CheckAuthList(string requestUri) {
        //    // 【注意 ショートファイル名でアクセスした場合の、認証の回避を考慮する必要がある】
        //    //AnsiString S = ExtractShortPathName(ShortNamePath);
        //    var authList = (Dat)this.Conf.Get("authList");
        //    foreach (var o in authList) {
        //        if (!o.Enable)
        //            continue;
        //        string uri = o.StrList[0];

        //        if (requestUri.IndexOf(uri) == 0) {
        //            return false;
        //        }
        //    }
        //    return true;
        //}

        void AutoDeny(bool success, Ip remoteIp)
        {
            if (_attackDb == null)
            {
                return;
            }
            //データベースへの登録
            if (!_attackDb.IsInjustice(success, remoteIp))
            {
                return;
            }

            //ブルートフォースアタック
            if (AclList.Append(remoteIp))  //ACL自動拒否設定(「許可する」に設定されている場合、機能しない)
            //追加に成功した場合、オプションを書き換える
            {
                var d     = (Dat)Conf.Get("acl");
                var name  = string.Format("AutoDeny-{0}", DateTime.Now);
                var ipStr = remoteIp.ToString();
                d.Add(true, string.Format("{0}\t{1}", name, ipStr));
                Conf.Set("acl", d);
                Conf.Save(Kernel.IniDb);

                Logger.Set(LogKind.Secure, null, 9000055, string.Format("{0},{1}", name, ipStr));
            }
            else
            {
                Logger.Set(LogKind.Secure, null, 9000056, remoteIp.ToString());
            }
        }