FreeBSD IPsec mini-HOWTO

自动化测试实战项目开发 - 用例发现装载、参数化数据驱动、断言账本、Mock桩与虚拟被测对象、覆盖率统计、结果聚合与报告生成,43源文件185用例 主机侧可跑的自动化测试框架纯源码工程:用例发现与装载 / 参数化与数据驱动 / 断言账本 / Mock 桩与虚拟被测对象 / 覆盖率统计 / 结果聚合与报告生成(43 个 src 源文件 7596 非空行 / 185 用例 1176 断言全绿 / 非真实被测系统实测) 这份资料解决一个很具体的问题:机器上没有真实被测系统,怎么把一套自动化测试框架写对,并且证明它是对的。答案不是先接一堆外部依赖,而是把框架拆成显式、可单测、可主机侧运行的纯源码工程:core 层给出常量、异常、确定性工具、虚拟时钟、数据模型与断言账本,runner 层负责发现、装载、参数化、夹具与执行状态机,mock 层提供 Mock、桩、间谍、补丁与虚拟被测对象,report 层把结果算成覆盖率、聚合、汇总与三种报告,cli 层把四层能力串成四个子命令与二十一项分层自检。全册 43 个 src 源文件里的代码就是这套实现的全部,正文里的每一行都与工程里的文件逐字节一致。 全册 63 个 .py 文件、9,430 个非空行(总行 11,393)分五层再加脚本与测试:core 10 个 2,125 行、runner 11 个 1,804 行、mock 9 个 1,727 行、report 8 个 1,207 行、cli 5 个 733 行、scripts 与 tests 共 20 个 1,834 行。每层都能单独读懂,合起来是一条从「给一组名字做发现」到「装载派生、逐用例执行、收集断言账本、按虚拟被测对象打点算覆盖率、聚合结果、渲染三种报告」的完整链路。所有用例、参数、故障、覆盖率打点都由代码现场构造在内存里,因此同一份工程在任意装有 CPython 3.9 的机器上都能复算出同样的数值。 立即下载

FreeBSD IPsec mini-HOWTO

by Josh Tiefenbach <josh@zipperup.org> and Boris Köster <x-itec@freenet.de>

 

Introduction

The latest version of this tutorial can always be found at:

 

This document is intended to be a primer on how to get IPsec on FreeBSD up and running, interoperating both with another FreeBSD (or NetBSD or any other KAME-derived stack) machine, and a Windows 2000 machine.

IPsec is a means to secure IP layer communications between hosts, and can secure both IPv4 and IPv6 traffic. Only IPsec over IPv4 will be discussed here.

IPsec can be used to build tunnels between subnets (tunnel mode) or secure communication between two machines directly (transport mode) with the guarantee that the packets are encrypted, authenticated and anti-replay protected (by sequence-numbers) with limited traffic flow confidentiality. By design, IPsec communication is encrypted by symmetric algorithms (Blowfish, DES, 3DES). This is known as ESP (Encapsulating Security Payload) mode, in which the payload of a packet is encrypted. The headers of the packet are left untouched. If you do not want to encrypt the traffic, you can use IPsec in what's known as AH (Authenticaed Header) mode. In this mode, the payload of the packet is not encrypted, but the header fields are hashed using a secure hashing function, and an additional header containing this hash is added to the packet to allow the information in the packet to be authenticated.

This document will not describe the overall architechture of IPsec, and its component protocols. We will show only some basics here.

If we take a technical look at the tcp packet, we have the following structure now (see RFC 2406). The drawings are from this RFC for educational use:

                 BEFORE APPLYING ESP
            ----------------------------
      IPv4  |orig IP hdr  |     |      |
            |(any options)| TCP | Data |
            ----------------------------
                 AFTER APPLYING ESP
            -------------------------------------------------
      IPv4  |orig IP hdr  | ESP |     |      |   ESP   | ESP|
            |(any options)| Hdr | TCP | Data | Trailer |Auth|
            -------------------------------------------------
                                |<----- encrypted ---->|
                          |<------ authenticated ----->|

