People work on their computers at a coffee shop in Beijing. (Michael Robinson Chavez/The Washington Post)

CHINA’S GREAT FIREWALL, a massive system of Internet filters and blocking, has long had a crack in it. The firewall prevents most users inside China from accessing platforms outside the country, such as Facebook, Google and Netflix, in keeping with China’s desire to censor what can be seen and read. But popular software known as virtual private networks, or VPNs, permit a user inside China to tunnel through the firewall. Now the crack is being gradually cemented up.

A VPN has been particularly useful for foreign firms that come to China and want to link up with corporate networks outside it. Hoping to encourage such investment, China looked the other way for years at the existence of the VPNs, many available from Apple’s App Store in China. Some were easy to use — just tap the button and a user would be on Facebook as if sitting in Los Angeles instead of Beijing. The VPNs are popular among millions of young people, as well as journalists and others.

China has been heading toward restricting them for some time, but now it is cracking down in earnest with a new cybersecurity law that carries criminal penalties. According to a BBC report, Apple informed more than 60 VPNs that they were being removed from the App Store in China on grounds that they were not licensed, although some others remain. Apple’s chief executive, Tim Cook, said last week “we would obviously rather not remove the apps” but Apple will “follow the law wherever we do business.” Likewise, a Chinese company that operates Amazon’s cloud-computing business in China has sent a notice reminding customers to comply with local laws and cease using software such as VPNs that could pierce the Great Firewall. (Amazon founder Jeffrey P. Bezos owns The Washington Post.) Apple, Amazon and other Western technology pioneers can have a positive influence on China, but the laws they obey can also become tools of censorship. Mr. Cook said this week that Apple has been “engaging” with China over this “even when we disagree.” But there is no evidence that China’s leaders are prepared to loosen the reins of control. The trend is running the other way.

In Russia, no Great Firewall exists and major Internet platforms are accessible, but a government agency does blacklist specific sites. Now, President Vladimir Putin has signed legislation outlawing the use of VPNs and other methods that permit users to connect to the Internet anonymously, such as the Tor browser. Mr. Putin also signed legislation that will require instant-messaging services to establish the identity of users by their phone numbers — another step to make sure no one escapes surveillance if the state deems it necessary.

In both Russia and China, the impulse is the same: Rulers fear the free flow of information.