Soak the beans in water for 8 hours. Drain and place them in a large pot of unsalted water. Bring to a simmer and cook for about 1 hour.
Meanwhile, peel and dice the celery. Peel and halve the garlic cloves. In a frying pan, add 4 tablespoons of olive oil, and sauté the celery and garlic.
Peel the tomatoes by briefly immersing them in boiling water. Chop the tomatoes.
When the garlic starts to brown, remove it. Add the tomatoes, bay leaves, salt, pepper, and chili, cover, and simmer for 10 minutes.
When the beans are cooked but still firm, drain and add them to the tomatoes. Cover and let simmer for another 10 minutes. The sauce should be thick but not too dry.
Cook the pasta in 4 liters of water with 40 g of coarse salt.
Blend ¼ of the bean sauce so that it coats the pasta well, then return this purée to the frying pan.
Drain the pasta when it is three-quarters cooked, then finish cooking it in the bean sauce. Add a bit of pasta cooking water to keep the sauce from drying out.
Drizzle with 2 tablespoons of olive oil and serve, accompanied by parmesan if desired.