If we would have IPV6, the design would look like this:

                     BEFORE APPLYING ESP
            ---------------------------------------
      IPv6  |             | ext hdrs |     |      |
            | orig IP hdr |if present| TCP | Data |
            ---------------------------------------


                     AFTER APPLYING ESP
            ---------------------------------------------------------
      IPv6  | orig |hop-by-hop,dest*,|   |dest|   |    | ESP   | ESP|
            |IP hdr|routing,fragment.|ESP|opt*|TCP|Data|Trailer|Auth|
            ---------------------------------------------------------
                                         |<---- encrypted ---->|
                                     |<---- authenticated ---->|

            * = if present, could be before ESP, after ESP, or both

It is important to know what we are doing here to understand the mechanism how ESP works so we know what we are doing and WHY we are NOT using a SSH tunnel or similar. This is a structure of the ESP header, some of the words you may have read somewhere, and this graphic may help you to understand something more about ESP.

 

0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ----
|               Security Parameters Index (SPI)                 | ^Auth.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov-
|                      Sequence Number                          | |erage
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ----
|                    Payload Data* (variable)                   | |   ^
~                                                               ~ |   |
|                                                               | |Conf.
+               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Cov-
|               |     Padding (0-255 bytes)                     | |erage*
+-+-+-+-+-+-+-+-+               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   |
|                               |  Pad Length   | Next Header   | v   v
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ------
|                 Authentication Data (variable)                |
~                                                               ~
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   * If included in the Payload field, cryptographic
          synchronization data, e.g., an Initialization Vector

If you hear somewhere words like "Padding", "Sequence Numbers", or "Payload Data"; if you are reading the docs of racoon.conf(5) or setkey(8) now you know that these bits of information are a part of the ESP header or it has something to do with IPsec.

The basic procedure for implementing IPsec is:

  • Configure kernel

  • Set security policy

  • Configure key exchange

 

Getting started

In order to use IPsec on a FreeBSD machine, it is highly recommended that you be running FreeBSD 4.1 or later. While the KAME IPsec code exists in versions prior to this (notably FreeBSD 3.x), it is not sufficient to be able to use the racoon IKE (Internet Key Exchange) daemon to perform automatic keying.

To add IPsec support to your kernel, add the following lines to your kernel config file

	options         IPSEC                   #IP security
	options         IPSEC_ESP               #IP security (crypto; define w/ IPSEC)
	options         IPSEC_DEBUG             #debug for IP security

Additionally, if you want to use IPsec in tunnel mode, you may will also want to add the following line to the kernel config:

	device gif 4

Recompile and install the new kernel.

Install the racoon daemon from ports:

        cd /usr/ports/security/racoon ; make all install clean

Currently the latest version of the port is racoon-20001111a. While it is possible to have 2 FreeBSD machines communicate via IPsec using only manual keying (that is, manually specifying the encryption keys), not only is it not interesting or practical, but it won't work when you try to interact with a Win2k machine.

 

Setting security policy

An integral part of IPsec, is letting the kernel know which packets it should be encrypting and how it should be encrypting them, whether to use AH (authentication header) mode or ESP (encapsulating security payload) mode, and what encryption and hashing algorithms to use.

These decisions are referred to as 'policy', and are stored in a table in the kernel known as the Security Policy Database (SPD). You can use the setkey(8) program to manipulate the SPD.

There is also a table in the kernel which stores the various encryption keys needed to secure communications between hosts. This table is known as the Security Association Database (SAD). If you are configuring IPsec using manual keying then the setkey(8) program is also used to configure the manual keys in the SAD. If you are using IKE to automatically exchange keys between hosts, then racoon will handle the adding and deleting of entries from the SAD.

If you have 2 FreeBSD machines, node A with an IP address of 1.2.3.4, and node B with an address of 5.6.7.8, then the following commands will add policy to the SPD to enable IPsec between the 2 nodes:

        #!/bin/sh
        # These commands need to be run on node A
        # The next 2 lines delete all existing entries from the SPD and SAD
        setkey -FP
        setkey -F
        # Add the policy
        setkey -c << EOF
        spdadd 1.2.3.4/32 5.6.7.8/32 any -P out ipsec
         esp/transport/1.2.3.4-5.6.7.8/require;
        spdadd 5.6.7.8/32 1.2.3.4/32 any -P in ipsec
         esp/transport/5.6.7.8-1.2.3.4/require;
        EOF

