Two days after the sections of the Patriot Act that authorized the NSA’s phone data collection program expired in the face of a Rand Paul filibuster, the Senate passed a bill Tuesday to reinstate it, but with restrictions on what the agency can collect. President Obama, who supported the USA Freedom Act, is expected to sign it soon.

Senate Republicans passed the bill with no changes, as requested by Speaker of the House John Boehner, and they did so in spite of their own majority leader, noted turtle-American Mitch McConnell. The New York Times reports McConnell tried to push through “a series of amendments that ... would have rolled back proposed controls on government spying,” all of which were rejected.

One of McConnell’s three amendments would have blocked a move to declassify the opinions of the FISA court, the secretive judicial entity that basically rubber-stamps the NSA’s surveillance requests in what Glenn Greenwald once described as “an empty process.”

McConnell argued that keeping those decisions secret was “discreet and sensible,” according to the Times. His colleagues disagreed.

The bill gives the NSA six months to stop its blanket collection of telephone metadata—which includes the times, durations, and phone numbers of nearly every call in the U.S.—and allows legal challenges to the National Security Letter gag orders that currently keep collection secret.

The vote marks the first time Congress has acted to limit the NSA’s surveillance programs since they were exposed by former agency contractor Edward Snowden in 2013.

[Photo of a giddy Rand Paul, who still has a lot of very bad opinions, via AP Images]