I am trying to work out Problem 1.24 of Gouvea's lecture notes on deformations of Galois representations, which goes as follows:
Let $K$ be a number field and $S$ a finite set of primes of $K$. We consider $K_S=$ the maximal extension of $K$ which is unramified outside $S$, and the Galois group $G_{K,S}=Gal(K_S/K)$. Show that any open subgroup $H$ of $G_{K,S}$ is again of the form $H=G_{K_1,S_1}$ for some finite extension $K_1/K$.
So the obvious idea is to take the fixed field $K_1=K_S^H$ (which is finite over $K$ because $H$ is of finite index) and set $S_1=\{\text{primes of $K_1$ that lie above a prime belonging to $S$}\}$. Then $H=Gal(K_S/K_1)$ so all we have to show is that $$K_S={K_1}_{S_1}.$$ Is this correct? I think I have proven at least "$\subseteq$": It suffices to show that, if $K_2/K$ is finite and unramified outside $S$, then $K_2\subseteq {K_1}_{S_1}$. For such a $K_2$, we have that the composite $K_2K_1/K$ is finite and unramified outside $S$ (because $K_1$ and $K_2$ have these properties), and we conclude that $K_2K_1/K_1$ is unramified outside $S_1$, because if a prime $\mathfrak P\notin S_1$ of $K_1$ ramifies in $K_2K_1$, i.e. $\mathfrak P \mathcal O\subseteq \mathfrak Q^2$ for the ring of integers $\mathcal O$ in and a prime $\mathfrak Q$ in $K_2K_1$, then we have for $\mathfrak p:=\mathfrak P \cap K\notin S $ that $\mathfrak p \mathcal O \subseteq \mathfrak P \mathcal O \subseteq \mathfrak Q^2 $ also ramifies, a contradiction.
For the reverse inclusion it suffices to show that, if $L/K_1$ is finite and unramified outside $S_1$, then $L/K$ is finite and unramified outside $S$. Maybe this is obvious but I do not see it... EDIT: this is true, because we additionally have that $K_1/K$ is unramified outside $S$ (see the comments for a counterexample to the general situation). Indeed, a prime $\mathfrak p \notin S$ of $K$ factors in $K_1$ as $\mathfrak p \mathcal O_{K_1}=\mathfrak P_1 \cdots\mathfrak P_g$ (the $\mathfrak P_i$ all pairwise distinct) and in $L$ as $\mathfrak p \mathcal O_{L}= \mathfrak p \mathcal O_{K_1} \mathcal O_L=\prod_i (\text {prime factors of }\mathfrak P_i, \text{all pairwise distinct})$, which means that $\mathfrak p$ is unramified in $L$.