The first spdadd command sets the policy that all outgoing packets from 1.2.3.4/32 to 5.6.7.8/32 will be required to be encrypted using ESP. The second spdadd command sets the same policy, but for incoming packets from 5.6.7.8/32 to 1.2.3.4/32

        #!/bin/sh
        # These commands need to be run on node B
        # The next 2 lines delete all existing entries from the SPD and SAD
        setkey -FP
        setkey -F
        # Add the policy
        setkey -c << EOF
        spdadd 5.6.7.8/32 1.2.3.4/32 any -P out ipsec
         esp/transport/5.6.7.8-1.2.3.4/require;
        spdadd 1.2.3.4/32 5.6.7.8/32 any -P in ipsec
         esp/transport/1.2.3.4-5.6.7.8/require;
        EOF

Examples on how to set SAD entries using setkey(8) are given in the IPsec section of the FreeBSD handbook.

 

AH vs ESP. Tunnel vs Transport

Given even a casual reading of the available IPsec documentation, one can get rather confused as to what mode they should be running in. Unless you are wanting to set up a VPN, then the mode that you probably want is ESP/transport.

In ESP/transport mode, each packet that is destined for a host for which IPsec is requested has its payload encrypted. In tunnel mode, the entire packet (including the encrypted payload) is encapsulated within another packet before being sent off to the remote host.

However, if your goal is to set up a VPN, that is, link 2 widely-separated networks together over the Internet, then you'll probably want to use ESP/tunnel mode. The configuration of the SPD for tunnel mode is very similar to that of transport mode. The major change that is done is the use of the gif(4) device to implement the IP-IP tunneling.

Returning to our hypothetical nodes A and B, presume the following network topology:

Internal net A <-> Node A <-----> Internet <------> Node B <-> Internal net B

where

node A's internal address is 10.10.10.1/24

external address is 1.2.3.4

node B's internal address is 10.20.20.1/24

external address is 5.6.7.8

then to configure policy on node A:

        #!/bin/sh
        # These commands need to be run on node A
        # Set up the tunnel device. This presumes you have gif(4) support
        # gif0 connects 1.2.3.4 to 5.6.7.8
        gifconfig gif0 1.2.3.4 5.6.7.8
        # The 'internal' side of the tunnel connects 10.10.10.1 to 10.20.20.1
        ifconfig gif0 inet 10.10.10.1 10.20.20.1 netmask 255.255.255.0
        # The next 2 lines delete all existing entries from the SPD and SAD
        setkey -FP
        setkey -F
        # Add the policy
        setkey -c << EOF
        spdadd 10.10.10.0/24 10.20.20.0/24 any -P out ipsec
         esp/transport/1.2.3.4-5.6.7.8/require;
        spdadd 10.20.20.0/24 10.10.10.0/24 any -P in ipsec
         esp/transport/5.6.7.8-1.2.3.4/require;
        EOF

Note the difference in the spdadd command. We are setting policy to have traffic from the network 10.10.10/24 to the network 10.20.20/24 be encrypted (via ESP), and routed from 1.2.3.4 to 5.6.7.8, and vice versa.

And on node B:

        #!/bin/sh
        # These commands need to be run on node B
        # Set up the tunnel device. This presumes you have gif(4) support
        # gif0 connects 5.6.7.8 to 1.2.3.4
        gifconfig gif0 5.6.7.8 1.2.3.4
        # The 'internal' side of the tunnel connects 10.20.20.1 to 10.10.10.1
        ifconfig gif0 inet 10.20.20.1 10.10.10.1 netmask 255.255.255.0
        # The next 2 lines delete all existing entries from the SPD and SAD
        setkey -FP
        setkey -F
        # Add the policy
        setkey -c << EOF
        spdadd 10.20.20.0/24 10.10.10.0/24 any -P out ipsec
         esp/transport/5.6.7.8-1.2.3.4/require;
        spdadd 10.10.10.0/24 10.20.20.0/24 any -P in ipsec
         esp/transport/1.2.3.4-5.6.7.8/require;
        EOF

 

Automatic key exchange using racoon

Configuring racoon to the point where you can successfully exchange keys is reasonably easy. The default racoon.conf file is sufficient for a basic setup. However, we would recommend that the following items be changed.

