Bakufu refers to the ruling Shogunate. When Gintama first introduced, the Bakufu was ruled by the Tokugawa shogunate, led by Tokugawa Shige Shige. Pronunciation is similar to bark-foo.
Shogun
Literally means a 'General', a Shougun usually has his own army, presiding over his own fiefdom. The English language has assimilated this phrase as Shogun.
When the Amanto first arrived on Edo, the Bakufu were resistant until the Inuisei race showed their superior weapons and technologies. The Bakufu had no chance of winning and the 12th Shogun collapsed of Anxiety. The Bakufu were on the brink of destruction until Tokugawa Sada Sada became the 13th Shogun. Tokugawa Sada Sada used excessive force such as assassination against higher Bakufu officials who was opposing him and with the help of his vassal Rotten Maizou helped him to the position.
Tokugawa Sada Sada first orders were welcoming the country to Amantos, this voiced Samurais around the country discontent and calling the Bakufu as traitors and selling out their country. The Samurais and the Bakufu started a long civil war called Joui War that lasted 20 years, this caused a deteriorating relationship with the Bakufu and the Amantos. To supress this the Bakufu allowed the Amanto Tendoshu to intervene with the government and set up Kansei Purge.
Sada Sada who was clinging on to his power helped supported Shige Shige to be the 14th Shogun. He would would step down from his position and becomes the Shogun Advisor.
In the recent events of Gintama, Tokugawa Shige Shige has resigned from the position of Shogun in order to take down his uncle Sada Sada. However there was an imperial order that Shige Shige was to be reinstated as Shogun so that the Hitotsubashi faction wouldn't usurping the throne.
The special military police force usally tasked to hunt down Jouishishi, with the success of Shinsengumi consisting of Ronin. The Bakufu wanted to create their own version of the Shinsengumi but only with higher-ranking samurai and retainers who served feudal lords and this created the Mimawarigumi.
Hasegawa Taizou used to be the Bakufu's Head of Immigration Department, assigned with a special duty to protect Amanto Prince Hata. However, instead of protecting, he punched the Prince instead, thereby failing his duty, and was ordered by his superiors to undergo 切腹 seppuku.
Currently the Oniwabanshuu ( お庭番衆 ) has been disbanded due to Jiraia's failed assassination to the former 13th Shogun Tokugawa Sada Sada. According to Zenzou, many members of Oniwabanshuu were killed by Jiraia.
Currently the Oniwabanshuu has been disbanded in order to switch services to Naruku, this was only done to strengthening the bond with Tendoshu and the Bakufu.
They were created to assist the Shogun and Bakufu for espionage and assasinations, there were four people revealed in Gintama that were part of Oniwabanshuu.
The only current known members of the Oniwabanshuu to survive are Sarutobi Ayame and Hattori Zenzou.