It was supplied by sea. Of course it had stores and could endure long periods of isolation. Axis ships should not in any event be allowed to leave the medd ( speaking about italy)… but i understand that this is an important element of creative axis strategy so we should probably leave it alone in terms of any imposing of restrictions.
As a factual note Italy did not posess enough fuel to leave the medd, while the fortress would have shot to pieces any passing ships. The straights also had sub nets and was mined so that any ships that moved had to go very slow in like a zig zag patten. This would have made it even easier for the brits to shoot at axis ships.
Hitler under operation Isabella and operation Felix had proposed even attacking and conquering his friend Spain in order to get a crack at spain.
If italy was to have any chance they would have needed to take the suez and the oil of the middle east along with Gibrater to gain the freedom to leave the medd.