The default log level of "debug4" is very chatty. While its handy when setting things up normally, its a bit excessive for normal usage. To reduce logging, change the line

        log "debug4";

to

        log "info";

In a thread on the freebsd-net mailing list, it was pointed out that the default values for the lifetime of the keys negotiated by racoon is far too short for WAN links, especially over PPPoE links. Thus, you may want to give thought to changing the 'lifetime time' and 'lifetime byte' parameters in the 'sainfo anonymous' stanza to 3600 seconds and 50000 kb respectively.

Part of the key-exchange process requires that the 2 nodes agree on some predetermined secret. This can be accomplished either by presenting X.509 certificates, or (simpler) via some pre-shared text key. To configure a pre-shared key, you must edit the /usr/local/etc/racoon/psk.txt file on both nodes.

In the psk.txt file, add the following line:

        peer_ip_address        sharedkey

If you were configuring IPsec to talk to a peer with an IP of 5.6.7.8 and a shared key of 'thisisatest' then you'd add the line

        5.6.7.8                thisisatest

to the psk.txt file on that machine.

Make sure that the psk.txt file is mode 600 and owned by root, else racoon will refuse to read it.

At this point, you can launch racoon on both boxes via the following command:

        /usr/local/sbin/racoon -f /usr/local/etc/racoon/racoon.conf

If you've done everything right, then pinging either host should work. There will be a brief delay while racoon exchanges keys, but then you'll see packets flow. The default location of racoon's log file is /var/log/racoon.log. By tailing the log you can see the keys being exchanged.

 

Interoperating with Win2k

It is possible to have a FreeBSD box use IPsec to communicate with a Win2k machine. As you cannot setup manual keying when interoperating with a Win2k machine, you must use racoon to automatically exchange keys. Also you should know that there are some limitations on a Win2k machine and it is not as secure as an encrypted FreeBSD network (fewer algorithms, fewer bits for encryption).

The very first thing you have to to if you want to create an encrypted session between your FreeBSD machine and your Win2k server is to download the latest service pack available and also the "high encryption pack for win2k". This encryption pack is neccessary for several countries to enable 128 bit 3DES encryption on your win2k box. If you do not download the pack, you will NOT be able to connect to the FreeBSD server and everything you get is a TIMEOUT. The service packs and the high encryption pack is freely available from Microsoft.

Set up the FreeBSD machine as detailed above, recompiling the kernel to include IPsec, adding the entries to the SAD using setkey(8), configuring and running racoon.

You have first to setup the basics with setkey and then you may start racoon. You should not start racoon before you have setup the basic configuration described above in this tutorial (the setkey-script).

At this point we will show you how to configure racoon specially for win2k requirements.

Have a look at this configuration file, we will call it "my-racoon.conf". we have made some modifications to it, so it is not completely the same as the original racoon.conf.

We really cannot stress enough the importance in using the latest version of racoon. Development on racoon proceeds fairly rapidly, with numerous bugs and interoperability issues fixed between releases.

A word about the option "log debug4". The first goal of this tutorial is to get the encrypted communication up and running. If it works we can go on optimizing the configuration and its options and again change the logging as noted above.


path pre_shared_key "/usr/local/etc/psk.txt" ;

log debug4;

# "padding" defines some parameter of padding. You should not touch these. padding
{

        maximum_length 20;      # maximum padding length.
        randomize off;          # enable randomize length.
        strict_check off;       # enable strict check.
        exclusive_tail off;     # extract last one octet.

}

# Specification of default various timer. timer
{

        # These value can be changed per remote node.
        counter 5;              # maximum trying count to send.
        interval 20 sec;        # maximum interval to resend.
        persend 1;              # the number of packets per a send.

        # timer for waiting to complete each phase.
        phase1 30 sec;
        phase2 15 sec;

}

remote anonymous
{

        #exchange_mode main,aggressive;
        exchange_mode aggressive,main;
        doi ipsec_doi;
        situation identity_only;

        #we not need an identifier, it is set automatically
        #my_identifier address;
        #my_identifier address "192.168.0.99";
        ##peers_identifier address "192.168.0.1";
        #certificate_type x509 "mycert" "mypriv";

        nonce_size 16;
        lifetime time 1 min;    # sec,min,hour
        lifetime byte 5 MB;     # B,KB,GB
        initial_contact on;
        support_mip6 on;
        proposal_check obey;    # obey, strict or claim

        #very important. We need 3DES for encryption and MD5 as checksum

        proposal {
                encryption_algorithm 3des;
                hash_algorithm md5;
                authentication_method pre_shared_key ;
                dh_group 2 ;
        }

}

sainfo anonymous
{

        pfs_group 1;
        lifetime time 36000 sec;
        lifetime byte 50000 KB;
        encryption_algorithm 3des,des,cast128,blowfish ;
        authentication_algorithm hmac_sha1,hmac_md5;
        compression_algorithm deflate ;

}


A word about the lifetime settings. The shorter the lifetime, the better the security of your session. This is because the session keys for the symmetric encryption algorithm are changed more often. As a result, less of your communication is vulnerable to one of the session keys being cracked. But there are some limitations on the Win2k machine. You can not set up a very short lifetime with it. On the other hand, the shorter the lifetime is, the more overhead you have, as additional bandwidth and processing power is dedicated to key exchange.

As described above in this tutorial, do not forget to create a "secret file" with your pre-shared "key" (password). One of the advantages of racoon is that you do not have to make some calculations about the password-length (bits divided by 8 must fit to the password length), and you do not have to use two passwords (one for authentication, one for encryption). With Windows 2000, you cannot use two passwords. You have only one shared secret for your communication and it is not divided by seperate passes for authentication and encryption.

For debugging purposes, we start racoon with the following options:

    racoon -F -v -f my-racoon.conf

This forces racoon to run in the foreground and we have a debugging protocol on the screen for later analysis of common problems.

On the Windows machine, perform the following steps:

  • Start a command window, and launch 'mmc'. Go to Console->Add/Remove Snap in. Add the IP Security Policy Management snap-in.

  • Click on IP Security Policies in the tree listing, and then select Action->Create IP Security Policy from the menu.

  • Go through the wizard. In particular,

    • Do not activate the default response rule.

    • Edit the properties.

  • In the properties, click on the Add button to add a new rule. Go through the wizard, and ensure the following settings:

    • The rule does not specify a tunnel.

    • The rule applies to the LAN

    • Use a string to protect the key exchange. Stick in the same key as you used in the psk.txt file

    • You'll want to create a new IP filter so that only traffic to the BSD box is subjected to the security policy. Select this new filter.

    • Select 'Require Security' for the filter action.

        Make sure the used configuration for 'Require Security' is as following.
        There are several rules you might see, check for a rule with this options
        or create a new rule by yourself:

        AH is disabled
        ESP integrity is MD5
        Encryption algo is 3DES

        For our first testing purposes, the 'Session Key Settings' are disabled.
        You can change and optimize it later.
  • Restart the IPsec policy agent, via the Administrative Tools->Services selection from the Control Panel. You should restart the agent every time if you make any changes to your rulesets to ensure that the rules are promptly and properly accepted.

  • Select the new policy in the window, and click on the toggle switch icon in the menu bar to activate the policy.

  • Start the "ipsecmon" program. With this tool you can monitor the active rules on the machine.

  • Open up a command window, and ping the BSD box. The ping will 'fail' with a message 'Negotiating IP Security'. Another ping should subsequently work. As soon as you ping, you can see on the BSD box that there are a lot of debug messages.

At this point, all IP traffic between the 2 boxes has been secured.

On the windows machine, you can see the encrypted session with the ipsecmon tool. On the BSD Box you can follow the debug messages to see that everything works well.

On the BSD machine we can try to dump the data on the wire to be sure everything works as we want. A command like

   tcpdump -i ed0 -x -X -s 14400

where ed0 is your interface, will show the packets on the wire. You can see both the IKE key exchange between Win2k and racoon, and the actual encrypted packets, shown as the ESP packets.

If you are having problems with setting up IPsec, we would urge you to first direct your queries to the appropriate mailing lists; freebsd-net@freebsd.org or freebsd-questions@freebsd.org; before contacting the authors directly.


 

Useful links

Kame documentation:

 

FreeBSD IPsec documentation:
Raccoon configuration tips:

 

Using certificates instead of pre-shared keys in Racoon:

 

NetBSD IPsec documentation:

 

Some RFCs:
  • RFC2709: Security Model with Tunnel-mode IPsec for NAT Domains

  • RFC2663: IP Network Address Translator (NAT) Terminology and Considerations

  • RFC2406: ESP

  • RFC2402: AH

  • RFC2409: IKE

http://www.rfc.net contains a comprehensive collection of the RFCs

 

Misc

Suggestions, hints, advice, corrections, and feedback about this document may be sent to the authors.

地方政府在引进高端创新联合体落地时,通常有哪些税收或土地配套政策?.docx 科易网基于行业知识库+行业大数据+科技资源要素+AI模型,以AI,赋能技术转移、成果转化、技术经理人培训、知识产权管理、区域产业分析与布局、地方科技招商、创新创业大赛等场景,推出科技创新领域的AI工具、场景化服务和数智化解决方案,推动科技创新与产业创新智能化发展。 立即下载

相关推荐

大型国企构建供应链创新联合体,协同研发管理为何仍是瓶颈?.docx

科易网基于行业知识库+行业大数据+科技资源要素+AI模型,以AI,赋能技术转移、成果转化、技术经理人培训、知识产权管理、区域产业分析与布局、地方科技招商、创新创业大赛等场景,推出科技创新领域的AI工具、场景化服务和数智化解决方案,推动科技创新与产业创新智能化发展。

FreeBSD IPsec mini-HOWTO (转)

FreeBSD IPsec mini-HOWTO (转)[@more@]Freebsd IPsec mini-HOWTO by Josh Tiefenbach <Mailto:josh@zipperup.org">...

csd3176的博客 346

Adobe Illustrator 2025 29.6.0.207 m0nkrus.zip.part001

Adobe Illustrator 2025 29.6.0.207 m0nkrus.zip.part001

加密算法源代码库 Encryption Source Code Base

Encryption Source Code Base1. C/C++, asm 加密算法DES 加密算法DES.H ,DES.C ,KEY.C 超期服役 DES 算法变形LIBDES,Tripledes,Ufc1, Ufc2 Ufc-crypt 比DES更安全 Bl

乱站乱弹 —— 阿新·乱站 5119

基于opencv-ANN的水果识别模型训练

本文通过opencv-ann-mlp训练模型,实现对五种水果进行分类识别。本文详细介绍该项目的各个过程,包括数据准备、预处理、样本读取、训练数据集制作、训练标签制作、模型参数设置、模型训练,模型测试验证等,总结该过程需要注意的事项。

qq_15985873的博客 3979

【计算机三级-数据库技术】操作题大题(第1套)

从触发器的语法中可知,【1】处应该填写的是执行触发器的表,【2】处应该填写指定在表或视图上执行哪些数据修改语句时将激活触发器的关键字。使用FOR或AFTER选顶定义的触发器为后触发器,即只有在引发触发器执行的语句中的操作都已成功执行,并且所有的约束检查也成功完成后,才执行触发器。转换成新的独立的模式,模式的属性由联系本身的属性及两个实体的键构成,主键由两端实体的键组合而成。实体的转换:在从ER图转换为关系模式时,一个实体转换成一个关系模式,实体的属性就是关系模式的属性,实体的键就是关系的主键。

放纵小开爱的博客 1107

自己动手删除时常来袭的 木马、病毒

自己动手删除时常来袭的 木马、病毒By 阿新 -- Seraph Chutium· http://com.6to23.com/前一阵我中了一个小破木马,开了个鬼端口。于是我开始自己手动删除,我一般不用杀毒软件,那些软件都是哄人的,比如一个简简单单的happy time都不能很好的清除!最后还是要靠我自己来~我建议有能力的话,时刻注意系统的变化,奇怪端口、可疑

乱站乱弹 —— 阿新·乱站 4991

CH592F RISC-V蓝牙LED灯设计:WS2812B驱动与微信小程序控制

蓝牙低功耗(BLE)是嵌入式物联网设备主流无线通信技术,其核心在于协议栈轻量化、射频稳定性与外设协同调度。基于RISC-V内核的蓝牙SoC(如CH592F)凭借高集成度、低待机电流和免外部巴伦的射频设计,显著降低硬件复杂度与BOM成本;而WS2812B作为单线级联RGB LED,依赖微秒级精准时序,需借助定时器+DMA机制规避CPU干预,保障动态效果流畅性。该方案融合电容触摸交互、GATT服务自定义与微信小程序标准Bluetooth API对接,适用于智能照明、DIY彩灯及教学实践等场景,是BLE+LED实

weixin_31163455的博客 439

无线局域网协议 IEEE802.11b 详解

无线局域网协议(802.11b)详解 整理:阿新 (Seraph Chutium)----- http://com.6to23.com/ 价格便宜的便携式计算机、移动电话和手持式设备的日趋流行,以及Internet应用程序和电子商务的快速发展,使用户需要随时进行网络连接。为满足这些需求,可以使用两种方法将便携式设备连接到网络,而没有电缆所带来的不便。这两种标准就是IEEE 802.11b和

乱站乱弹 —— 阿新·乱站 4693

避坑指南:解决‘Logical volume contains a filesystem in use’错误,顺利完成LVM根目录扩容

本文详细解析了Linux系统中LVM根目录扩容时遇到的‘Logical volume contains a filesystem in use’错误,提供了从错误诊断到实战解决方案的完整指南。通过动态扩容技术、单用户模式操作和LVM快照等方案,帮助管理员顺利完成根目录扩容,避免数据丢失和系统崩溃。

weixin_28702105的博客 232

ML307A模组连接ONENET平台(AT指令步骤教程)

ML307A 是一款集成度高、体积小的物联网通信模组,支持多种无线通信协议,如 LoRa、NB-IoT 等。它具有低功耗、远程通信等特点,适用于多种物联网场景。支持 LoRa 和 NB-IoT 等多种无线通信标准。提供丰富的 GPIO 接口。内置多种传感器支持。UART 接口:用于与微控制器或其他设备通信。GPIO 接口:可以连接外部传感器或执行器。电源接口:用于供电。OneNET 是中国移动推出的一款物联网开放平台,它提供了从数据采集、存储到分析的一站式解决方案。

xiewengeng的博客 5491

网站恶意代码陷阱分析及修复代码

“万花谷”网站恶意病毒“陷阱”分析介绍及修复代码 作者:邱腾 (chutium)新浪科技报道:  国家反病毒应急处理中心联防单位北京江民公司的反病毒应急小组最近监测到国内有心怀不轨的人到处在互连网上散发一个美丽诱人的网址"万花谷",这实际是一个恶意"陷阱",有人经不住诱惑,只用鼠标轻轻点一下,计算机就立即瘫痪了,这是有人利用Java最新技术进行破坏的又一个恶意网址。北京江民公司提醒广大上网用户

乱站乱弹 —— 阿新·乱站 3699

基于知识图谱的智能工作流引擎

随着大数据和人工智能技术的快速发展,企业和组织对数据的依赖程度日益增加。为了更好地管理和利用这些数据,知识图谱逐渐成为一种重要的工具。知识图谱不仅能够以结构化的方式表示复杂的知识,而且能够通过推理和查询提供深层次的信息。然而,如何将知识图谱应用于实际业务场景中,尤其是如何构建智能工作流引擎,仍然是一个具有挑战性的问题。智能工作流引擎是一种能够自动化执行复杂业务流程的系统,它可以通过对业务规则和数据的分析,自动生成和优化工作流,从而提高工作效率和准确性。

AI天才研究院 1873

NetBSD 中使用 IPSec 指南

 Using IPSec (IP Security Protocol)  Table of Contents13.1 - What is IPSec? 13.2 - Thats nice, but why do I want to use IPSec? 13.3 - What are the protocols behind IPSec? 13.4 - O

乱站乱弹 —— 阿新·乱站 3492

基于NRF52833芯片的DW3000 SPI驱动接口代码实现

详细介绍基于NRF52833、nRF52820 、nRF52832 nRF52840 芯片的DW3000 硬件驱动接口代码

DT程序员的博客 1227

John the Ripper 破解 DES、MD5 密文的使用说明

在网络论坛:http://www.s8s8.net 里看到有不少人说john可以破解NT的LANMAN密文,不清楚说的是哪个版本,可以肯定的是,1.4和1.5都是不支持NT的LANMAN密码破解的,包括1.5 for win。 John是一个优秀的破解标准DES加密的工具,shadow使用的就是标准DES加密,所以常用JOHN破解shadow密文,另外John还可以破解MD5,但可以肯定的是,不支

乱站乱弹 —— 阿新·乱站 3082

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Cisco CCIE 认证项目考生手册(附图)

这里有更多: http://chutium.top263.net/tech/certified.htm Cisco CCIE 认证项目考生手册1993年9月27日,Cisco公司推出其国际互联网络专家认证项目,作为一种识别最佳技术能手的资格认证。在伴随计划推进的新闻发布中,当时出任Cisco公司高级副总裁的John Chambers先生已经指出:“CCIE项目从其他网络厂商认证计划放弃

乱站乱弹 —— 阿新·乱站 2343

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Linux 中的 IPSec 协议

The IPSEC protocols in LinuxThis section provides details of the IPSEC protocols which FreeS/WAN implementsThe basic idea of IPSEC is to provide security functions, authentication and encryption , at

乱站乱弹 —— 阿新·乱站 1957

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

细说3721网络实名“病毒”(含部分源代码)

细说3721网络实名“病毒”(含部分源代码) 作者:邱腾 最近浏览一些门户网站时,会不知不觉的被安装上一个名为“3721网络实名”的 IE插件。虽说这些门户网站和3721本是好意,可是这样单方面地安装上这么一个 插件有点不妥!之所以说它是病毒,因为它同样是开机自动启动,而且虽然带来 一些方便,但是使系统运行的极不稳定,拖慢上网速度。在s8s8.net的论坛上看 到很多网友都说关机时经常会出现 ex

乱站乱弹 —— 阿新·乱站 1880

Windows 2000 高级问答 转

Win2000高级问答 转肥猪猪 (04/18/2000)  问:在安装WINDOWS2000的过程中要提示输入注册号,我想使安装更方便,怎样去处掉安装过程中需要输入注册号这个过程?  答:把安装文件拷贝到硬盘,打开i386目录下的setupp.ini,将PID后面的数字改成51873270,那么在整个安装过程中就不会再问你输入序列号了。  问:在安装WINDOWS2000的过程中我需要填写很多系

乱站乱弹 —— 阿新·乱站 1632

【最新】IP 地址分配表

全部内容太长了,总共147KB!……这里只贴一部分:全部内容在:http://com.6to23.com/文章最后告诉了个小秘密~您要是已经知道了别闲我无知……从追捕里整理 IP 的方法~很简单的,大家有兴趣就等它显示到最后看看吧。132.246.027.000~132.246.027.255 北京教育网 131.107.003.000~131.107.003.255 Micros

乱站乱弹 —— 阿新·乱站 1559

在 Windows 2000 中如何配置 IPSec 隧道

How to Configure IPSec Tunneling in Windows 2000The information in this article applies to:Microsoft Windows 2000 Advanced Server Microsoft Windows 2000 Datacenter Server Microsoft

乱站乱弹 —— 阿新·乱站 1551

Windows2000的日志文件详述及删除方法

Windows2000的日志文件详述及删除方法 阿新(Seraph Chutium) 收藏Windows2000的日志文件通常有应用程序日志,安全日志、系统日志、DNS服务器日志、FTP日志、WWW日志等等,可能会根据服务器所开启的服务不同。当我们用流光探测时,比如说IPC探测,就会在安全日志里迅速地记下流光探测时所用的用户名、时间等等,用FTP探测后,也会立刻在FTP日志中记下IP、时间、探测所

乱站乱弹 —— 阿新·乱站 1533

Windows NT/2000 系统默认共享清除工具 (批处理文件)

Windows NT/2000 系统默认共享清除工具 作者:阿新(Seraph Chutium) 主页:http://com.6to23.com/ ================================================================================ 使用方法: 例如,删除系统默认共享: delshare c d e ipc admin p

乱站乱弹 —— 阿新·乱站 1441
上一篇: Linux 中的 IPSec 协议
下一篇: NetBSD 中使用 IPSec 指南
chutium
博客等级 码龄25年 2粉丝 33原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值